From db1a6c70028a7db6916830b5da5d8aef52c52554 Mon Sep 17 00:00:00 2001 From: Alex Schultz Date: Tue, 31 Mar 2020 10:11:31 -0600 Subject: [PATCH] Switch to yaml.safe_load yaml.load is throwing a warning so we should use yaml.safe_load when loading the passwords instead. Change-Id: I2f90134b0ef3ca926917a3f96e2cdb85cd010cd4 --- tripleo_common/tests/utils/test_passwords.py | 2 +- tripleo_common/utils/passwords.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tripleo_common/tests/utils/test_passwords.py b/tripleo_common/tests/utils/test_passwords.py index 326c87243..9432c6cb9 100644 --- a/tripleo_common/tests/utils/test_passwords.py +++ b/tripleo_common/tests/utils/test_passwords.py @@ -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 = { diff --git a/tripleo_common/utils/passwords.py b/tripleo_common/utils/passwords.py index 13bae4369..52ab57363 100644 --- a/tripleo_common/utils/passwords.py +++ b/tripleo_common/utils/passwords.py @@ -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']