Corrected carryover indention.
This commit is contained in:
parent
726f34379d
commit
2f8ff3ec6b
@ -20,14 +20,15 @@
|
|||||||
{{- keepalived_config(item[value], carryover=item[key], indent=indent) -}}
|
{{- keepalived_config(item[value], carryover=item[key], indent=indent) -}}
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
{%- set carryIndent = indentHolder -%}
|
{%- set carryIndent = indentHolder -%}
|
||||||
|
{%- set forwardIndent = indentHolder -%}
|
||||||
{%- if carryover -%}
|
{%- if carryover -%}
|
||||||
{{- carryover|indent(indentHolder, True) }}{{ ' ' -}}
|
{{- carryover|indent(indentHolder, True) }}{{ ' ' -}}
|
||||||
{%- set carryIndent = 0 -%}
|
{%- set carryIndent = 0 -%}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- if item[value] is string or item[value] is not iterable -%}
|
{%- if item[value] is string or item[value] is not iterable -%}
|
||||||
{%- set indent = 0 -%}
|
{%- set forwardIndent = 0 -%}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{{- item[key]|indent(carryIndent, True) }} {{ keepalived_config(item[value], recurse=recurse, indent=indent) -}}
|
{{- item[key]|indent(carryIndent, True) }} {{ keepalived_config(item[value], recurse=recurse, indent=forwardIndent) -}}
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
|
@ -104,5 +104,15 @@ class TestKeepalivedConfiguration(unittest.TestCase):
|
|||||||
result = 'virtual_server gizmo {\n real_server dumdums {\n barney rubble\n fred flintstone\n }\n}\n'
|
result = 'virtual_server gizmo {\n real_server dumdums {\n barney rubble\n fred flintstone\n }\n}\n'
|
||||||
self.renderTest(testdata, result)
|
self.renderTest(testdata, result)
|
||||||
|
|
||||||
|
def test_indent_nested_hashes(self):
|
||||||
|
testdata = {'flintstone': {'fred': {'role': {'family': 'father'}}}}
|
||||||
|
result = 'flintstone {\n fred {\n role {\n family father\n }\n }\n}\n'
|
||||||
|
self.renderTest(testdata, result)
|
||||||
|
|
||||||
|
def test_indent_carryover_with_nested_hashes(self):
|
||||||
|
testdata = {'real_server': {'gizmo': {'another': 'day', 'dumdums': {'fred': 'flintstone', 'barney': 'rubble'}}}}
|
||||||
|
result = 'real_server gizmo {\n another day\n dumdums {\n barney rubble\n fred flintstone\n }\n}\n'
|
||||||
|
self.renderTest(testdata, result)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
Loading…
Reference in New Issue
Block a user