Whitespace fixes and simplification of keepalived template

Change-Id: I67c45189dfdf0fe8a62cf7fb304a9b42c425c713
This commit is contained in:
Adam Harwell 2017-08-22 15:25:52 -07:00
parent bacf5ff193
commit 87a9ac6685
2 changed files with 45 additions and 53 deletions

View File

@ -13,13 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
#}
{% macro unicast_peer_macro(peers_vrrp_ips) %}
{% for amp_vrrp_ip in peers_vrrp_ips %}
{{ amp_vrrp_ip }}
{% endfor %}
{% endmacro %}
vrrp_script check_script {
script {{ check_script_path }}
interval {{ vrrp_check_interval }}
@ -28,29 +21,31 @@ vrrp_script check_script {
}
vrrp_instance {{ vrrp_group_name }} {
state {{ amp_role }}
interface {{ amp_intf }}
virtual_router_id {{ amp_vrrp_id }}
priority {{ amp_priority }}
nopreempt
garp_master_refresh {{ vrrp_garp_refresh }}
garp_master_refresh_repeat {{ vrrp_garp_refresh_repeat }}
advert_int {{ advert_int }}
authentication {
auth_type {{ vrrp_auth_type }}
auth_pass {{ vrrp_auth_pass }}
}
state {{ amp_role }}
interface {{ amp_intf }}
virtual_router_id {{ amp_vrrp_id }}
priority {{ amp_priority }}
nopreempt
garp_master_refresh {{ vrrp_garp_refresh }}
garp_master_refresh_repeat {{ vrrp_garp_refresh_repeat }}
advert_int {{ advert_int }}
authentication {
auth_type {{ vrrp_auth_type }}
auth_pass {{ vrrp_auth_pass }}
}
unicast_src_ip {{ amp_vrrp_ip }}
unicast_peer {
{{ unicast_peer_macro(peers_vrrp_ips) }}
}
unicast_src_ip {{ amp_vrrp_ip }}
unicast_peer {
{% for amp_vrrp_ip in peers_vrrp_ips %}
{{ amp_vrrp_ip }}
{% endfor %}
}
virtual_ipaddress {
{{ vip_ip_address }}
}
track_script {
virtual_ipaddress {
{{ vip_ip_address }}
}
track_script {
check_script
}
}
}

View File

@ -60,9 +60,7 @@ class TestVRRPRestDriver(base.TestCase):
self.lb.vip.ip_address = '10.1.0.5'
self.lb.vrrp_group.advert_int = 10
self.ref_conf = ("\n"
"\n"
"vrrp_script check_script {\n"
self.ref_conf = ("vrrp_script check_script {\n"
" script /tmp/test/vrrp/check_script.sh\n"
" interval 5\n"
" fall 2\n"
@ -70,31 +68,30 @@ class TestVRRPRestDriver(base.TestCase):
"}\n"
"\n"
"vrrp_instance TESTGROUP {\n"
" state MASTER\n"
" interface eth1\n"
" virtual_router_id 1\n"
" priority 100\n"
" nopreempt\n"
" garp_master_refresh 5\n"
" garp_master_refresh_repeat 2\n"
" advert_int 10\n"
" authentication {\n"
" auth_type PASS\n"
" auth_pass TESTPASSWORD\n"
" }\n"
" state MASTER\n"
" interface eth1\n"
" virtual_router_id 1\n"
" priority 100\n"
" nopreempt\n"
" garp_master_refresh 5\n"
" garp_master_refresh_repeat 2\n"
" advert_int 10\n"
" authentication {\n"
" auth_type PASS\n"
" auth_pass TESTPASSWORD\n"
" }\n"
"\n"
" unicast_src_ip 10.0.0.1\n"
" unicast_peer {\n"
" 10.0.0.2\n"
" unicast_src_ip 10.0.0.1\n"
" unicast_peer {\n"
" 10.0.0.2\n"
" }\n"
"\n"
" }\n"
"\n"
" virtual_ipaddress {\n"
" 10.1.0.5\n"
" }\n"
" track_script {\n"
" virtual_ipaddress {\n"
" 10.1.0.5\n"
" }\n"
" track_script {\n"
" check_script\n"
" }\n"
" }\n"
"}\n")
def test_build_keepalived_config(self):