Forum Discussion

dragonflymr's avatar
dragonflymr
Icon for Cirrostratus rankCirrostratus
Jan 26, 2016

tmsh script and pool members

Hi,

 

Probably easy one but not for me 😞

 

I am looking for simplest and fastest way to verify settings of pool member in given pool/s - for example description. Right now I have such code that is working but maybe there is simpler way?

 

set pool_names [lrange $tmsh::argv 1 end]

foreach pn1 $pool_names {
    foreach obj1 [tmsh::get_config /ltm pool $pn1] {

        puts $obj1
        tmsh::modify /ltm pool $pn1 description "Orange"
        tmsh::log "Description is [tmsh::get_field_value $obj1 description]"

        foreach member1 [tmsh::get_field_value $obj1 members] {

            puts $member1
            puts "Pool member desc: \"[tmsh::get_field_value $member1 description ]\""

        }
    }
}

puts are just for testing of course. So last puts returns description for each pool member in a pool.

 

What puzzles me as well is why after using tmsh::modify /ltm pool $pn1 description "Orange" tmsh::log reports previous value. After script is finished value is set to "Orange" but inside script even after modify old value is reported.

 

I assume as well that there is no need for tmsh save sys config to permanently save changes?

 

Piotr

 

2 Replies

  • modify in tmsh modifies only the running config, you do need to save your changes to impact the startup config.

     

  • Hi Jason,

     

    Nice to hear from you. I am a bit surprised that config save is necessary - o\in all examples I checked no config save is present or mentioned (like in your example Build GTM Configuration).

     

    So last line in the script should be:

     

    tmsh::save sys config

     

    What about value modification not reported in script but reflected in config after script is finished - is that normal?

     

    I am pretty sure that for below sequence (when pool description was initially "Red")

     

    puts [tmsh::get_field_value $obj1 description] tmsh::modify /ltm pool $pn1 description "Orange" puts [tmsh::get_field_value $obj1 description]

     

    script output was Red Red

     

    but then when I checked description it was set to Orange.

     

    Piotr