Merge "Switch to yaml.safe_load"

This commit is contained in:
Zuul 2020-04-04 03:56:02 +00:00 committed by Gerrit Code Review
commit 5caa15425c
2 changed files with 2 additions and 2 deletions

View File

@ -39,7 +39,7 @@ class TestPasswords(base.TestCase):
def test_get_snmpd_readonly_user_password(self):
with mock.patch(self.open_builtins, mock.mock_open(read_data="data")):
with mock.patch('yaml.load') as mock_yaml:
with mock.patch('yaml.safe_load') as mock_yaml:
with mock.patch('os.path.exists') as mock_exists:
mock_exists.return_value = True
mock_yaml.return_value = {

View File

@ -137,7 +137,7 @@ def get_snmpd_readonly_user_password(pw_file=None):
return passlib.pwd.genword(length=24)
else:
with open(pw_file) as f:
passwords = yaml.load(f.read())
passwords = yaml.safe_load(f.read())
return passwords['parameter_defaults']['SnmpdReadonlyUserPassword']