Resolve unsafe yaml.load use

Fxed deprecation warning about unsafe call

Change-Id: I474454f438d6345dea76daf788be14c93fee6fb6
This commit is contained in:
Sorin Sbarnea 2020-05-22 19:21:29 +01:00
parent 673a054b17
commit 8f709c1d67
2 changed files with 3 additions and 3 deletions

View File

@ -69,7 +69,7 @@ def query(query_file_name, config=None, days=DEFAULT_NUMBER_OF_DAYS,
indexfmt=_config.es_index_format)
with open(query_file_name) as f:
query_file = yaml.load(f.read())
query_file = yaml.load(f.read(), Loader=yaml.SafeLoader)
query = query_file['query']
r = es.search(query, days=days)

View File

@ -55,7 +55,7 @@ class TestBot(unittest.TestCase):
_set_fake_config(self.fake_config)
config = er_conf.Config(config_obj=self.fake_config)
self.channel_config = bot.ChannelConfig(yaml.load(
open('recheckwatchbot.yaml')))
open('recheckwatchbot.yaml'), Loader=yaml.SafeLoader))
with mock.patch('launchpadlib.launchpad.Launchpad'):
self.recheck_watch = bot.RecheckWatch(
None,
@ -101,7 +101,7 @@ class TestBotWithTestTools(tests.TestCase):
_set_fake_config(self.fake_config)
config = er_conf.Config(config_obj=self.fake_config)
self.channel_config = bot.ChannelConfig(yaml.load(
open('recheckwatchbot.yaml')))
open('recheckwatchbot.yaml'), Loader=yaml.SafeLoader))
with mock.patch('launchpadlib.launchpad.Launchpad'):
self.recheck_watch = bot.RecheckWatch(
None,