Forum Discussion
sogboj_312474
Nimbostratus
Dec 22, 2018Is there a way in an iRule to determine if an ASM policy exists before doing an ASM::enable on it?
I am trying to base the ASM policy i assign to my inbound connections on the URL in my iRule. If i do an ASM::enable on a policy that does not yet exist the connection/session fails.
Is there a ...
Rico
Cirrus
Dec 24, 2018KWH,
It seems like what you are looking for is the iRules 'catch' statement. This will try to run a piece of code and check for any runtime errors. If there is any error, it will run a second block of code instead. This will help you check if a certain policy exists. I haven't properly tested this code, but I believe your solution should look something like this.
if { [catch {
ASM::enable $policy
log local0. "$policy was enabled"
}] } then {
This block only triggers if the above code would fail
log local0. "$policy does not exist"
}More information here, if you would like to research some more yourself.
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
