Skip to content

Commit

Permalink
Merge pull request #73 from tuurep/yaml-deprecation-fix
Browse files Browse the repository at this point in the history
Update deprecated ruamel yaml function
  • Loading branch information
JezerM authored Mar 14, 2024
2 parents f8ee847 + 209b8c3 commit 609c079
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@

PATH_TO_CONFIG = "/etc/lightdm/web-greeter.yml"

yaml_loader = yaml.YAML(typ='safe', pure=True)

web_greeter_config = {
"config": {
"branding": {
Expand Down Expand Up @@ -173,7 +175,7 @@ def load_theme_config():
if not os.path.exists(path_to_theme_config):
raise Exception("index.yml file not found")
with open(path_to_theme_config, "r", encoding="utf-8") as file:
theme_config = yaml.safe_load(file)
theme_config = yaml_loader.load(file)
web_greeter_config["theme"] = theme_config

except Exception as err:
Expand Down Expand Up @@ -204,7 +206,7 @@ def load_config():
if not os.path.exists(PATH_TO_CONFIG):
raise Exception("Config file not found")
with open(PATH_TO_CONFIG, "r", encoding="utf-8") as file:
web_greeter_config["config"] = yaml.safe_load(file)
web_greeter_config["config"] = yaml_loader.load(file)
except Exception as err:
logger.error("Config was not loaded:\n\t%s", err)

Expand Down

0 comments on commit 609c079

Please sign in to comment.