From e167047f2352b274ad5a9aee716c9d9450f35d3e Mon Sep 17 00:00:00 2001 From: Charlie Jacomme Date: Wed, 27 Jun 2018 19:00:53 +0200 Subject: [PATCH] new api no endpoints --- main.py | 11 ++++++----- re2oapi | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) mode change 100644 => 100755 main.py diff --git a/main.py b/main.py old mode 100644 new mode 100755 index 46abdec..78e5f5c --- a/main.py +++ b/main.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 from configparser import ConfigParser import socket @@ -13,7 +14,7 @@ api_username = config.get('Re2o', 'username') def regen_dhcp(api_client): 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(): host_mac_ip[hmi['extension']] = [] 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] -for service in api_client.list_servicesregen(): - if service['hostname'] == client_hostname and \ - service['service_name'] == 'dhcp' and \ - service['need_regen']: +for service in api_client.view("services/regen")['results']: + #if service['hostname'] == client_hostname and \ + # service['service_name'] == 'dhcp' and \ + # service['need_regen']: regen_dhcp(api_client) api_client.patch(service['api_url'], data={'need_regen': False}) diff --git a/re2oapi b/re2oapi index 5b4523c..b0885f7 160000 --- a/re2oapi +++ b/re2oapi @@ -1 +1 @@ -Subproject commit 5b4523c797bffb90c998d5b424548756baa0c1d2 +Subproject commit b0885f7b84245fa22ccb1b91c00d03675c1cfafc