Skip to content

Commit

Permalink
Fix issues with namemapping and active authentication
Browse files Browse the repository at this point in the history
  • Loading branch information
sfudeus committed Jan 9, 2022
1 parent d4d04ab commit 8c4e5f7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,14 @@ def run(self):

if len(self.mapped_names) == 0:
# if no custom mapped names are given we use them from the ccu.
reload_names_active = True
self.reload_names_active = True

with read_names_summary.labels(self.ccu_host).time():
self.mapped_names = self.read_mapped_names()
logging.info("Read {} device names from CCU".format(len(self.mapped_names)))

while True:
if reload_names_active:
if self.reload_names_active:
if gathering_loop_counter % self.reload_names_interval == 0:
try:
with read_names_summary.labels(self.ccu_host).time():
Expand Down Expand Up @@ -333,8 +333,11 @@ def read_mapped_names(self):
}
"""

response = requests.post(url, auth=auth, data=script_get_names)
response = requests.post(url, auth=self.auth, data=script_get_names)
logging.debug(response.text)
if response.status_code != 200:
logging.warning("Failed to read name mappings, status code was %d", response.status_code)
return {}

ccu_mapped_names = {}

Expand Down

0 comments on commit 8c4e5f7

Please sign in to comment.