]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/openvpn/recipes/default.rb
Fix more rubocop detected style issues
[chef.git] / cookbooks / openvpn / recipes / default.rb
index fbf6af9b6109e031b1e8ad6b7e4a89a0df80dce7..3a0bcccf5d7db1bed38dd71c2c5c4a8a7acd8313 100644 (file)
@@ -25,9 +25,9 @@ service "openvpn" do
   ignore_failure true
 end
 
   ignore_failure true
 end
 
-node[:openvpn][:tunnels].each do |name,details|
+node[:openvpn][:tunnels].each do |name, details|
   if peer = search(:node, "fqdn:#{details[:peer][:host]}").first
   if peer = search(:node, "fqdn:#{details[:peer][:host]}").first
-    if peer[:openvpn] and not details[:peer][:address]
+    if peer[:openvpn] && !details[:peer][:address]
       node.default[:openvpn][:tunnels][name][:peer][:address] = peer[:openvpn][:address]
     end
 
       node.default[:openvpn][:tunnels][name][:peer][:address] = peer[:openvpn][:address]
     end
 
@@ -46,10 +46,10 @@ node[:openvpn][:tunnels].each do |name,details|
       creates "/etc/openvpn/#{name}.key"
     end
 
       creates "/etc/openvpn/#{name}.key"
     end
 
-    if File.exists?("/etc/openvpn/#{name}.key")
+    if File.exist?("/etc/openvpn/#{name}.key")
       node.set[:openvpn][:keys][name] = IO.read("/etc/openvpn/#{name}.key")
     end
       node.set[:openvpn][:keys][name] = IO.read("/etc/openvpn/#{name}.key")
     end
-  elsif peer and peer[:openvpn]
+  elsif peer && peer[:openvpn]
     file "/etc/openvpn/#{name}.key" do
       owner "root"
       group "root"
     file "/etc/openvpn/#{name}.key" do
       owner "root"
       group "root"
@@ -65,10 +65,10 @@ node[:openvpn][:tunnels].each do |name,details|
       group "root"
       mode 0644
       variables :name => name,
       group "root"
       mode 0644
       variables :name => name,
-      :address => node[:openvpn][:address],
-      :port => node[:openvpn][:tunnels][name][:port],
-      :mode => node[:openvpn][:tunnels][name][:mode],
-      :peer => node[:openvpn][:tunnels][name][:peer]
+                :address => node[:openvpn][:address],
+                :port => node[:openvpn][:tunnels][name][:port],
+                :mode => node[:openvpn][:tunnels][name][:mode],
+                :peer => node[:openvpn][:tunnels][name][:peer]
       notifies :restart, "service[openvpn]"
     end
   else
       notifies :restart, "service[openvpn]"
     end
   else