From 4bf3b18f921b7bc7ecf3d34cb74fd80176cae8d5 Mon Sep 17 00:00:00 2001 From: Rodolfo Alonso Hernandez Date: Thu, 28 Jun 2018 17:17:08 +0100 Subject: Move "read_yaml_file" to common.yaml_loader JIRA: YARDSTICK-1265 Change-Id: Ic2813dca7fc9a3230632f6e8bd75aeacc7e951b0 Signed-off-by: Rodolfo Alonso Hernandez --- yardstick/common/utils.py | 9 --------- yardstick/common/yaml_loader.py | 12 ++++++++---- 2 files changed, 8 insertions(+), 13 deletions(-) (limited to 'yardstick/common') diff --git a/yardstick/common/utils.py b/yardstick/common/utils.py index 251e5cc6c..f9fe0e336 100644 --- a/yardstick/common/utils.py +++ b/yardstick/common/utils.py @@ -37,7 +37,6 @@ from oslo_utils import encodeutils import yardstick from yardstick.common import exceptions -from yardstick.common.yaml_loader import yaml_load logger = logging.getLogger(__name__) @@ -528,11 +527,3 @@ def wait_until_true(predicate, timeout=60, sleep=1, exception=None): if exception and issubclass(exception, Exception): raise exception # pylint: disable=raising-bad-type raise exceptions.WaitTimeout - - -def read_yaml_file(path): - """Read yaml file""" - - with open(path) as stream: - data = yaml_load(stream) - return data diff --git a/yardstick/common/yaml_loader.py b/yardstick/common/yaml_loader.py index 0572bd582..18673be7c 100644 --- a/yardstick/common/yaml_loader.py +++ b/yardstick/common/yaml_loader.py @@ -10,10 +10,6 @@ # License for the specific language governing permissions and limitations # under the License. -# yardstick: this file is copied from python-heatclient and slightly modified - -from __future__ import absolute_import - import yaml @@ -23,6 +19,7 @@ if hasattr(yaml, 'CSafeLoader'): else: yaml_loader = type('CustomLoader', (yaml.SafeLoader,), {}) + if hasattr(yaml, 'CSafeDumper'): yaml_dumper = yaml.CSafeDumper else: @@ -31,3 +28,10 @@ else: def yaml_load(tmpl_str): return yaml.load(tmpl_str, Loader=yaml_loader) + + +def read_yaml_file(path): + """Read yaml file""" + with open(path) as stream: + data = yaml_load(stream) + return data -- cgit 1.2.3-korg