Compare commits
1 commit
Author | SHA1 | Date | |
---|---|---|---|
![]() |
18d0c52e03 |
1 changed files with 27 additions and 23 deletions
50
main.py
50
main.py
|
@ -237,34 +237,38 @@ 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)
|
||||||
|
|
||||||
|
|
||||||
if "--force" in sys.argv:
|
|
||||||
sw = Switch()
|
|
||||||
for switch in all_switchs:
|
|
||||||
sw.switch = switch
|
|
||||||
sw.gen_conf_and_write()
|
|
||||||
try:
|
|
||||||
sw.apply_conf()
|
|
||||||
except:
|
|
||||||
print("Erreur dans l'application de la conf pour " + switch["short_name"])
|
|
||||||
|
|
||||||
if "--upgrade" in sys.argv:
|
|
||||||
sw = Switch()
|
|
||||||
for switch in all_switchs:
|
|
||||||
sw.switch = switch
|
|
||||||
sw.upgrade()
|
|
||||||
|
|
||||||
|
|
||||||
for service in api_client.list("services/regen/"):
|
if __name__=='__main__':
|
||||||
if service['hostname'] == client_hostname and \
|
|
||||||
service['service_name'] == 'switchs' and \
|
if "--force" in sys.argv:
|
||||||
service['need_regen']:
|
sw = Switch()
|
||||||
error = False
|
|
||||||
sw=Switch()
|
|
||||||
for switch in all_switchs:
|
for switch in all_switchs:
|
||||||
sw.switch = switch
|
sw.switch = switch
|
||||||
sw.gen_conf_and_write()
|
sw.gen_conf_and_write()
|
||||||
try:
|
try:
|
||||||
sw.apply_conf()
|
sw.apply_conf()
|
||||||
except:
|
except:
|
||||||
error = True
|
print("Erreur dans l'application de la conf pour " + switch["short_name"])
|
||||||
api_client.patch(service['api_url'], data={'need_regen': error})
|
|
||||||
|
if "--upgrade" in sys.argv:
|
||||||
|
sw = Switch()
|
||||||
|
for switch in all_switchs:
|
||||||
|
sw.switch = switch
|
||||||
|
sw.upgrade()
|
||||||
|
|
||||||
|
|
||||||
|
for service in api_client.list("services/regen/"):
|
||||||
|
if service['hostname'] == client_hostname and \
|
||||||
|
service['service_name'] == 'switchs' and \
|
||||||
|
service['need_regen']:
|
||||||
|
error = False
|
||||||
|
sw=Switch()
|
||||||
|
for switch in all_switchs:
|
||||||
|
sw.switch = switch
|
||||||
|
sw.gen_conf_and_write()
|
||||||
|
try:
|
||||||
|
sw.apply_conf()
|
||||||
|
except:
|
||||||
|
error = True
|
||||||
|
api_client.patch(service['api_url'], data={'need_regen': error})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue