Change-Id: Ia768b60b0304d99a24bbfab2795922d54ca9ca0c
Signed-off-by: delacruzramo <pedro.delacruzramos@altran.com>
# Loading permissions to MongoDB if there is not any permission.
if not records or (len(records) == 1 and records[0]["name"] == "admin"):
with open(self.roles_to_operations_file, "r") as stream:
# Loading permissions to MongoDB if there is not any permission.
if not records or (len(records) == 1 and records[0]["name"] == "admin"):
with open(self.roles_to_operations_file, "r") as stream:
- roles_to_operations_yaml = yaml.load(stream)
+ roles_to_operations_yaml = yaml.load(stream, Loader=yaml.Loader)
role_names = []
for role_with_operations in roles_to_operations_yaml["roles"]:
role_names = []
for role_with_operations in roles_to_operations_yaml["roles"]:
indata = json.load(content)
else:
error_text = "Invalid yaml format "
indata = json.load(content)
else:
error_text = "Invalid yaml format "
- indata = yaml.load(content)
+ indata = yaml.load(content, Loader=yaml.SafeLoader)
current_desc["_admin"]["storage"] = storage
current_desc["_admin"]["onboardingState"] = "ONBOARDED"
current_desc["_admin"]["storage"] = storage
current_desc["_admin"]["onboardingState"] = "ONBOARDED"
raise EngineException("Invalid permission configuration: resources_to_operations file missing")
with open(resources_to_operations_file, 'r') as f:
raise EngineException("Invalid permission configuration: resources_to_operations file missing")
with open(resources_to_operations_file, 'r') as f:
- resources_to_operations = yaml.load(f)
+ resources_to_operations = yaml.load(f, Loader=yaml.Loader)
cherrypy.request.headers.pop("Content-File-MD5", None)
elif "application/yaml" in cherrypy.request.headers["Content-Type"]:
error_text = "Invalid yaml format "
cherrypy.request.headers.pop("Content-File-MD5", None)
elif "application/yaml" in cherrypy.request.headers["Content-Type"]:
error_text = "Invalid yaml format "
- indata = yaml.load(cherrypy.request.body)
+ indata = yaml.load(cherrypy.request.body, Loader=yaml.SafeLoader)
cherrypy.request.headers.pop("Content-File-MD5", None)
elif "application/binary" in cherrypy.request.headers["Content-Type"] or \
"application/gzip" in cherrypy.request.headers["Content-Type"] or \
cherrypy.request.headers.pop("Content-File-MD5", None)
elif "application/binary" in cherrypy.request.headers["Content-Type"] or \
"application/gzip" in cherrypy.request.headers["Content-Type"] or \
# "Only 'Content-Type' of type 'application/json' or
# 'application/yaml' for input format are available")
error_text = "Invalid yaml format "
# "Only 'Content-Type' of type 'application/json' or
# 'application/yaml' for input format are available")
error_text = "Invalid yaml format "
- indata = yaml.load(cherrypy.request.body)
+ indata = yaml.load(cherrypy.request.body, Loader=yaml.SafeLoader)
cherrypy.request.headers.pop("Content-File-MD5", None)
else:
error_text = "Invalid yaml format "
cherrypy.request.headers.pop("Content-File-MD5", None)
else:
error_text = "Invalid yaml format "
- indata = yaml.load(cherrypy.request.body)
+ indata = yaml.load(cherrypy.request.body, Loader=yaml.SafeLoader)
cherrypy.request.headers.pop("Content-File-MD5", None)
if not indata:
indata = {}
cherrypy.request.headers.pop("Content-File-MD5", None)
if not indata:
indata = {}
kwargs[k] = None
elif format_yaml:
try:
kwargs[k] = None
elif format_yaml:
try:
- kwargs[k] = yaml.load(v)
+ kwargs[k] = yaml.load(v, Loader=yaml.SafeLoader)
except Exception:
pass
elif k.endswith(".gt") or k.endswith(".lt") or k.endswith(".gte") or k.endswith(".lte"):
except Exception:
pass
elif k.endswith(".gt") or k.endswith(".lt") or k.endswith(".gte") or k.endswith(".lte"):
v[index] = None
elif format_yaml:
try:
v[index] = None
elif format_yaml:
try:
- v[index] = yaml.load(v[index])
+ v[index] = yaml.load(v[index], Loader=yaml.SafeLoader)
return_text = "<html><pre>{} ->\n".format(main_topic)
try:
if cherrypy.request.method == 'POST':
return_text = "<html><pre>{} ->\n".format(main_topic)
try:
if cherrypy.request.method == 'POST':
- to_send = yaml.load(cherrypy.request.body)
+ to_send = yaml.load(cherrypy.request.body, Loader=yaml.SafeLoader)
for k, v in to_send.items():
self.engine.msg.write(main_topic, k, v)
return_text += " {}: {}\n".format(k, v)
elif cherrypy.request.method == 'GET':
for k, v in kwargs.items():
for k, v in to_send.items():
self.engine.msg.write(main_topic, k, v)
return_text += " {}: {}\n".format(k, v)
elif cherrypy.request.method == 'GET':
for k, v in kwargs.items():
- self.engine.msg.write(main_topic, k, yaml.load(v))
- return_text += " {}: {}\n".format(k, yaml.load(v))
+ self.engine.msg.write(main_topic, k, yaml.load(v), Loader=yaml.SafeLoader)
+ return_text += " {}: {}\n".format(k, yaml.load(v), Loader=yaml.SafeLoader)
except Exception as e:
return_text += "Error: " + str(e)
return_text += "</pre></html>\n"
except Exception as e:
return_text += "Error: " + str(e)
return_text += "</pre></html>\n"
ns_data.update(self.ns_params)
if test_params and test_params.get("ns-config"):
if isinstance(test_params["ns-config"], str):
ns_data.update(self.ns_params)
if test_params and test_params.get("ns-config"):
if isinstance(test_params["ns-config"], str):
- ns_data.update(yaml.load(test_params["ns-config"]))
+ ns_data.update(yaml.load(test_params["ns-config"]), Loader=yaml.Loader)
else:
ns_data.update(test_params["ns-config"])
self.instantiate(engine, ns_data)
else:
ns_data.update(test_params["ns-config"])
self.instantiate(engine, ns_data)
parameter:
"$[0]":
default-value: "<touch_filename2>"
parameter:
"$[0]":
default-value: "<touch_filename2>"
+ """,
+ Loader=yaml.Loader)
}
self.ns_params = {
"additionalParamsForVnf": [
}
self.ns_params = {
"additionalParamsForVnf": [
"vimAccountId": self.vim_id}
if test_params and test_params.get("ns-config"):
if isinstance(test_params["ns-config"], str):
"vimAccountId": self.vim_id}
if test_params and test_params.get("ns-config"):
if isinstance(test_params["ns-config"], str):
- ns_data.update(yaml.load(test_params["ns-config"]))
+ ns_data.update(yaml.load(test_params["ns-config"]), Loader=yaml.Loader)
else:
ns_data.update(test_params["ns-config"])
else:
ns_data.update(test_params["ns-config"])