From ae7d28b81ddc5285a210e927bec563065fda7f16 Mon Sep 17 00:00:00 2001 From: Daniel Cordero Date: Thu, 21 Apr 2022 07:08:23 +0000 Subject: catalyst/stage4: fix handling of groups, users and keys Previously, the set_*() functions would always set the result of the toml parsing as the setting. Instead, only override it if it is a string. Fixes: 5be6069b ("catalyst: support 3 new options") Signed-off-by: Daniel Cordero Signed-off-by: Matt Turner --- catalyst/base/stagebase.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'catalyst') diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py index 5c7e9adb..1d71c59d 100644 --- a/catalyst/base/stagebase.py +++ b/catalyst/base/stagebase.py @@ -589,9 +589,9 @@ class StageBase(TargetBase, ClearBase, GenBase): def set_groups(self): groups = self.settings["spec_prefix"] + "/groups" if groups in self.settings: + self.settings["groups"] = self.settings[groups] if isinstance(self.settings[groups], str): self.settings["groups"] = self.settings[groups].split(",") - self.settings["groups"] = self.settings[groups] del self.settings[groups] else: self.settings["groups"] = [] @@ -600,9 +600,9 @@ class StageBase(TargetBase, ClearBase, GenBase): def set_users(self): users = self.settings["spec_prefix"] + "/users" if users in self.settings: + self.settings["users"] = self.settings[users] if isinstance(self.settings[users], str): self.settings["users"] = self.settings[users].split(",") - self.settings["users"] = self.settings[users] del self.settings[users] else: self.settings["users"] = [] @@ -611,9 +611,9 @@ class StageBase(TargetBase, ClearBase, GenBase): def set_ssh_public_keys(self): ssh_public_keys = self.settings["spec_prefix"] + "/ssh_public_keys" if ssh_public_keys in self.settings: + self.settings["ssh_public_keys"] = self.settings[ssh_public_keys] if isinstance(self.settings[ssh_public_keys], str): self.settings["ssh_public_keys"] = self.settings[ssh_public_keys].split(",") - self.settings["ssh_public_keys"] = self.settings[ssh_public_keys] del self.settings[ssh_public_keys] else: self.settings["ssh_public_keys"] = [] -- cgit v1.2.3-65-gdbad