]> git.openstreetmap.org Git - chef.git/commitdiff
Use kitchen? instead of looking for TEST_KITCHEN in the environent
authorTom Hughes <tom@compton.nu>
Wed, 10 Nov 2021 22:25:12 +0000 (22:25 +0000)
committerTom Hughes <tom@compton.nu>
Wed, 10 Nov 2021 22:25:12 +0000 (22:25 +0000)
cookbooks/geoipupdate/recipes/default.rb
cookbooks/networking/recipes/default.rb

index fedae00113522c473890d8cb8d19c16a77e2817f..6d8e5b6e56018734803cd48e46460330c07952c7 100644 (file)
@@ -35,7 +35,7 @@ execute "geoipupdate" do
   command "geoipupdate"
   user "root"
   group "root"
-  not_if { ENV.key?("TEST_KITCHEN") || node[:geoipupdate][:editions].all? { |edition| ::File.exist?("/usr/share/GeoIP/#{edition}.mmdb") } }
+  not_if { kitchen? || node[:geoipupdate][:editions].all? { |edition| ::File.exist?("/usr/share/GeoIP/#{edition}.mmdb") } }
 end
 
 systemd_service "geoipupdate" do
index f43eaf2a71354b36d169b415c82590198efa90ee..3a30f20f969ede3e6f314e27b6a4867d702cd5dd 100644 (file)
@@ -295,7 +295,7 @@ if node[:networking][:wireguard][:enabled]
       action :nothing
       subscribes :restart, "template[/etc/systemd/network/wireguard.netdev]"
       subscribes :restart, "template[/etc/systemd/network/wireguard.network]"
-      not_if { ENV.key?("TEST_KITCHEN") }
+      not_if { kitchen? }
     end
   else
     execute "networkctl-delete-wg0" do
@@ -310,7 +310,7 @@ if node[:networking][:wireguard][:enabled]
       command "networkctl reload"
       subscribes :run, "template[/etc/systemd/network/wireguard.netdev]"
       subscribes :run, "template[/etc/systemd/network/wireguard.network]"
-      not_if { ENV.key?("TEST_KITCHEN") }
+      not_if { kitchen? }
     end
   end
 end
@@ -323,7 +323,7 @@ end
 execute "hostnamectl-set-hostname" do
   command "hostnamectl set-hostname #{node[:networking][:hostname]}"
   notifies :reload, "ohai[reload-hostname]"
-  not_if { ENV.key?("TEST_KITCHEN") || node[:hostnamectl][:static_hostname] == node[:networking][:hostname] }
+  not_if { kitchen? || node[:hostnamectl][:static_hostname] == node[:networking][:hostname] }
 end
 
 template "/etc/hosts" do