Delete LTM Pools

Problem this snippet solves:

This example shows how to automatically remove any pools beginning with a given string.

Code :

proc script::run {} {
    if { $tmsh::argc < 2 } {
       puts "Requires one argument: "
   } else {
       set poolstring [lindex $tmsh::argv 1]
       set len [expr { [string length $poolstring] - 1 }]
   }
   foreach {pool} [tmsh::get_config /ltm pool] {
       if { [string range [tmsh::get_name $pool] 0 $len] equals $poolstring } {
           tmsh::delete ltm pool [tmsh::get_name $pool]
       }
    }
}

proc script::help {} {
    tmsh::add_help "Delete a list of pools beginning with specified string\n\
       " 
}
Published Mar 10, 2015
Version 1.0
No CommentsBe the first to comment