mirror of
https://github.com/thegeeklab/prometheus-pve-sd.git
synced 2024-06-01 15:39:39 +02:00
fix validation rules issues
This commit is contained in:
parent
f0345cf7a6
commit
39cece7678
|
@ -114,8 +114,7 @@ class PrometheusSD:
|
||||||
self.log.sysexit_with_message(f"Can not set log level.\n{e!s}")
|
self.log.sysexit_with_message(f"Can not set log level.\n{e!s}")
|
||||||
|
|
||||||
required = [("pve.server", config.config["pve"]["server"]),
|
required = [("pve.server", config.config["pve"]["server"]),
|
||||||
("pve.user", config.config["pve"]["user"]),
|
("pve.user", config.config["pve"]["user"])]
|
||||||
("pve.password", config.config["pve"]["password"])]
|
|
||||||
for name, value in required:
|
for name, value in required:
|
||||||
if not value:
|
if not value:
|
||||||
self.log.sysexit_with_message(f"Option '{name}' is required but not set")
|
self.log.sysexit_with_message(f"Option '{name}' is required but not set")
|
||||||
|
@ -123,7 +122,7 @@ class PrometheusSD:
|
||||||
if config.config["pve"]["token_name"] and not config.config["pve"]["token_value"]:
|
if config.config["pve"]["token_name"] and not config.config["pve"]["token_value"]:
|
||||||
self.log.sysexit_with_message(f"Option 'pve.token_name' require 'pve.token_value' to be set")
|
self.log.sysexit_with_message(f"Option 'pve.token_name' require 'pve.token_value' to be set")
|
||||||
|
|
||||||
if not config.config["pve"]["token_name"] and not config.config["pve"]["token_value"] and not config.config["pve"]["password"]:
|
if not config.config["pve"]["token_name"] and not config.config["pve"]["password"]:
|
||||||
self.log.sysexit_with_message(f"Neither password nor API token have been set for pve authentication")
|
self.log.sysexit_with_message(f"Neither password nor API token have been set for pve authentication")
|
||||||
|
|
||||||
self.logger.info(f"Using config file {config.config_file}")
|
self.logger.info(f"Using config file {config.config_file}")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user