From 3ceb41f242bee3874217d36c2e4fb5c9fd36e1a0 Mon Sep 17 00:00:00 2001 From: Alexandr Bogomyakov Date: Sun, 26 Nov 2023 03:55:24 +0200 Subject: [PATCH] Fix config path --- lib.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib.py b/lib.py index 3099f2c..9b2f45e 100644 --- a/lib.py +++ b/lib.py @@ -8,6 +8,7 @@ logging.basicConfig( format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', datefmt='%d-%m-%Y %H:%M:%S') +CFG_PATH = '/usr/local/etc/outfleet/config.yaml' class ServerDict(TypedDict): @@ -63,10 +64,10 @@ class Server: self.client.set_hostname(config.get("hostname_for_access_keys")) self.log.info("Changed %s hostname_for_access_keys to '%s'", self.data["server_id"], config.get("hostname_for_access_keys")) if config.get("comment"): - with open("config.yaml", "r") as file: + with open(CFG_PATH, "r") as file: config_file = yaml.safe_load(file) or {} config_file["servers"][self.data['server_id']]['comment'] = config.get("comment") - with open("config.yaml", "w") as file: + with open(CFG_PATH, "w") as file: yaml.safe_dump(config_file, file) self.log.info("Changed %s comment to '%s'", self.data["server_id"], config.get("comment"))