Forum Discussion

fpieressa's avatar
fpieressa
Icon for Altostratus rankAltostratus
Jul 03, 2015

Can't create Node in iApp using variables

Hi! I'm trying to create a Node using iApp with the following simple Implementation:

 

package require iapp 1.0.0

 

iapp::template start

 

set addr 1.1.1.1

 

iapp::conf create ltm node test { address $addr }

 

iapp::template stop

 

But when I create a new Application using this iApp, I receive the following error:

 

script did not successfully complete: ("$addr" invalid IP address while executing "tmsh::create [string range $args 7 end] " ("create" arm line 1) invoked from within "switch -exact -- [string range $args 0 5] { create { tmsh::create [string range $args 7 end] } modify { tmsh::modify [string r..." (procedure "iapp::conf" line 14) invoked from within "iapp::conf create ltm node test { address $addr }" line:6)

 

In the other hand, if I use the following Implementation (using an IP, not a variable), it works:

 

package require iapp 1.0.0

 

iapp::template start

 

iapp::conf create ltm node test { address 1.1.1.1 }

 

iapp::template stop

 

Is there any cast I must do?

 

Thanks!

 

2 Replies

  • Hi Franco,

    You need to escape those curly braces, like this:
    package require iapp 1.0.0
    iapp::template start
    set addr 1.1.1.1
    iapp::conf create ltm node test \{ address $addr \}
    iapp::template stop