From e167047f2352b274ad5a9aee716c9d9450f35d3e Mon Sep 17 00:00:00 2001 From: Charlie Jacomme Date: Wed, 27 Jun 2018 19:00:53 +0200 Subject: [PATCH 1/6] 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 From 979accb43f09534e36516b4951f1935917a271ec Mon Sep 17 00:00:00 2001 From: Charlie Jacomme Date: Wed, 27 Jun 2018 19:11:05 +0200 Subject: [PATCH 2/6] stupid charlie, stupid --- main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 78e5f5c..1b71287 100755 --- a/main.py +++ b/main.py @@ -14,7 +14,7 @@ api_username = config.get('Re2o', 'username') def regen_dhcp(api_client): host_mac_ip = {} - for hmi in api_client.view("dhcp/hostmacip/")['results']: + for hmi in api_client.list("dhcp/hostmacip/"): if hmi['extension'] not in host_mac_ip.keys(): host_mac_ip[hmi['extension']] = [] host_mac_ip[hmi['extension']].append((hmi['hostname'], @@ -42,7 +42,7 @@ api_client = Re2oAPIClient(api_hostname, api_username, api_password) client_hostname = socket.gethostname().split('.', 1)[0] -for service in api_client.view("services/regen")['results']: +for service in api_client.list("services/regen"): #if service['hostname'] == client_hostname and \ # service['service_name'] == 'dhcp' and \ # service['need_regen']: From 962332a6ff4740c1a97e1014ef2e3d722317a5f7 Mon Sep 17 00:00:00 2001 From: Charlie Jacomme Date: Mon, 6 Aug 2018 20:32:56 +0200 Subject: [PATCH 3/6] on submodule on git crans --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 .gitmodules diff --git a/.gitmodules b/.gitmodules old mode 100644 new mode 100755 index 361b0a1..94389b4 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "re2oapi"] path = re2oapi - url = https://gitlab.federez.net/re2o/re2oapi.git + url = https://gitlab.crans.org/nounous/re2o-re2oapi.git From 2e7cac5001d5be4c54ae3906c45b4597d7b42bbc Mon Sep 17 00:00:00 2001 From: Charlie Jacomme Date: Tue, 7 Aug 2018 14:49:13 +0200 Subject: [PATCH 4/6] files in subfolder --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index 1b71287..432c48b 100755 --- a/main.py +++ b/main.py @@ -34,7 +34,7 @@ def regen_dhcp(api_client): ipv4=ipv4 ) for hostname, mac_address, ipv4 in hmi_list) - filename = 'dhcp{extension}.list'.format(extension=extension) + filename = 'generated/dhcp{extension}.list'.format(extension=extension) with open(filename, 'w+') as f: f.write(dhcp_leases_content) From f44fae7c5524239976ea7d59ea8d879848175346 Mon Sep 17 00:00:00 2001 From: Charlie Jacomme Date: Wed, 8 Aug 2018 19:16:03 +0200 Subject: [PATCH 5/6] enable regen --- .gitignore | 0 README.md | 0 config.ini.example | 0 main.py | 10 +++++----- 4 files changed, 5 insertions(+), 5 deletions(-) mode change 100644 => 100755 .gitignore mode change 100644 => 100755 README.md mode change 100644 => 100755 config.ini.example diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/config.ini.example b/config.ini.example old mode 100644 new mode 100755 diff --git a/main.py b/main.py index 432c48b..985967a 100755 --- a/main.py +++ b/main.py @@ -43,8 +43,8 @@ api_client = Re2oAPIClient(api_hostname, api_username, api_password) client_hostname = socket.gethostname().split('.', 1)[0] for service in api_client.list("services/regen"): - #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}) + 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}) From 8ad669a54250276c54d045cc25e1366bd208bede Mon Sep 17 00:00:00 2001 From: Hugo Levy-Falk Date: Mon, 29 Apr 2019 22:52:03 +0200 Subject: [PATCH 6/6] Utilisation du repo federez --- .gitmodules | 3 ++- re2oapi | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 94389b4..b75ea02 100755 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,4 @@ [submodule "re2oapi"] path = re2oapi - url = https://gitlab.crans.org/nounous/re2o-re2oapi.git + url = https://gitlab.federez.net/re2o/re2oapi.git + branch = master diff --git a/re2oapi b/re2oapi index b0885f7..b12df74 160000 --- a/re2oapi +++ b/re2oapi @@ -1 +1 @@ -Subproject commit b0885f7b84245fa22ccb1b91c00d03675c1cfafc +Subproject commit b12df74fe73f351986ff51c8122089644218f8fe