Forum Discussion
Is 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 way to check if the ASM policy exists before doing an enable? Something like:
if { [AMS::policy exists $policy] } { ASM::enable $policy }
- Rico
Cirrus
KWH,
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.
Recent Discussions
Related Content
* 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