Forum Discussion
static variable re-initialization on config reload
From: https://devcentral.f5.com/articles/the101-irules-101-variables
simply set up your static::varname variables, likely in RULE_INIT, since that special event only runs once at load time and static variables are global in scope, meaning they stay set until the configuration is reloaded.
I am overwriting the file with a new one from the GUI interface and then reloading the config using
tmsh load /sys config partitions-all
However, the static variable is not getting the new value from the file. Looks like It's value is never getting wiped out even after the reloading the config. What am I missing?
when RULE_INIT {
if { [info exists static::key_value] and [string length static::key_value] }{
Use existing key
} else {
set static::key_value [ifile get "/Common/key"]
}
}
1 Reply
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