Forum Discussion
tidenz_92110
Nimbostratus
Jun 16, 2010irule data class reference issues 9.4.x to 10.1
Hi Guys,
We recently have migrated to v10.1 from 9.4.7 and we have broken our existing irule. The part that is braking is parsing the data class into an array for processing.
when debugging i see that the data class name is added into the array not the actual index and value.
reading through the new class commands in v10.x i need to remove the $::data group as this what is causing the name of the data group to be entered.
I have changed it but i still see the same output in the debug string.
log local0.debug "Adding $index --> $data"
Jun 16 15:51:14 Rule EP-cms-nz-http-ir : Adding URL_REWRITE_NZ_LIST -->
Any ideas?
when RULE_INIT {
set this to 1 to enable maintenance
set ::MAINTENANCE 0
array unset ::ARRAY_REWRITE_NZ
array set ::ARRAY_REWRITE_NZ { }
array unset ::ARRAY_REDIRECT_NZ
array set ::ARRAY_REDIRECT_NZ { }
set ::SERIAL1 0
set ::SERIAL2 0
set ::REQ_COUNT 0
log local0.debug "-------- RULE INIT -------------"
if { [findclass "serial" $::URL_REWRITE_NZ_LIST "|"] != $::SERIAL1 }{
clear contents of previous mem resident table
array unset ::ARRAY_REWRITE_NZ
set ::SERIAL1 [findclass "serial" $::URL_REWRITE_NZ_LIST "|"]
log local0.debug "RELOADING UPDATED URI REWITE CLASS TO MEMORY"
foreach item $::URL_REWRITE_NZ_LIST {
set index [findstr $item "" 0 "|"]
set data [findstr $item "|" 1 "\n"]
set LIST "$index $data"
set ::ARRAY_REWRITE_NZ($index) $data
log local0.debug "Adding $index --> $data"
}
- hoolio
Cirrostratus
In 10.x, you can no longer directly access a datagroup as a TCL list. For the same functionality, you can use [class get my_class]:when RULE_INIT { set this to 1 to enable maintenance set ::MAINTENANCE 0 array unset ::ARRAY_REWRITE_NZ array set ::ARRAY_REWRITE_NZ { } array unset ::ARRAY_REDIRECT_NZ array set ::ARRAY_REDIRECT_NZ { } set ::SERIAL1 0 set ::SERIAL2 0 set ::REQ_COUNT 0 log local0.debug "-------- RULE INIT -------------" if { [findclass "serial" URL_REWRITE_NZ_LIST "|"] != $::SERIAL1 }{ clear contents of previous mem resident table array unset ::ARRAY_REWRITE_NZ set ::SERIAL1 [findclass "serial" URL_REWRITE_NZ_LIST "|"] log local0.debug "RELOADING UPDATED URI REWITE CLASS TO MEMORY" foreach item [class get URL_REWRITE_NZ_LIST] { set index [findstr $item "" 0 "|"] set data [findstr $item "|" 1 "\n"] set LIST "$index $data" set ::ARRAY_REWRITE_NZ($index) $data log local0.debug "Adding $index --> $data" } } }
- tidenz_92110
Nimbostratus
Thanks Aaron, - tidenz_92110
Nimbostratus
The initial irule was developed by someone else and uses arrays to store and process redirects, is this the best approach? in terms of speed and future compatibility. - hoolio
Cirrostratus
I have also made a few changes as the set data [findstr $item "|" 1 "\n"] also inserted a {} bracket.
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