From faff9f9f1be65c7c5fb21356a2cf49249a538c40 Mon Sep 17 00:00:00 2001 From: idziubenko Date: Fri, 22 Oct 2021 16:58:57 +0300 Subject: [PATCH] added level update val to binhost --- pym/calculate/lib/utils/binhosts.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pym/calculate/lib/utils/binhosts.py b/pym/calculate/lib/utils/binhosts.py index 0ede1d3..a8d46b9 100644 --- a/pym/calculate/lib/utils/binhosts.py +++ b/pym/calculate/lib/utils/binhosts.py @@ -172,6 +172,20 @@ class BinhostsBase(Cachable): self.duration = int((time.time() - start_ts) * 1000) self.outdated = int(start_ts) - self.timestamp > parent.actual_period self.downgraded = self.timestamp < parent.last_ts + + fn, data = self.parent.fetch_envdata(self.host) + if fn: + cp = ConfigParserCaseSens() + try: + cp.read_string(data) + if "update" in cp.sections(): + self.level = cp["update"]["level"] + else: + self.level = 99999 + except (CPError, KeyError) as e: + self.level = 99999 + else: + self.level = 99999 except BaseException as e: if isinstance(e, KeyboardInterrupt): raise