ajout du force et interface avec les regen services
This commit is contained in:
parent
2aa28c0b19
commit
3ecb33fda4
1 changed files with 13 additions and 2 deletions
15
main.py
15
main.py
|
@ -15,6 +15,8 @@ import argparse
|
||||||
|
|
||||||
import firewall_config
|
import firewall_config
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
config = ConfigParser()
|
config = ConfigParser()
|
||||||
config.read('config.ini')
|
config.read('config.ini')
|
||||||
|
|
||||||
|
@ -26,7 +28,11 @@ api_client = Re2oAPIClient(api_hostname, api_username, api_password)
|
||||||
|
|
||||||
client_hostname = socket.gethostname().split('.', 1)[0]
|
client_hostname = socket.gethostname().split('.', 1)[0]
|
||||||
|
|
||||||
|
for arg in sys.argv:
|
||||||
|
if arg=="--force":
|
||||||
|
table=iptables()
|
||||||
|
table.action="restart"
|
||||||
|
table.do_action()
|
||||||
|
|
||||||
class iptables:
|
class iptables:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -633,5 +639,10 @@ if __name__ == '__main__':
|
||||||
table.export = args.export
|
table.export = args.export
|
||||||
table.do_action()
|
table.do_action()
|
||||||
|
|
||||||
|
for service in api_client.list("services/regen/"):
|
||||||
|
if service['hostname'] == client_hostname and \
|
||||||
|
service['service_name'] == 'firewall' and \
|
||||||
|
service['need_regen']:
|
||||||
|
notif_end_adhesion(api_client)
|
||||||
|
api_client.patch(service['api_url'], data={'need_regen': False})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue