X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=yardstick%2Fcommon%2Fyaml_loader.py;h=18673be7c30dd91c42da5d32a2ad91c9f8da38b2;hb=43eb5e0b4a03278b12c002ff5a5d1c6f58da35d6;hp=0572bd58295f666d3672b875519b14992434b40f;hpb=ffecd5b84eecdb74d7534b801c1359251c34b34e;p=yardstick.git 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