Use SafeDumper for yaml configs

With ansible 2.12 they started using CSafeDumper instead of
SafeDumper which ignores indent in yaml files.
To preserver behaviour and config formats we fallback to original
behaviour with indent of 2.

[1] bfd93c835a/lib/ansible/module_utils/common/yaml.py (L30)

Change-Id: Iadddef84eae31fab9478ad02220ae49d1c91fa4c
This commit is contained in:
Dmitriy Rabotyagov 2022-04-15 12:51:22 +02:00
parent 5070371edd
commit 365244afff

View File

@ -67,7 +67,7 @@ except NameError:
FileNotFoundError = OSError FileNotFoundError = OSError
class IDumper(AnsibleDumper): class IDumper(yaml.SafeDumper, AnsibleDumper):
def increase_indent(self, flow=False, indentless=False): def increase_indent(self, flow=False, indentless=False):
return super(IDumper, self).increase_indent(flow, False) return super(IDumper, self).increase_indent(flow, False)