Skip to content

Commit

Permalink
Update deprecated ruamel yaml function
Browse files Browse the repository at this point in the history
safe_load() has been removed, which causes web-greeter to revert to a default
theme on Arch Linux
  • Loading branch information
tuurep committed Mar 14, 2024
1 parent f8ee847 commit 209b8c3
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 209b8c3

Please sign in to comment.