Skip to content

Commit

Permalink
Merge pull request #154 from rexredinger/rlm_1374
Browse files Browse the repository at this point in the history
RLM-1374 Indent Mapped Sequences
  • Loading branch information
antonym authored Apr 20, 2018
2 parents 5ef5c28 + 24216eb commit 07e25bb
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion playbooks/scripts/required_user_config_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@
"""


class IndentFix(yaml.Dumper):
"""This address RLM 1374, proper indentation for mapped sequence blocks
Pass this as the Dumper class when making calls to yaml.dump() to ensure
indentation remains consistent.
"""

def increase_indent(self, flow=False, indentless=False):
return super(IndentFix, self).increase_indent(flow, False)


def key_check_add(key, user_config_file, changed=False):
"""Add key if missing in the openstack_user_config.yml
Expand Down Expand Up @@ -71,7 +82,8 @@ def key_check_add(key, user_config_file, changed=False):
yaml.dump(
user_config,
default_flow_style=False,
width=1000
width=1000,
Dumper=IndentFix
)
)

Expand Down

0 comments on commit 07e25bb

Please sign in to comment.