new api no endpoints
This commit is contained in:
parent
072eb642f0
commit
e167047f23
2 changed files with 7 additions and 6 deletions
11
main.py
Normal file → Executable file
11
main.py
Normal file → Executable file
|
@ -1,3 +1,4 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
import socket
|
import socket
|
||||||
|
|
||||||
|
@ -13,7 +14,7 @@ api_username = config.get('Re2o', 'username')
|
||||||
def regen_dhcp(api_client):
|
def regen_dhcp(api_client):
|
||||||
host_mac_ip = {}
|
host_mac_ip = {}
|
||||||
|
|
||||||
for hmi in api_client.list_hostmacip():
|
for hmi in api_client.view("dhcp/hostmacip/")['results']:
|
||||||
if hmi['extension'] not in host_mac_ip.keys():
|
if hmi['extension'] not in host_mac_ip.keys():
|
||||||
host_mac_ip[hmi['extension']] = []
|
host_mac_ip[hmi['extension']] = []
|
||||||
host_mac_ip[hmi['extension']].append((hmi['hostname'],
|
host_mac_ip[hmi['extension']].append((hmi['hostname'],
|
||||||
|
@ -41,9 +42,9 @@ api_client = Re2oAPIClient(api_hostname, api_username, api_password)
|
||||||
|
|
||||||
client_hostname = socket.gethostname().split('.', 1)[0]
|
client_hostname = socket.gethostname().split('.', 1)[0]
|
||||||
|
|
||||||
for service in api_client.list_servicesregen():
|
for service in api_client.view("services/regen")['results']:
|
||||||
if service['hostname'] == client_hostname and \
|
#if service['hostname'] == client_hostname and \
|
||||||
service['service_name'] == 'dhcp' and \
|
# service['service_name'] == 'dhcp' and \
|
||||||
service['need_regen']:
|
# service['need_regen']:
|
||||||
regen_dhcp(api_client)
|
regen_dhcp(api_client)
|
||||||
api_client.patch(service['api_url'], data={'need_regen': False})
|
api_client.patch(service['api_url'], data={'need_regen': False})
|
||||||
|
|
2
re2oapi
2
re2oapi
|
@ -1 +1 @@
|
||||||
Subproject commit 5b4523c797bffb90c998d5b424548756baa0c1d2
|
Subproject commit b0885f7b84245fa22ccb1b91c00d03675c1cfafc
|
Loading…
Reference in a new issue