From 6b80c2047049b1495e9ab824ee4a9c9dc0cf8caf Mon Sep 17 00:00:00 2001 From: Joel Carpenter <66389984+AldosAC@users.noreply.github.com> Date: Thu, 27 Apr 2023 10:38:48 -0700 Subject: [PATCH] fix: Resolves setting save failure on empty secureli.yaml (#83) #77 Bugfix for failing to write ignore rule to .secureli.yml when it does not exist yet Note that this PR is for Github issue #77 and not Jira ticket STFT-077. Branch was named as such to pass branch validation until branch validation has been updated. Adds conditional logic so that saving the settings file does not attempt to modify the echo property if there is no echo property. --- secureli/repositories/settings.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/secureli/repositories/settings.py b/secureli/repositories/settings.py index 17b41870..e4dd7b20 100644 --- a/secureli/repositories/settings.py +++ b/secureli/repositories/settings.py @@ -152,7 +152,8 @@ def save(self, settings: SecureliFile): } # Converts EchoLevel to string - settings_dict["echo"]["level"] = "{}".format(settings_dict["echo"]["level"]) + if settings_dict.get("echo"): + settings_dict["echo"]["level"] = "{}".format(settings_dict["echo"]["level"]) with open(self.secureli_file_path, "w") as f: yaml.dump(settings_dict, f)