From 683fb00d41ed6a0a353cb1738b29216c05cd976e Mon Sep 17 00:00:00 2001 From: Ross Brattain Date: Sat, 22 Jul 2017 15:15:13 -0700 Subject: replace yaml.load with yaml.safe_load yaml.safe_load is safer, obviously. anteater will check for this template_format use specialized constructor based on yaml.SafeLoader JIRA: YARDSTICK-760 Change-Id: Ia3b0b3aa0765385a0ee472a4d83f49d424b5a77f Signed-off-by: Ross Brattain --- yardstick/benchmark/core/plugin.py | 2 +- yardstick/benchmark/core/task.py | 4 ++-- yardstick/benchmark/core/testcase.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'yardstick/benchmark/core') diff --git a/yardstick/benchmark/core/plugin.py b/yardstick/benchmark/core/plugin.py index c8d0865d1..a741d5e74 100644 --- a/yardstick/benchmark/core/plugin.py +++ b/yardstick/benchmark/core/plugin.py @@ -153,7 +153,7 @@ class PluginParser(object): raise e print("Input plugin is:\n%s\n" % rendered_plugin) - cfg = yaml.load(rendered_plugin) + cfg = yaml.safe_load(rendered_plugin) except IOError as ioerror: sys.exit(ioerror) diff --git a/yardstick/benchmark/core/task.py b/yardstick/benchmark/core/task.py index b2da7a2ee..af508496f 100644 --- a/yardstick/benchmark/core/task.py +++ b/yardstick/benchmark/core/task.py @@ -411,7 +411,7 @@ class TaskParser(object): # pragma: no cover try: with open(self.path) as stream: - cfg = yaml.load(stream) + cfg = yaml.safe_load(stream) except IOError as ioerror: sys.exit(ioerror) @@ -475,7 +475,7 @@ class TaskParser(object): # pragma: no cover raise e print("Input task is:\n%s\n" % rendered_task) - cfg = yaml.load(rendered_task) + cfg = yaml.safe_load(rendered_task) except IOError as ioerror: sys.exit(ioerror) diff --git a/yardstick/benchmark/core/testcase.py b/yardstick/benchmark/core/testcase.py index 7b23b73aa..7ab1b08cf 100644 --- a/yardstick/benchmark/core/testcase.py +++ b/yardstick/benchmark/core/testcase.py @@ -69,7 +69,7 @@ class Testcase(object): def _parse_testcase(self, testcase_info): rendered_testcase = TaskTemplate.render(testcase_info) - testcase_cfg = yaml.load(rendered_testcase) + testcase_cfg = yaml.safe_load(rendered_testcase) test_precondition = testcase_cfg.get('precondition', {}) installer_type = test_precondition.get('installer_type', 'all') -- cgit 1.2.3-korg