Forum Discussion
sarat_82132
Nimbostratus
Jun 25, 2015Associate a Vserver with a property
Hi:
in my Irule I want to access a property that will be specific to the Vserver. this irule will be shared by multiple vservers but the property that I want to use will be specific to vserver. ...
Ronald_van_der3
Nimbostratus
Jun 25, 2015I assume you are referring to variables. You might want to have a look here: https://devcentral.f5.com/articles/-the101-irules-101-variables
sarat_82132
Nimbostratus
Jun 26, 2015let me give my example
There are two Vservers vserver-1 is for all sales applications and vserver-2 is for all marketing applications. there is one IRule ( code snippet below ) which needs to fetch different data groups.
The way I solved this is by creating two Irule Instances f5 and assocate irule-1 to vserver-1 and irule-2 to vserver-2. all the contents are excatly same for irule-1 and irule-2 except the value of the dg_application_list_name ( example below) . if this value somehow can be read from the Vserver, that will be very useful.
when HTTP_REQUEST priority 100 {
set dg_application_list_name "sales-applications"
set dg_application_list [class get $dg_application_list_name]}]
foreach { row } $dg_application_list {
do something
}
}
when HTTP_REQUEST priority 100 {
set dg_application_list_name "marketing-applications"
set dg_application_list [class get $dg_application_list_name]}]
foreach { row } $dg_application_list {
do something
}
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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