]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/openvpn/recipes/default.rb
Rubocop cleanups
[chef.git] / cookbooks / openvpn / recipes / default.rb
index 9b01bfdb938049159705a477c4d2141751b0ca8d..9b96183eec2a0452acc920c24159f91d20318e72 100644 (file)
@@ -26,7 +26,9 @@ service "openvpn" do
 end
 
 node[:openvpn][:tunnels].each do |name, details|
 end
 
 node[:openvpn][:tunnels].each do |name, details|
-  if peer = search(:node, "fqdn:#{details[:peer][:host]}").first
+  peer = search(:node, "fqdn:#{details[:peer][:host]}").first
+
+  if peer
     if peer[:openvpn] && !details[:peer][:address]
       node.default[:openvpn][:tunnels][name][:peer][:address] = peer[:openvpn][:address]
     end
     if peer[:openvpn] && !details[:peer][:address]
       node.default[:openvpn][:tunnels][name][:peer][:address] = peer[:openvpn][:address]
     end