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) -}}
|
||||
{%- else -%}
|
||||
{%- set carryIndent = indentHolder -%}
|
||||
{%- set forwardIndent = indentHolder -%}
|
||||
{%- if carryover -%}
|
||||
{{- carryover|indent(indentHolder, True) }}{{ ' ' -}}
|
||||
{%- set carryIndent = 0 -%}
|
||||
{%- endif -%}
|
||||
{%- if item[value] is string or item[value] is not iterable -%}
|
||||
{%- set indent = 0 -%}
|
||||
{%- set forwardIndent = 0 -%}
|
||||
{%- 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 -%}
|
||||
{%- endfor -%}
|
||||
{%- 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'
|
||||
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__':
|
||||
unittest.main()
|
||||
|
Loading…
Reference in New Issue
Block a user