refactoring

This commit is contained in:
gwen 2024-09-10 10:25:15 +02:00
parent 1f287c3b51
commit ed2e66320e

View file

@ -67,23 +67,31 @@ class RougailUserDataEnvironment:
if option.isoptiondescription(): if option.isoptiondescription():
self.parse(option) self.parse(option)
else: else:
# try except
# ValueError suivant le type
# PropertyError -> hidden ou frozen...
# test: mettre hidden à true dans le yaml
self.load_environment(option) self.load_environment(option)
def load_environment(self, option): def load_environment(self, option):
# FIXME : mettre un .upper()
# pour que les var de env soient en maj
option_name = option.path()
# this is used only for warning purposes
if option_name not in unused_environment_var:
return
# the rougail type is not the tiramisu type # the rougail type is not the tiramisu type
# tiramisu type is option.type # tiramisu type is option.type
option_type = option.information.get('type') option_type = option.information.get('type')
ismulti = option.ismulti() ismulti = option.ismulti()
# here we retrieve the conversion func of the considered type # here we retrieve the conversion func of the considered type
# carefull, it could be None -> in this case, do nothing # carefull, it could be None -> in this case, do nothing
type_obj = CONVERT_OPTION.get(option_type, {}).get("func") type_obj = CONVERT_OPTION.get(option_type, {}).get("func")
#
option_name = option.path()
# this is used only for warning purposes
if option_name not in unused_environment_var:
return
self.unused_environment_var.remove(option_name) self.unused_environment_var.remove(option_name)
# let's parse the environment variables values # let's parse the environment variables values
# FIXME enlever les deux fonction de helper
# FIXME option_bash_value = self.unused_environment_var.pop(option_name
option_bash_value = get_rougail_environment_dict()[option_name] option_bash_value = get_rougail_environment_dict()[option_name]
if ismulti: if ismulti:
# here we expect the bash option value of a multi to be coma separated: # here we expect the bash option value of a multi to be coma separated: