From d4db2dd279916c2a1f73c236deed444fed5cc740 Mon Sep 17 00:00:00 2001 From: Kenny Woodson Date: Thu, 16 Feb 2017 15:44:26 -0500 Subject: Fixed tests for pyyaml vs ruamel. Added import logic. Fixed safe load. --- roles/lib_utils/library/yedit.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'roles/lib_utils/library') diff --git a/roles/lib_utils/library/yedit.py b/roles/lib_utils/library/yedit.py index 29475d603..7f71e6cbc 100644 --- a/roles/lib_utils/library/yedit.py +++ b/roles/lib_utils/library/yedit.py @@ -388,7 +388,7 @@ class Yedit(object): if hasattr(yaml, 'RoundTripDumper'): Yedit._write(self.filename, yaml.dump(self.yaml_dict, Dumper=yaml.RoundTripDumper)) else: - Yedit._write(self.filename, yaml.dump(self.yaml_dict, default_flow_style=False)) + Yedit._write(self.filename, yaml.safe_dump(self.yaml_dict, default_flow_style=False)) return (True, self.yaml_dict) @@ -431,7 +431,7 @@ class Yedit(object): if hasattr(yaml, 'RoundTripLoader'): self.yaml_dict = yaml.load(contents, yaml.RoundTripLoader) else: - self.yaml_dict = yaml.load(contents) + self.yaml_dict = yaml.safe_load(contents) # pylint: disable=no-member if hasattr(self.yaml_dict, 'fa'): self.yaml_dict.fa.set_block_style() -- cgit v1.2.1