Forum Discussion
David_Bradley_2
Nimbostratus
Feb 15, 2007How do I modify class data from an iRule?
Is there a way to make a change to a class from an irule? For instance, let's say I have:
class Foobar {
"thing1 10"
"thing2 20"
}
Now I want to change "thing2 20" to "thing2 30" from within an irule. I can't seem to make this work with any straightforward TCL statements, such as lreplace. I've also tried to add "thing3 30" using lappend. No luck. If there is a way i'm assuming there is some black magic to do this. Help! Thanks.
- David_Bradley_2
Nimbostratus
I should mention that I DO actually see the modifications I made to the data when I dump it own from within the iRule. It doesn't show up in the actual class, though. I'm assuming the class is copied into a TCL list when I do an lappend, or lreplace. As such it's only modifying this TCL structure, probably as a global variable. What I really want to do is to be able to make modify class data from within the irule, then read that modified class back out from iControl. When I run my iControl code to read the class data, it shows up as the original, unmodified, data. Thanks. - Peter_Wohlers_7
Nimbostratus
we do stuff like this pretty regularly...usually with banned ip addresses. - David_Bradley_2
Nimbostratus
Thanks! Can this be used inside an iRule? I know you can do this in the F5 itself on the command line. - Currently there is no way to write to a data group (or class) from within an iRule. You can modify it's local copy but there is no way to flush your changes back to the configuration. What happens is that at rule initialization, the data groups are loaded into internal TCL lists at the global scope. At this point it's just a copy of the original data group in TCL form. There are lots of "gotchas" involved with modifying these lists and then flushing them back into the system specifically related to content format changing.
- JRahm
Admin
Since we're talking theory here, couldn't you log the change, have a syslog-ng filter listening for a keyword in that log statement that would fire off a message to an iControl application which would then update the class?
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects