Merge "Use yaml.SafeLoader instead of yaml.FullLoader"
This commit is contained in:
commit
bcb2105d9e
@ -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():
|
||||
|
@ -271,7 +271,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())
|
||||
@ -281,7 +281,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']
|
||||
@ -297,7 +297,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]:
|
||||
@ -313,7 +313,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':
|
||||
@ -329,7 +329,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:
|
||||
@ -347,7 +347,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:
|
||||
@ -366,7 +366,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:
|
||||
@ -405,7 +405,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:
|
||||
@ -436,7 +436,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:
|
||||
@ -460,7 +460,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)]
|
||||
@ -596,7 +596,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)
|
||||
@ -1051,7 +1051,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
|
||||
|
||||
@ -1235,11 +1235,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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user