diff --git a/openstack_releases/yamlutils.py b/openstack_releases/yamlutils.py index 6442f03eaf..95c7a8e027 100644 --- a/openstack_releases/yamlutils.py +++ b/openstack_releases/yamlutils.py @@ -78,6 +78,13 @@ class PrettySafeDumper(yaml.dumper.SafeDumper): else: return super(PrettySafeDumper, self).represent_undefined(data) + # Override this method to always indent. Otherwise when a list is + # emitted, the items nested under it are not and we have inconsistent + # formatting. + # https://stackoverflow.com/questions/25108581/python-yaml-dump-bad-indentation + def increase_indent(self, flow=False, indentless=False): + return super(PrettySafeDumper, self).increase_indent(flow, False) + # NOTE(harlowja): at some point this may not be needed... # See: http://pyyaml.org/ticket/29 diff --git a/yamllint.yml b/yamllint.yml index 86d9976a83..8548bb7225 100644 --- a/yamllint.yml +++ b/yamllint.yml @@ -7,3 +7,7 @@ rules: max: 200 level: warning allow-non-breakable-words: true + + indentation: + spaces: 2 +