)
if descriptor_format != "json":
try:
- return yaml.load(descriptor)
+ return yaml.safe_load(descriptor)
except yaml.YAMLError as exc:
error_pos = ""
if hasattr(exc, "problem_mark"):
def _parse_error_yaml(descriptor):
json_error = None
try:
- json_error = yaml.load(descriptor, Loader=yaml.Loader)
+ json_error = yaml.safe_load(descriptor)
return json_error["error"]["description"]
except Exception:
return str(json_error or descriptor)
@staticmethod
def _parse_yaml(descriptor, response=False):
try:
- return yaml.load(descriptor, Loader=yaml.Loader)
+ return yaml.safe_load(descriptor)
except yaml.YAMLError as exc:
error_pos = ""
if hasattr(exc, "problem_mark"):
try:
# read file as yaml format
with open(config_file) as f:
- conf = yaml.load(f, Loader=yaml.Loader)
+ conf = yaml.safe_load(f)
# Ensure all sections are not empty
for k in (
"global",
@staticmethod
def _parse_cloud_init(cloud_init_text, additional_params, vnfd_id, vdu_id):
try:
- env = Environment(undefined=StrictUndefined)
+ env = Environment(undefined=StrictUndefined, autoescape=True)
template = env.from_string(cloud_init_text)
return template.render(additional_params or {})
except UndefinedError as e: