warnings ok
This commit is contained in:
parent
fd9edbf63c
commit
d34f4a16fe
1 changed files with 9 additions and 13 deletions
|
@ -50,17 +50,18 @@ class RougailUserDataEnvironment:
|
||||||
else:
|
else:
|
||||||
self.errors = []
|
self.errors = []
|
||||||
self.warnings = []
|
self.warnings = []
|
||||||
|
# bash environment variables (key/value pairs)
|
||||||
|
self.rougail_environment_vars = get_rougail_environment()
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.config.property.read_write()
|
self.config.property.read_write()
|
||||||
self.parse(self.config)
|
self.parse(self.config)
|
||||||
self.config.property.read_only()
|
self.config.property.read_only()
|
||||||
# about unused ROUGAIL_ environment variables
|
# about unused bash environment variables
|
||||||
# FIXME
|
if len(self.rougail_environment_vars):
|
||||||
# if len(self.rougail_environment_vars):
|
unused_env_var_str = ", ".join(self.rougail_environment_vars.keys())
|
||||||
# unused_env_var_str = " ".join(self.rougail_environment_vars.keys())
|
self.warnings.append("the following rougail bash environment "
|
||||||
# self.warnings.append("the following rougail environment variables "
|
"variable(s) are not used : " + unused_env_var_str)
|
||||||
# "are not used : " + unused_env_var_str)
|
|
||||||
|
|
||||||
def parse(self, config):
|
def parse(self, config):
|
||||||
for option in config:
|
for option in config:
|
||||||
|
@ -78,9 +79,8 @@ class RougailUserDataEnvironment:
|
||||||
option_name = option.path()
|
option_name = option.path()
|
||||||
# the bash variable are in upper case
|
# the bash variable are in upper case
|
||||||
option_name = option_name.upper()
|
option_name = option_name.upper()
|
||||||
rougail_environment_vars = get_rougail_environment()
|
|
||||||
# if the option is not in the bash environment, do nothing
|
# if the option is not in the bash environment, do nothing
|
||||||
if option_name not in rougail_environment_vars.keys():
|
if option_name not in self.rougail_environment_vars.keys():
|
||||||
return
|
return
|
||||||
# actually the rougail type **is not** the same thing as
|
# actually the rougail type **is not** the same thing as
|
||||||
# the tiramisu type, which is in `option.type`
|
# the tiramisu type, which is in `option.type`
|
||||||
|
@ -90,11 +90,7 @@ class RougailUserDataEnvironment:
|
||||||
# carefull, the coercion function 'func' could be None
|
# carefull, the coercion function 'func' could be None
|
||||||
# -> in this case, do nothing
|
# -> in this case, do nothing
|
||||||
type_obj = CONVERT_OPTION.get(option_type, {}).get("func")
|
type_obj = CONVERT_OPTION.get(option_type, {}).get("func")
|
||||||
option_bash_value = rougail_environment_vars.pop(option_name)
|
option_bash_value = self.rougail_environment_vars.pop(option_name)
|
||||||
print("--------------")
|
|
||||||
print(option_name)
|
|
||||||
print(option_bash_value)
|
|
||||||
print(rougail_environment_vars)
|
|
||||||
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:
|
||||||
option_bash_value = [opt.strip() for opt in option_bash_value.split(",")]
|
option_bash_value = [opt.strip() for opt in option_bash_value.split(",")]
|
||||||
|
|
Loading…
Reference in a new issue