From cfd32c222d38c38e56c0d432394408c119203f83 Mon Sep 17 00:00:00 2001 From: gwen Date: Tue, 10 Sep 2024 10:07:00 +0200 Subject: [PATCH] cleaning --- src/rougail/user-data-environment/data.py | 33 +++++++++++------------ 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/src/rougail/user-data-environment/data.py b/src/rougail/user-data-environment/data.py index c969911..5d2f17c 100644 --- a/src/rougail/user-data-environment/data.py +++ b/src/rougail/user-data-environment/data.py @@ -78,24 +78,23 @@ class RougailUserDataEnvironment: # carefull, it could be None -> in this case, do nothing type_obj = CONVERT_OPTION.get(option_type, {}).get("func") # - rougail_environment_var = get_rougail_environment_var() option_name = option.path() # this is used only for warning purposes - self.unused_environment_var.remove(option_name) + if option_name in unused_environment_var: + self.unused_environment_var.remove(option_name) # let's parse the environment variables values - if option_name in rougail_environment_var: - if ismulti: - option_bash_value = get_rougail_environment_dict()[option_name] - # here we expect the bash option value of a multi to be coma separated: - option_value = option_bash_value.split(",") - if type_obj is not None: - option_value_typed = [type_obj(opt) for opt in option_value] - option.value.set(option_value_typed) - else: - option.value.set(option_value) + if ismulti: + option_bash_value = get_rougail_environment_dict()[option_name] + # here we expect the bash option value of a multi to be coma separated: + option_value = option_bash_value.split(",") + if type_obj is not None: + option_value_typed = [type_obj(opt) for opt in option_value] + option.value.set(option_value_typed) else: - option_bash_value = get_rougail_environment_dict()[option_name] - if type_obj is not None: - option.value.set(type_obj(option_bash_value)) - else: - option.value.set(option_bash_value) + option.value.set(option_value) + else: + option_bash_value = get_rougail_environment_dict()[option_name] + if type_obj is not None: + option.value.set(type_obj(option_bash_value)) + else: + option.value.set(option_bash_value)