Forum Discussion

Basil_Parsley_1's avatar
Basil_Parsley_1
Icon for Nimbostratus rankNimbostratus
Sep 08, 2016

ifile default location of imported files

Guys simple one - what is the default location of "ifile" files on an LTM when uploaded via the GUI under

 

system ... File man .. iFile list … Import

 

Basically I just need to pull HTML files off the device edit and re-upload. Happy to take any additional relevant advice / input...

 

1 Reply

  • Hi Basil,

    you can lookup the iFile location on your harddisks by using the command below...

    [itacs@f5-test:Active:Standalone] ~  find / -name "*MyiFileName*"

    But its not possible to change the iFile in the background, since they are referenced within your configuration using a version number including a MD5 hash. If you try to change them directly you will most likely destroy the iFiles on the next configuration load.

    I would recommend to export all your iFiles from the device (via SCP). Edit them as needed. Rename them 1:1 to match the name of the iFile file object and upload every ifile back to e.g.

    /ifiles/*
    .

    The use a TMSH script to enumerate every iFile file object and update every single iFile configuration using the

    source-path file:/ifiles/$ifile_name
    option.

    You may use the script below as a starting point...

    update_ifiles.tcl

    proc script::run {} {
        foreach ifile [tmsh::get_config /sys file ifile] {
            set ifile_name [tmsh::get_name $ifile]
            if { [catch {
                eval "tmsh::modify /sys file ifile $ifile_name \{ source-path file:/ifiles/$ifile_name \}"
                puts "iFile Update: Successfully updated iFile : $ifile_name"
            }] } then {
                puts "iFile Update: Failed to update iFile : $ifile_name"
            }
        }   
    }
    

    TMSH script execution

    [itacs@f5-02:Active:Standalone] /  tmsh run cli script file /script_path/update_ifiles.tcl 
    iFile Update: Successfully updated iFile : MyiFile
    iFile Update: Successfully updated iFile : iFileTest
    curl: (37) Couldn't open file :/ifiles/iFileTest2
    
    iFile Update: Failed to update iFile : iFileTest2
    

    Note: If a given iFile is not found within the /ifiles/ directory its getting ignored. So you could also export/change/modify just a subset of your iFiles...

    Cheers, Kai