Skip to content
Snippets Groups Projects
Commit 52611ecb authored by Zuul's avatar Zuul Committed by Gerrit Code Review
Browse files

Merge "Fix maximum width of the DIB Multiline-YAML"

parents c0a45c7e 47862b56
No related branches found
No related tags found
No related merge requests found
......@@ -55,6 +55,14 @@ options:
default: False
required: False
type: bool
yaml_width:
description:
- The maximum width of the YAML document. By default, Ansible uses the
PyYAML library which has a default 80 symbol string length limit.
To change the limit, the new value can be used here.
default: None
required: False
type: int
author: Sean Mooney
'''
......@@ -68,6 +76,7 @@ Merge multiple yaml files:
sources:
- "/tmp/default.yml"
- "/tmp/override.yml"
yaml_width: 131072
dest:
- "/tmp/out.yml"
'''
......@@ -113,6 +122,7 @@ class ActionModule(action.ActionBase):
output = {}
sources = self._task.args.get('sources', None)
extend_lists = self._task.args.get('extend_lists', False)
yaml_width = self._task.args.get('yaml_width', None)
if not isinstance(sources, list):
sources = [sources]
for source in sources:
......@@ -127,11 +137,13 @@ class ActionModule(action.ActionBase):
try:
result_file = os.path.join(local_tempdir, 'source')
with open(result_file, 'w') as f:
f.write(yaml.dump(output, default_flow_style=False))
f.write(yaml.dump(output, default_flow_style=False,
width=yaml_width))
new_task = self._task.copy()
new_task.args.pop('sources', None)
new_task.args.pop('extend_lists', None)
new_task.args.pop('yaml_width', None)
new_task.args.update(
dict(
src=result_file
......
......@@ -17,6 +17,7 @@
- "{{ node_custom_config }}/{{ item }}.yml"
- "{{ node_custom_config }}/bifrost/{{ item }}.yml"
dest: "{{ node_config_directory }}/bifrost/{{ item }}.yml"
yaml_width: 131072
mode: "0660"
become: true
with_items:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment