Forum Discussion

Neil_Marks_2466's avatar
Neil_Marks_2466
Icon for Nimbostratus rankNimbostratus
Jun 27, 2018

iapp::get_items -filter question...

I am looking to present in a dropdown list a selection of pools which end in either "_DC1" or "_DC2", but I can't get the syntax correct... various formats I have tried..

return [iapp::get_items -filter NAME =~ "_DC[12]$" ltm pool]
return [iapp::get_items -filter NAME = "_DC[12]$" ltm pool]
return [iapp::get_items -filter NAME ~ "_DC[12]$" ltm pool]
return [iapp::get_items -filter NAME =~ /_DC[12]$/ ltm pool]
return [iapp::get_items -filter NAME = /_DC[12]$/ ltm pool]

I get various error messages - such as invalid command "12" while executing "12" .... Can anyone help with the correct syntax? BTW - this is on BIG IP LTM V12.1.2 (2.0.276) Thanks Neil

6 Replies

  • Have you tried escaping the brackets around the 12. For example, "_DC\[12]\$"

     

  • [12]
    is probably being interpreted by TCL as command. Instead, perhaps your pattern should be a string literal, e.g.
    {_DC[12]$}
    .

    Otherwise, have you tried not using the

    -filter
    argument, but instead filtering with TCL's
    lsearch -regexp -inline
    ?

    Depends on whether F5's TCL is up-to-date, but maybe:

    choice dc_pools {
        [lsearch -regexp -all -inline [iapp::get_items ltm pool] {_DC[12]$}]
    }
    
    • Neil_Marks's avatar
      Neil_Marks
      Icon for Nimbostratus rankNimbostratus

      Tried both approaches above and both fail... the lsearch one needed a tcl before the 1st {.. but it still failed as it effectively tried to execute a command name called the pools which where matched... without the tcl, the import of the template failed due to invalid characters "[" and a bunch of others... :-(

       

  • [12]
    is probably being interpreted by TCL as command. Instead, perhaps your pattern should be a string literal, e.g.
    {_DC[12]$}
    .

    Otherwise, have you tried not using the

    -filter
    argument, but instead filtering with TCL's
    lsearch -regexp -inline
    ?

    Depends on whether F5's TCL is up-to-date, but maybe:

    choice dc_pools {
        [lsearch -regexp -all -inline [iapp::get_items ltm pool] {_DC[12]$}]
    }
    
    • Neil_Marks's avatar
      Neil_Marks
      Icon for Nimbostratus rankNimbostratus

      Tried both approaches above and both fail... the lsearch one needed a tcl before the 1st {.. but it still failed as it effectively tried to execute a command name called the pools which where matched... without the tcl, the import of the template failed due to invalid characters "[" and a bunch of others... :-(