Forum Discussion
iApp variable scope
- May 21, 2015
Scope is not the problem. Tcl treats anything inside curly braces as verbatim. Enclosed strings in quotes and escape each curly brace with a backslash.
tmsh_modify "ltm data-group internal /Common/snat-map records add { $::private__privateAddr { data $::public__publicAddr }}"
Hi Fred! I've a similar questions:
I'm modifying an iApp in order to create an irule to assign to the vs.
the assignment is here { [iapp_conf create ltm virtual ${app}_vs \ destination [iapp_destination $::pool__addr $::pool__port] \ mask $mask \ $vs_params \ ip-protocol tcp \ mirror $mirror_action \ profiles replace-all-with { $tcp_profiles http } \ rules { iwf_test_irulebal iwf_$irulelog }] }
the irule are very simple
the first irule is with no variables
tmsh::create ltm rule iwf_$irulelog {
when HTTP_REQUEST {
log local0. "No variables"
}
`
}
the second irule need to balance on the pool created with the iapp, so i need to write it with variable statement and not with string
`iapp_conf create ltm rule iwf_test_irulebal {
when HTTP_REQUEST {
if { [HTTP::uri] starts_with "/portal${app}_pool" } {
use pool ${app}_pool }
else {
TCP::close
}
}
}
i've tried with \before the { but seems not works. also with ::global variable but not works.
In a classic BIG-IP environment without iapp the use of variable in irule works. how can i use the variable in an irule created with an iapp?
I typically use string map.
set app "xyz"
set irule [string map " $app" {
when HTTP_REQUEST {
if { [HTTP::uri] starts_with "/portal_pool" } {
use pool _pool }
else {
TCP::close
}
}
}]
iapp::conf create ltm rule iwf_test_irulebal $irule
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com