Added key array pairs.
This commit is contained in:
parent
ff6fc02595
commit
d66a776ddb
@ -5,7 +5,13 @@
|
||||
{%- for key, value in data.iteritems() -%}
|
||||
{{ key }} {{ keepalived_config(value) }}
|
||||
{%- endfor -%}
|
||||
{%- else -%}
|
||||
{%- elif data is string or data is number -%}
|
||||
{{ data }}{{ '\n' }}
|
||||
{%- else -%}
|
||||
{{ '{\n' }}
|
||||
{%- for value in data -%}
|
||||
{{ keepalived_config(value) }}
|
||||
{%- endfor -%}
|
||||
{{ '}\n' }}
|
||||
{%- endif -%}
|
||||
{%- endmacro -%}
|
||||
|
@ -39,5 +39,10 @@ class TestKeepalivedConfiguration(unittest.TestCase):
|
||||
result = 'flintstone fred\n'
|
||||
self.renderTest(testdata, result)
|
||||
|
||||
def test_key_array_pair(self):
|
||||
testdata = {'flintstone': ['fred', 'wilma', 'pebbles']}
|
||||
result = 'flintstone {\nfred\nwilma\npebbles\n}\n'
|
||||
self.renderTest(testdata, result)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
Loading…
Reference in New Issue
Block a user