Added additional carryovers.

This commit is contained in:
Jeff Baskin 2017-01-19 08:25:12 -05:00
parent f419f265e9
commit c545484961
2 changed files with 22 additions and 1 deletions

View File

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

View File

@ -79,5 +79,25 @@ class TestKeepalivedConfiguration(unittest.TestCase):
result = 'vrrp_script gizmo {\nrunning dumdums\n}\nvrrp_instance dumdums {\nfred flintstone\n}\n' result = 'vrrp_script gizmo {\nrunning dumdums\n}\nvrrp_instance dumdums {\nfred flintstone\n}\n'
self.renderTest(testdata, result) self.renderTest(testdata, result)
def test_carrover_vrrp_sync_group(self):
testdata = {'vrrp_sync_group': {'gizmo': {'fred': 'flintstone', 'barney': 'rubble'}}}
result = 'vrrp_sync_group gizmo {\nbarney rubble\nfred flintstone\n}\n'
self.renderTest(testdata, result)
def test_carrover_virtual_server_group(self):
testdata = {'virtual_server_group': {'gizmo': {'fred': 'flintstone', 'barney': 'rubble'}}}
result = 'virtual_server_group gizmo {\nbarney rubble\nfred flintstone\n}\n'
self.renderTest(testdata, result)
def test_carrover_virtual_server(self):
testdata = {'virtual_server': {'gizmo': {'fred': 'flintstone', 'barney': 'rubble'}}}
result = 'virtual_server gizmo {\nbarney rubble\nfred flintstone\n}\n'
self.renderTest(testdata, result)
def test_carrover_real_server(self):
testdata = {'real_server': {'gizmo': {'fred': 'flintstone', 'barney': 'rubble'}}}
result = 'real_server gizmo {\nbarney rubble\nfred flintstone\n}\n'
self.renderTest(testdata, result)
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()