diff options
author | elijah <elijah@riseup.net> | 2017-09-05 18:24:31 -0700 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2017-09-05 18:24:31 -0700 |
commit | 6482a4ccb3d72773cc6d00d5fa7933fa83c4cafe (patch) | |
tree | 7889f849a75e02d971919f154eb1746ce7e686a3 /puppet/modules/site_openvpn/templates | |
parent | 437f28b2cbfedfc7d119dcf4e228c5626bb8a152 (diff) |
Bug: fix vpn network problem caused by vagrant fact
Boolean facts must be escaped with str2bool. This commit includes
new tests to catch VPN problems like this in the future.
Diffstat (limited to 'puppet/modules/site_openvpn/templates')
-rw-r--r-- | puppet/modules/site_openvpn/templates/add_gateway_ips.sh.erb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/puppet/modules/site_openvpn/templates/add_gateway_ips.sh.erb b/puppet/modules/site_openvpn/templates/add_gateway_ips.sh.erb index e76b756b..f2d2bc70 100644 --- a/puppet/modules/site_openvpn/templates/add_gateway_ips.sh.erb +++ b/puppet/modules/site_openvpn/templates/add_gateway_ips.sh.erb @@ -1,11 +1,21 @@ #!/bin/sh -ip addr show dev <%= scope.lookupvar('site_config::params::interface') %> | grep -q <%= @openvpn_gateway_address %>/<%= @primary_netmask %> || +ip addr show dev <%= scope.lookupvar('site_config::params::interface') %> | grep -q "inet <%= @openvpn_gateway_address %>/" || ip addr add <%= @openvpn_gateway_address %>/<%= @primary_netmask %> dev <%= scope.lookupvar('site_config::params::interface') %> +EXITCODE=$? +if [ $EXITCODE != 0 ]; then + exit $EXITCODE +fi + <% if @openvpn_second_gateway_address %> -ip addr show dev <%= scope.lookupvar('site_config::params::interface') %> | grep -q <%= @openvpn_second_gateway_address %>/<%= @primary_netmask %> || +ip addr show dev <%= scope.lookupvar('site_config::params::interface') %> | grep -q "<%= @openvpn_second_gateway_address %>/" || ip addr add <%= @openvpn_second_gateway_address %>/<%= @primary_netmask %> dev <%= scope.lookupvar('site_config::params::interface') %> + +EXITCODE=$? +if [ $EXITCODE != 0 ]; then + exit $EXITCODE +fi <% end %> /bin/echo 1 > /proc/sys/net/ipv4/ip_forward |