Forum Discussion
Kent_Perrier_50
Mar 16, 2011Nimbostratus
Data Groups for dummies
Is there an article out there that I can use as a data groups for dummies guide?
Do to a bug in 10.2.0 irule array processing, I need to rewrite an irule to use data groups instead and I hav...
hooleylist
Mar 18, 2011Cirrostratus
Hi Kent,
That looks like a great start. You don't actually have to iterate through the datagroup manually to do a starts_with comparison. You can use class search to do this:
when RULE_INIT {
Log debug to /var/log/ltm? 1=yes, 0=no
set static::debug 0
}
when CLIENT_ACCEPTED {
Save the VS default pool name before it's changed
set default_pool "defpool01"
set the data group name
set clname "AppVersion[virtual name]"
}
when HTTP_REQUEST {
if there isn't a data group with the above name, set the pool to default and exit
if {[class exists $clname]} {
Search the datagroup for a name that starts with the URI
set pool_name [class search -value $clname starts_with [HTTP::uri]]
if { $pool_name eq ""} {
we don't match the context roots in the data class
if { $static::debug } { log local0. "fell through to the default pool" }
pool $default_pool
} else {
if { $static::debug } { log local0. "Matched $app_pool" }
pool $app_pool
}
} else {
if { $static::debug } { log local0. "Data group $clame not found, using default_pool $default_pool" }
pool $default_pool
}
}
Aaron
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