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...
Kent_Perrier_50
Mar 17, 2011Nimbostratus
I finally got this working. It turns out one of the things I was beating my head against was the data group itself. I had created it with the data group editor inside of the iRule Editor. Looking at it from the web gui, it looked ok, but something was not right as I could not access the data the way I thought I should. After I deleted the existing entries from the gui and reentered them, every thing worked.
Here is what I ended up with. Any coding tips are appreciated!
when HTTP_REQUEST {
set static::debug "0"
set the data group name
set clname "AppVersion[virtual name]"
set the default pool
set default_pool "defpool01"
if there isn't a data group with the above name, set the pool to default and exit
if {! [class exists $clname]} {
if { $static::debug } {
log local0. "Data group $clame not found, using default_pool $default_pool"
}
pool $default_pool
return
}
iterate over the members of the data group, looking for a context root that
matches the start of the URI
set searchID [class startsearch $clname]
while { [class anymore $clname $searchID] } {
set list [class nextelement $clname $searchID ]
set foo [split $list]
set cxt_root [lindex $foo 0]
set app_pool [lindex $foo 1]
if the URI starts with the context root from the data class, set the pool
if { [HTTP::uri] starts_with "$cxt_root"} {
if { $static::debug } {
log local0. "data group values: $cxt_root $app_pool"
log local0. "setting pool to $app_pool"
}
pool $app_pool
return
}
}
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
}
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