-
Notifications
You must be signed in to change notification settings - Fork 221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
F5 "else" statement (junos) #70
Comments
Hi |
After fussing with it for the better part of today I came up with the below solution which finally allowed all my F5 parsing to run without issue. It's not the cleanest solution and I'm sure it can be improved but it works well enough to allow me to accomplish what I set out for. Python 3.5.2.
|
Please try version 1.2.52 and see if this helps... |
Just gave it a shot, still runs into an issue. Lines like the below would be common in iRules. File "/var/www/asdf/fetch.py", line 344, in fetch_f5_config |
I don't have access to an F5 anymore... can someone respond with a sanitized F5 config with some else and elseif conditions in it? |
Attached below. Very generically sanitized. Ctrl+f for 'if_elseif_rule' for a good example complete with nested if statements. |
@timothyfranson , I finally rewrote the junos parser to support these kind of F5 configs... please test version 1.5.1 and tell me whether this works for you. |
if { something } {
do X
} else {
do Y
}
Traceback (most recent call last):
File "./test.py", line 4, in
parse = CiscoConfParse('file.conf', syntax='junos', debug=True, comment='#')
File "/usr/lib/pymodules/python2.7/ciscoconfparse/ciscoconfparse.py", line 225, in init
config = self.convert_braces_to_ios(rgx.split(text))
File "/usr/lib/pymodules/python2.7/ciscoconfparse/ciscoconfparse.py", line 351, in convert_braces_to_ios
line, line_offset = line_level(tmp.strip())
File "/usr/lib/pymodules/python2.7/ciscoconfparse/ciscoconfparse.py", line 345, in line_level
raise ValueError("Could not parse: '{0}'".format(input))
ValueError: Could not parse: '} else {'
The text was updated successfully, but these errors were encountered: