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 ebb26f01be
1 changed files with 1 additions and 2 deletions

View File

@ -42,7 +42,6 @@ from ansible.module_utils._text import to_bytes, to_text
from ansible.module_utils.parsing.convert_bool import boolean
from ansible import constants as C
from ansible import errors
from ansible.parsing.yaml.dumper import AnsibleDumper
from distutils.version import LooseVersion
from ansible import __version__ as __ansible_version__
@ -67,7 +66,7 @@ except NameError:
FileNotFoundError = OSError
class IDumper(AnsibleDumper):
class IDumper(yaml.SafeDumper):
def increase_indent(self, flow=False, indentless=False):
return super(IDumper, self).increase_indent(flow, False)