Forum Discussion
Python Bigsuds - Massive iRule removal - bigsuds script for massive iRule removal
I am testing this python script to be able to do a mass irule removal.
It appears there is an issue with
except Exception, e:
^
SyntaxError: invalid syntax
Here is the snip of that lines before and after
I have not done anything to the orginal script except to line up the tab's and indent's.
Here is where this script lives.
https://devcentral.f5.com/wiki/iControl.Python-Bigsuds-Massive-iRule-removal.ashx
Line 51 on that page would be the line that give the error.
I see on various websites this syntax was an issue pre 2.6 but i am running
Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)]
for id_rule in rules:
if rule["rule_name"] == rule_to_remove:
try:
b.LocalLB.VirtualServer.remove_rule([virtualservers[count]], [[rule]])
print "\nRemove rule: %s, from vs: %s" % (rule, [virtualservers[count]])
except Exception, e:
print e
break
count +=1
Any help would be greatly appreciated as this is my first time using python.
Thanks,
ccna55
2 Replies
- pete_71470
Cirrostratus
It appears there is an issue with indentation. Does this snippet in your example have the same indentation as the file as it appears on your 2.7.3 system?
The parts to 'try' should be indented equally:
for if try: b.LocalLB print except Exception, e: print e break count... if that's where it belongs with your logic - ccna55_14039
Nimbostratus
Thanks very much for this info, With this i was able to fix the script.
Much Appreciated.
ccna55
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
