diff --git a/keepalived/templates/config.jinja b/keepalived/templates/config.jinja index 95edc30..2749f36 100644 --- a/keepalived/templates/config.jinja +++ b/keepalived/templates/config.jinja @@ -1,6 +1,7 @@ {%- set key = 0 -%} {%- 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) -%} {%- set recurse = recurse + 1 -%} {%- if data is none -%} diff --git a/test/test_keepalived_config.py b/test/test_keepalived_config.py index e8a916c..f579236 100755 --- a/test/test_keepalived_config.py +++ b/test/test_keepalived_config.py @@ -79,5 +79,25 @@ class TestKeepalivedConfiguration(unittest.TestCase): result = 'vrrp_script gizmo {\nrunning dumdums\n}\nvrrp_instance dumdums {\nfred flintstone\n}\n' 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__': unittest.main()