Merge "Switch to yaml.safe_load"
This commit is contained in:
commit
5caa15425c
|
@ -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 = {
|
||||
|
|
|
@ -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']
|
||||
|
||||
|
|
Loading…
Reference in New Issue