|
|
@ -262,10 +262,21 @@ class Switch:
|
|
|
|
|
|
|
|
|
|
|
|
post_reboot = requests.post(url_reboot, data=json.dumps(data), headers=self.headers)
|
|
|
|
post_reboot = requests.post(url_reboot, data=json.dumps(data), headers=self.headers)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
limit = False
|
|
|
|
if "--limit" in sys.argv:
|
|
|
|
if "--limit" in sys.argv:
|
|
|
|
list_index = sys.argv.index("--limit") + 1
|
|
|
|
limit = True
|
|
|
|
if len(sys.argv) >= list_index:
|
|
|
|
limit_list_index = sys.argv.index("--limit") + 1
|
|
|
|
|
|
|
|
if len(sys.argv) <= limit_list_index:
|
|
|
|
raise RuntimeError("--limit must be followeb by a comma separated list of switch")
|
|
|
|
raise RuntimeError("--limit must be followeb by a comma separated list of switch")
|
|
|
|
|
|
|
|
limit_switchs = set(
|
|
|
|
|
|
|
|
filter(
|
|
|
|
|
|
|
|
bool,
|
|
|
|
|
|
|
|
map(
|
|
|
|
|
|
|
|
lambda x: x.strip(),
|
|
|
|
|
|
|
|
sys.argv[limit_list_index].split(',')
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
#if "--force" in sys.argv:
|
|
|
|
#if "--force" in sys.argv:
|
|
|
|
# sw = Switch()
|
|
|
|
# sw = Switch()
|
|
|
|