summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/chef/resource/hostname.rb1
-rw-r--r--lib/chef/resource/kernel_module.rb3
2 files changed, 4 insertions, 0 deletions
diff --git a/lib/chef/resource/hostname.rb b/lib/chef/resource/hostname.rb
index 82240bd6fb..0bdabe430c 100644
--- a/lib/chef/resource/hostname.rb
+++ b/lib/chef/resource/hostname.rb
@@ -131,6 +131,7 @@ class Chef
# use hostnamectl whenever we find it on linux (as systemd takes over the world)
# this must come before other methods like /etc/hostname and /etc/sysconfig/network
declare_resource(:execute, "hostnamectl set-hostname #{new_resource.hostname}") do
+ default_env true
notifies :reload, "ohai[reload hostname]"
not_if { shell_out!("hostnamectl status", { returns: [0, 1] }).stdout =~ /Static hostname:\s*#{new_resource.hostname}\s*$/ }
end
diff --git a/lib/chef/resource/kernel_module.rb b/lib/chef/resource/kernel_module.rb
index 54f213cd11..8c14abede4 100644
--- a/lib/chef/resource/kernel_module.rb
+++ b/lib/chef/resource/kernel_module.rb
@@ -46,6 +46,7 @@ class Chef
execute "update initramfs" do
command initramfs_command
+ default_env true
action :nothing
end
end
@@ -65,6 +66,7 @@ class Chef
execute "update initramfs" do
command initramfs_command
+ default_env true
action :nothing
end
@@ -81,6 +83,7 @@ class Chef
execute "update initramfs" do
command initramfs_command
+ default_env true
action :nothing
end