summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2018-08-02 14:52:04 -0700
committerTim Smith <tsmith@chef.io>2018-08-02 14:52:04 -0700
commitd119830e9b991eca7b54a9683bb85f0c2b536a63 (patch)
tree8d435031725ad99ac9a83aa2815f6196dcfca437
parent628b6189201c532ae0e3ff962b324018911ff389 (diff)
downloadchef-default_env.tar.gz
Prevent RHEL path errors in kernel_module and hostnamedefault_env
RHEL lacks working paths out of the box so these 2 resources are probably going to fail. Signed-off-by: Tim Smith <tsmith@chef.io>
-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