This commit is contained in:
gwen 2024-09-10 09:57:53 +02:00
parent fe86a214de
commit 17b17d3e23

View file

@ -49,33 +49,13 @@ class RougailUserDataEnvironment:
else:
self.errors = []
self.warnings = []
# this variable will be used for generating warnings
# this variable will be used for generating warnings
# about unused ROUGAIL_ environment variables
self.unused_environment_var = get_rougail_environment_var()
self.unused_environment_var = get_rougail_environment_var()
def run(self):
self.config.property.read_write()
if self.rougailconfig['environment.mandatory']:
current_titles = []
while True:
mandatories = self.config.value.mandatory()
if not mandatories:
break
mandatory = mandatories[0]
path = mandatory.path()
if '.' in path:
current_config = self.config
for idx, p in enumerate(path.split('.')[0:-1]):
current_config = current_config.option(p)
if idx < len(current_titles):
if current_titles[idx] == p:
continue
current_titles = current_titles[0:idx]
current_titles.append(p)
self.print(current_config.description(), idx)
self.display_environment(mandatory)
else:
self.parse(self.config)
self.parse(self.config)
self.config.property.read_only()
# if there are unused environment variables
if len(self.unused_environment_var):
@ -96,14 +76,14 @@ class RougailUserDataEnvironment:
# here we retrieve the conversion func of the considered type
# 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
# this is used only for warning purposes
self.unused_environment_var.remove(option_name)
# let's parse the environment variables values
if option_name in rougail_environment_var:
if ismulti:
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(",")