summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Bielawa <tbielawa@redhat.com>2016-09-07 08:38:47 -0700
committerTim Bielawa <tbielawa@redhat.com>2016-09-07 08:38:52 -0700
commit1c796356d36921393a175547b225d121cc26e0cc (patch)
tree1360d131f4e1b85a930c6f2e10a94f08b8d402c0
parent5ca0a74fb271678708268c940fd52ccd15d207ca (diff)
downloadopenshift-1c796356d36921393a175547b225d121cc26e0cc.tar.gz
openshift-1c796356d36921393a175547b225d121cc26e0cc.tar.bz2
openshift-1c796356d36921393a175547b225d121cc26e0cc.tar.xz
openshift-1c796356d36921393a175547b225d121cc26e0cc.zip
Adjust to_padded_yaml transformation to use the AnsibleDumper
* Previously we used yaml.safe_dump * Now we use yamp.dump with the `Dumper` parameter set to the AnsibleDumper class. * AnsibleDumper subclasses yaml.SafeDumper, so we aren't losing any safety nets
-rw-r--r--filter_plugins/oo_filters.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/filter_plugins/oo_filters.py b/filter_plugins/oo_filters.py
index 053de7703..7b241e203 100644
--- a/filter_plugins/oo_filters.py
+++ b/filter_plugins/oo_filters.py
@@ -16,6 +16,7 @@ import pkg_resources
import re
import json
import yaml
+from ansible.parsing.yaml.dumper import AnsibleDumper
from ansible.utils.unicode import to_unicode
from urlparse import urlparse
@@ -621,7 +622,9 @@ class FilterModule(object):
return ""
try:
- transformed = yaml.safe_dump(data, indent=indent, allow_unicode=True, default_flow_style=False, **kw)
+ transformed = yaml.dump(data, indent=indent, allow_unicode=True,
+ default_flow_style=False,
+ Dumper=AnsibleDumper, **kw)
padded = "\n".join([" " * level * indent + line for line in transformed.splitlines()])
return to_unicode("\n{0}".format(padded))
except Exception as my_e: