]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/openvpn/recipes/default.rb
Expire tiles from both osm.gz and osc.gz files
[chef.git] / cookbooks / openvpn / recipes / default.rb
index 9b01bfdb938049159705a477c4d2141751b0ca8d..29bea6d28528260fb281682e1a706875221a6d0d 100644 (file)
@@ -26,7 +26,9 @@ service "openvpn" do
 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
@@ -47,13 +49,13 @@ node[:openvpn][:tunnels].each do |name, details|
     end
 
     if File.exist?("/etc/openvpn/#{name}.key")
-      node.set[:openvpn][:keys][name] = IO.read("/etc/openvpn/#{name}.key")
+      node.normal[:openvpn][:keys][name] = IO.read("/etc/openvpn/#{name}.key")
     end
   elsif peer && peer[:openvpn]
     file "/etc/openvpn/#{name}.key" do
       owner "root"
       group "root"
-      mode 0600
+      mode 0o600
       content peer[:openvpn][:keys][name]
     end
   end
@@ -63,7 +65,7 @@ node[:openvpn][:tunnels].each do |name, details|
       source "tunnel.conf.erb"
       owner "root"
       group "root"
-      mode 0644
+      mode 0o644
       variables :name => name,
                 :address => node[:openvpn][:address],
                 :port => node[:openvpn][:tunnels][name][:port],