fix: fix API client creation loop

This commit is contained in:
Robert Kaussow 2021-06-09 23:18:14 +02:00
parent 1df0c9ed39
commit 831fad522f

View File

@ -28,13 +28,20 @@ class PrometheusSD:
signal.signal(signal.SIGINT, self._terminate) signal.signal(signal.SIGINT, self._terminate)
signal.signal(signal.SIGTERM, self._terminate) signal.signal(signal.SIGTERM, self._terminate)
while True: while True:
try: try:
self.discovery = Discovery() self.discovery = Discovery()
except APIError as e: except APIError as e:
if not self.config.config["service"]:
self.log.sysexit_with_message(
"Proxmoxer API error: {0}".format(str(e).strip())
)
self.logger.error("Proxmoxer API error: {0}".format(str(e).strip())) self.logger.error("Proxmoxer API error: {0}".format(str(e).strip()))
sleep(5) sleep(60)
continue continue
else:
break break
self._fetch() self._fetch()
@ -57,6 +64,7 @@ class PrometheusSD:
"--loop-delay", "--loop-delay",
dest="loop_delay", dest="loop_delay",
action="store", action="store",
type=int,
help="delay between discovery runs" help="delay between discovery runs"
) )
parser.add_argument( parser.add_argument(