reworking check of xml_class_list location

This commit is contained in:
Remi Hardy
2020-09-01 13:29:36 +02:00
parent c3e2df6639
commit d50e523d0e
+9 -6
View File
@@ -3321,17 +3321,20 @@ def receive_signal(signum, frame):
#loading xml action list from yaml #loading xml action list from yaml
import yaml import yaml
xml_class_list_file='ci-scripts/xml_class_list.yml' xml_class_list_file='xml_class_list.yml'
if (os.path.isfile(xml_class_list_file)): if (os.path.isfile(xml_class_list_file)):
#file will be opened only if it exists yaml_file=xml_class_list_file
with open(xml_class_list_file,'r') as file: elif (os.path.isfile('ci-scripts/'+xml_class_list_file)):
# The FullLoader parameter handles the conversion yaml_file='ci-scripts/'+xml_class_list_file
#from YAML scalar values to Python dictionary format
xml_class_list = yaml.load(file,Loader=yaml.FullLoader)
else: else:
logging.error("XML action list yaml file cannot be found") logging.error("XML action list yaml file cannot be found")
sys.exit("XML action list yaml file cannot be found") sys.exit("XML action list yaml file cannot be found")
with open(yaml_file,'r') as f:
# The FullLoader parameter handles the conversion-$
#from YAML scalar values to Python dictionary format$
xml_class_list = yaml.load(f,Loader=yaml.FullLoader)
mode = '' mode = ''