Correct YAML load warning

The use of `yaml.load` without Loader is deprecated and
considered unsafe.

The warning notice:
/opt/stack/python-tackerclient/tackerclient/tacker/v1_0/nfvo/vim.py:
YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated,
as the default Loader is unsafe.
Please read https://msg.pyyaml.org/load for full details.
config_param = yaml.load(config_yaml)

This change adds (Loader=yaml.SafeLoader) to remove the warning.

Change-Id: Idc77d855b41801777d57cfe92d1c448b6e72feaa
This commit is contained in:
Manpreet Kaur
2021-07-02 20:36:29 +05:30
parent ce07d93715
commit 94e28fc28f
2 changed files with 4 additions and 2 deletions

View File

@@ -230,7 +230,8 @@ class UpdateVIM(command.ShowOne):
with open(parsed_args.config_file) as f:
config_yaml = f.read()
try:
config_param = yaml.load(config_yaml)
config_param = yaml.load(config_yaml,
Loader=yaml.SafeLoader)
except yaml.YAMLError as e:
raise exceptions.InvalidInput(reason=e)
vim_obj = body[_VIM]

View File

@@ -117,7 +117,8 @@ class UpdateVIM(tackerV10.UpdateCommand):
with open(parsed_args.config_file) as f:
config_yaml = f.read()
try:
config_param = yaml.load(config_yaml)
config_param = yaml.load(config_yaml,
Loader=yaml.SafeLoader)
except yaml.YAMLError as e:
raise exceptions.InvalidInput(reason=e)
vim_obj = body[self.resource]