diff --git a/tools/yaml-nic-config-2-script.py b/tools/yaml-nic-config-2-script.py index 51175ecd2c..f70bdaa5cd 100755 --- a/tools/yaml-nic-config-2-script.py +++ b/tools/yaml-nic-config-2-script.py @@ -220,7 +220,7 @@ def convert(filename, script_path): def check_old_style(filename): with open(filename, 'r') as f: - tpl = yaml.load(f.read(), Loader=yaml.FullLoader) + tpl = yaml.load(f.read(), Loader=yaml.SafeLoader) if isinstance(tpl.get('resources', {}), dict): for r in (tpl.get('resources', {})).items(): diff --git a/tools/yaml-validate.py b/tools/yaml-validate.py index ac93c4ed25..c2ff401d01 100755 --- a/tools/yaml-validate.py +++ b/tools/yaml-validate.py @@ -276,7 +276,7 @@ def to_camel_case(string): def get_base_endpoint_map(filename): try: with open(filename, 'r') as f: - tpl = yaml.load(f.read(), Loader=yaml.FullLoader) + tpl = yaml.load(f.read(), Loader=yaml.SafeLoader) return tpl['parameters']['EndpointMap']['default'] except Exception: print(traceback.format_exc()) @@ -286,7 +286,7 @@ def get_base_endpoint_map(filename): def get_endpoint_map_from_env(filename): try: with open(filename, 'r') as f: - tpl = yaml.load(f.read(), Loader=yaml.FullLoader) + tpl = yaml.load(f.read(), Loader=yaml.SafeLoader) return { 'file': filename, 'map': tpl['parameter_defaults']['EndpointMap'] @@ -302,7 +302,7 @@ def validate_endpoint_map(base_map, env_map): def validate_role_name(filename): with open(filename, 'r') as f: - tpl = yaml.load(f.read(), Loader=yaml.FullLoader) + tpl = yaml.load(f.read(), Loader=yaml.SafeLoader) role_data = tpl[0] if role_data['name'] != os.path.basename(filename).split('.')[0]: @@ -318,7 +318,7 @@ def validate_hci_compute_services_default(env_filename, env_tpl): roles_filename = os.path.join(os.path.dirname(env_filename), '../roles/Compute.yaml') with open(roles_filename, 'r') as f: - roles_tpl = yaml.load(f.read(), Loader=yaml.FullLoader) + roles_tpl = yaml.load(f.read(), Loader=yaml.SafeLoader) for role in roles_tpl: if role['name'] == 'Compute': @@ -334,7 +334,7 @@ def validate_hci_computehci_role(hci_role_filename, hci_role_tpl): compute_role_filename = os.path.join(os.path.dirname(hci_role_filename), './Compute.yaml') with open(compute_role_filename, 'r') as f: - compute_role_tpl = yaml.load(f.read(), Loader=yaml.FullLoader) + compute_role_tpl = yaml.load(f.read(), Loader=yaml.SafeLoader) compute_role_services = compute_role_tpl[0]['ServicesDefault'] for role in hci_role_tpl: @@ -352,7 +352,7 @@ def validate_controller_dashboard(filename, tpl): control_role_filename = os.path.join(os.path.dirname(filename), './Controller.yaml') with open(control_role_filename, 'r') as f: - control_role_tpl = yaml.load(f.read(), Loader=yaml.FullLoader) + control_role_tpl = yaml.load(f.read(), Loader=yaml.SafeLoader) control_role_services = control_role_tpl[0]['ServicesDefault'] for role in tpl: @@ -371,7 +371,7 @@ def validate_hci_role(hci_role_filename, hci_role_tpl): compute_role_filename = \ os.path.join(os.path.dirname(hci_role_filename), './Compute.yaml') with open(compute_role_filename, 'r') as f: - compute_role_tpl = yaml.load(f.read(), Loader=yaml.FullLoader) + compute_role_tpl = yaml.load(f.read(), Loader=yaml.SafeLoader) compute_role_services = compute_role_tpl[0]['ServicesDefault'] for role in hci_role_tpl: @@ -410,7 +410,7 @@ def validate_ceph_role(ceph_role_filename, ceph_role_tpl): ceph_storage_role_filename = \ os.path.join(os.path.dirname(ceph_role_filename), './CephStorage.yaml') with open(ceph_storage_role_filename, 'r') as f: - ceph_storage_role_tpl = yaml.load(f.read(), Loader=yaml.FullLoader) + ceph_storage_role_tpl = yaml.load(f.read(), Loader=yaml.SafeLoader) ceph_storage_role_services = ceph_storage_role_tpl[0]['ServicesDefault'] for role in ceph_role_tpl: @@ -441,7 +441,7 @@ def validate_controller_no_ceph_role(filename, tpl): control_role_filename = os.path.join(os.path.dirname(filename), './Controller.yaml') with open(control_role_filename, 'r') as f: - control_role_tpl = yaml.load(f.read(), Loader=yaml.FullLoader) + control_role_tpl = yaml.load(f.read(), Loader=yaml.SafeLoader) control_role_services = control_role_tpl[0]['ServicesDefault'] for role in tpl: @@ -465,7 +465,7 @@ def validate_with_compute_role_services(role_filename, role_tpl, exclude_service cmpt_filename = os.path.join(os.path.dirname(role_filename), './Compute.yaml') with open(cmpt_filename, 'r') as f: - cmpt_tpl = yaml.load(f.read(), Loader=yaml.FullLoader) + cmpt_tpl = yaml.load(f.read(), Loader=yaml.SafeLoader) cmpt_services = cmpt_tpl[0]['ServicesDefault'] cmpt_services = [x for x in cmpt_services if (x not in exclude_service)] @@ -601,7 +601,7 @@ def validate_docker_service_mysql_usage(filename, tpl): newfilename = \ os.path.normpath(os.path.join(os.path.dirname(incfile), f)) with open(newfilename, 'r') as newfile: - newtmp = yaml.load(newfile.read(), Loader=yaml.FullLoader) + newtmp = yaml.load(newfile.read(), Loader=yaml.SafeLoader) read_all(newfile, newtmp) read_all(filename, tpl) @@ -1056,7 +1056,7 @@ def validate(filename, param_map): retval = 0 try: with open(filename, 'r') as f: - tpl = yaml.load(f.read(), Loader=yaml.FullLoader) + tpl = yaml.load(f.read(), Loader=yaml.SafeLoader) is_heat_template = 'heat_template_version' in tpl @@ -1242,11 +1242,11 @@ def validate_upgrade_tasks(upgrade_tasks): def validate_network_data_file(data_file_path): try: with open(data_file_path, 'r') as data_file: - data_file = yaml.load(data_file.read(), Loader=yaml.FullLoader) + data_file = yaml.load(data_file.read(), Loader=yaml.SafeLoader) base_file_path = os.path.dirname(data_file_path) + "/network_data.yaml" with open(base_file_path, 'r') as base_file: - base_file = yaml.load(base_file.read(), Loader=yaml.FullLoader) + base_file = yaml.load(base_file.read(), Loader=yaml.SafeLoader) retval = 0 for n in base_file: