Forum Discussion

zblue_123071's avatar
zblue_123071
Icon for Altocumulus rankAltocumulus
Jul 10, 2013
Solved

Using iFiles with iRules - Updating Problem

Hi,

I’ve run into an issue that I cannot seem to find an answer to, so, I’m hoping someone can point me into the right direction.

Basically, I have an iRule that checks if there’s at least 1 active member in my pool. If there’s not at least 1 active member in the pool, the iRule will put up a maintenance page; that maintenance page is an iFile called MaintPage (just a basic html page).

My problem is that if I make a change to the iFile, that update will not register/refresh and continue to use the old version. My workaround has been to edit to the iFile and then remove it from the list (Local Traffic>>iRules : iFile List>>MaintPage) and then add it back in order for it to update. Hope that makes sense…

Here is the iRule for reference:

when HTTP_REQUEST {
switch [HTTP::host] {
"sub.domain.com" {
if { [active_members my-pool] < 1 } {
HTTP::respond 200 content [ifile get MaintPage]
} else {
pool my-pool
}
}
}
}

Thanks again for looking,

Zac

 
  • Thanks, I was able to figure this out.

    Before, I was using vi to edit the file in "/config/filestore/files_d/Common_d/ifile_d/MaintPage.html" and after I made the update, the page wouldn't reflect the update.

    Now, I go into tmsh and enter "edit sys file ifile MaintPage.html" and after I make the changes, the page is updated.

    Thanks!

2 Replies

  • My problem is that if I make a change to the iFile, that update will not register/refresh and continue to use the old version.how did you modify the file?

    This is my testing.

     create text file
    
    [root@ve11a:Active:Changes Pending] config  cat /var/tmp/simpletext.txt
    this is original simple text.
    
    root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) create sys file ifile simpletext_file source-path file:/var/tmp/simpletext.txt
    Copying file "file:/var/tmp/simpletext.txt" ...
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
      0    30    0    30    0     0  65502      0 --:--:-- --:--:-- --:--:--     0
    
    root@(ve11a)(cfg-sync Changes Pending)(Active)(/Common)(tmos) list sys file ifile simpletext_file
    sys file ifile simpletext_file {
        checksum SHA1:30:0c34c01d448d15874f45477a8ba8e699a196325b
        create-time 2013-07-11:15:16:28
        created-by root
        last-update-time 2013-07-11:15:16:28
        mode 33152
        revision 1
        size 30
        source-path file:/var/tmp/simpletext.txt
        updated-by root
    }
    root@(ve11a)(cfg-sync Changes Pending)(Active)(/Common)(tmos) create ltm ifile simpletext_ifile file-name simpletext_file
    
    root@(ve11a)(cfg-sync Changes Pending)(Active)(/Common)(tmos) list ltm ifile simpletext_ifile
    ltm ifile simpletext_ifile {
        file-name simpletext_file
    }
    
    root@(ve11a)(cfg-sync Changes Pending)(Active)(/Common)(tmos) list ltm virtual bar
    ltm virtual bar {
        destination 172.28.20.111:80
        ip-protocol tcp
        mask 255.255.255.255
        profiles {
            http { }
            tcp { }
        }
        rules {
            qux
        }
        source 0.0.0.0/0
        source-address-translation {
            type automap
        }
        vlans-disabled
    }
    
    root@(ve11a)(cfg-sync Changes Pending)(Active)(/Common)(tmos) list ltm rule qux
    ltm rule qux {
        when HTTP_REQUEST {
            HTTP::respond 200 content [ifile get simpletext_ifile]
    }
    }
    
    [root@ve11a:Active:Changes Pending] config  curl http://172.28.20.111
    this is original simple text.
    
     modify the text file
    
    [root@ve11a:Active:Changes Pending] config  cat /var/tmp/simpletext.txt
    this is new simple text.
    
    root@(ve11a)(cfg-sync Changes Pending)(Active)(/Common)(tmos) modify sys file ifile simpletext_file source-path file:/var/tmp/simpletext.txt
    Copying file "file:/var/tmp/simpletext.txt" ...
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
      0    25    0    25    0     0  39308      0 --:--:-- --:--:-- --:--:--     0
    
    [root@ve11a:Active:Changes Pending] config  curl http://172.28.20.111
    this is new simple text.
    
    

     

  • Thanks, I was able to figure this out.

    Before, I was using vi to edit the file in "/config/filestore/files_d/Common_d/ifile_d/MaintPage.html" and after I made the update, the page wouldn't reflect the update.

    Now, I go into tmsh and enter "edit sys file ifile MaintPage.html" and after I make the changes, the page is updated.

    Thanks!