Adding additional vrrp

This commit is contained in:
Jeff Baskin 2017-01-19 08:09:44 -05:00
parent 671f64b672
commit f419f265e9
2 changed files with 16 additions and 1 deletions

View File

@ -1,6 +1,6 @@
{%- set key = 0 -%}
{%- set value = 1 -%}
{%- set carryovers = ['vrrp_script'] -%}
{%- set carryovers = ['vrrp_instance', 'vrrp_script'] -%}
{%- macro keepalived_config(data, carryover='', recurse=-1) -%}
{%- set recurse = recurse + 1 -%}
{%- if data is none -%}

View File

@ -64,5 +64,20 @@ class TestKeepalivedConfiguration(unittest.TestCase):
result = 'vrrp_script gizmo {\nbarney rubble\nfred flintstone\n}\n'
self.renderTest(testdata, result)
def test_carryover_contains_arry(self):
testdata = {'vrrp_script': {'gizmo': [{'fred': 'flintstone'}, {'barney': 'rubble'}]}}
result = 'vrrp_script gizmo {\nfred flintstone\nbarney rubble\n}\n'
self.renderTest(testdata, result)
def test_carrover_vrrp_instance(self):
testdata = {'vrrp_instance': {'gizmo': {'fred': 'flintstone', 'barney': 'rubble'}}}
result = 'vrrp_instance gizmo {\nbarney rubble\nfred flintstone\n}\n'
self.renderTest(testdata, result)
def test_carryovers_in_an_array(self):
testdata = [{'vrrp_script': {'gizmo': {'running': 'dumdums'}}}, {'vrrp_instance': {'dumdums': {'fred': 'flintstone'}}}]
result = 'vrrp_script gizmo {\nrunning dumdums\n}\nvrrp_instance dumdums {\nfred flintstone\n}\n'
self.renderTest(testdata, result)
if __name__ == '__main__':
unittest.main()