diff options
Diffstat (limited to 'cloudinit/safeyaml.py')
-rw-r--r-- | cloudinit/safeyaml.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/cloudinit/safeyaml.py b/cloudinit/safeyaml.py index 7bcf9dd3..3bd5e03d 100644 --- a/cloudinit/safeyaml.py +++ b/cloudinit/safeyaml.py @@ -17,6 +17,13 @@ _CustomSafeLoader.add_constructor( _CustomSafeLoader.construct_python_unicode) +class NoAliasSafeDumper(yaml.dumper.SafeDumper): + """A class which avoids constructing anchors/aliases on yaml dump""" + + def ignore_aliases(self, data): + return True + + def load(blob): return(yaml.load(blob, Loader=_CustomSafeLoader)) |