From 062bdee72bd6f526653cd53d0ca85bbbb44d4e08 Mon Sep 17 00:00:00 2001
From: Erik Reid <erik.reid@geant.org>
Date: Thu, 19 Aug 2021 10:13:05 +0200
Subject: [PATCH] use tag instead of hash in check name
---
brian_polling_manager/gws_direct.py | 8 +++-----
brian_polling_manager/sensu.py | 3 ++-
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/brian_polling_manager/gws_direct.py b/brian_polling_manager/gws_direct.py
index 259d792..dcc6a36 100644
--- a/brian_polling_manager/gws_direct.py
+++ b/brian_polling_manager/gws_direct.py
@@ -23,13 +23,11 @@ class GwSDirectInterfaceCheck(sensu.AbstractCheck):
@sensu.AbstractCheck.name.getter
def name(self):
- ifc_str = json.dumps(self.interface, indent=2, sort_keys=True)
- m = hashlib.sha256()
- m.update(ifc_str.encode('utf-8'))
- check_id = binascii.b2a_hex(m.digest()).decode('utf-8')
isp = self.interface['isp']
isp = isp.replace(' ', '_')
- return f'gwsd-{self.interface["nren"]}-{isp}-{check_id.upper()[-8:]}'
+ tag = self.interface['tag']
+ tag = tag.replace(' ', '_')
+ return f'gwsd-{self.interface["nren"]}-{isp}-{tag}'
@sensu.AbstractCheck.command.getter
def command(self):
diff --git a/brian_polling_manager/sensu.py b/brian_polling_manager/sensu.py
index 63be687..ff307b3 100644
--- a/brian_polling_manager/sensu.py
+++ b/brian_polling_manager/sensu.py
@@ -232,9 +232,10 @@ def refresh(sensu_params, required_checks, current_checks):
'input': len(required_checks),
'created': 0,
'updated': 0,
- 'deleted': None
+ 'deleted': 0
}
+
for expected_check in required_checks:
if expected_check.name not in current_checks:
--
GitLab