Forum Discussion
Anthony_Hatch_3
Nimbostratus
Apr 01, 2011iRule Syntax Requirement for Data Group Names
Today we received the following error on our LTM: err local/tmm3 tmm3[7053] 01220001 TCL error: rewrite_mstatic-irule - ambiguous option "-": must be -all, -index, -element, -name, ...
hoolio
Cirrostratus
Apr 02, 2011Hi Anthony,
I think what's happening here is that the leading hyphen in the value you're looking up is causing the value to be interpreted as a flag on the class match command. You can prevent this from happening by entering two hyphens. Here is an example which triggers the error:
RULE_INIT {
log local0. "[class match -value "-lookup_string" equals $my_class]"
}< RULE_INIT > - bad option "-lookup_string": must be -all, -index, -element, -name, or -value while executing "class match -value "-lookup_string" equals $my_class"
To avoid this issue, insert two hyphens after the last actual flag:
RULE_INIT {
log local0. "[class match -value -- "-lookup_string" equals $my_class]"
}Or for your example:
class match -- [string tolower [HTTP::header User-Agent]] contains non_mobi_ua
Note that this option is described on the class command page:
http://devcentral.f5.com/wiki/default.aspx/iRules/class
-- Terminates option processing (useful if the or begins with a hyphen).Aaron
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