summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Doherty <tom.doherty@fixnetix.com>2018-11-05 11:26:52 +0000
committerTim Smith <tsmith@chef.io>2018-11-07 10:23:34 -0800
commit3496857463ad1062e4ea5582b8dac22c3578b5ba (patch)
tree3f48d2b099f6ea86692ac44999b7699d9b558a4c
parentd6b6271d1eb1e0aeb1d9491230af79cbb1c9a1d6 (diff)
downloadchef-initramfs_14.tar.gz
Defer running initramfs_command until end of runinitramfs_14
Signed-off-by: Tom Doherty <tom.doherty@fixnetix.com>
-rw-r--r--lib/chef/resource/kernel_module.rb32
1 files changed, 19 insertions, 13 deletions
diff --git a/lib/chef/resource/kernel_module.rb b/lib/chef/resource/kernel_module.rb
index 54f213cd11..ea33d19ff1 100644
--- a/lib/chef/resource/kernel_module.rb
+++ b/lib/chef/resource/kernel_module.rb
@@ -41,12 +41,14 @@ class Chef
file "#{new_resource.load_dir}/#{new_resource.modname}.conf" do
content "#{new_resource.modname}\n"
- notifies :run, "execute[update initramfs]"
+ notifies :run, "execute[update initramfs]", :delayed
end
- execute "update initramfs" do
- command initramfs_command
- action :nothing
+ with_run_context :root do
+ find_resource(:execute, "update initramfs") do
+ command initramfs_command
+ action :nothing
+ end
end
end
@@ -55,17 +57,19 @@ class Chef
file "#{new_resource.load_dir}/#{new_resource.modname}.conf" do
action :delete
- notifies :run, "execute[update initramfs]"
+ notifies :run, "execute[update initramfs]", :delayed
end
file "#{new_resource.unload_dir}/blacklist_#{new_resource.modname}.conf" do
action :delete
- notifies :run, "execute[update initramfs]"
+ notifies :run, "execute[update initramfs]", :delayed
end
- execute "update initramfs" do
- command initramfs_command
- action :nothing
+ with_run_context :root do
+ find_resource(:execute, "update initramfs") do
+ command initramfs_command
+ action :nothing
+ end
end
new_resource.run_action(:unload)
@@ -76,12 +80,14 @@ class Chef
file "#{new_resource.unload_dir}/blacklist_#{new_resource.modname}.conf" do
content "blacklist #{new_resource.modname}"
- notifies :run, "execute[update initramfs]"
+ notifies :run, "execute[update initramfs]", :delayed
end
- execute "update initramfs" do
- command initramfs_command
- action :nothing
+ with_run_context :root do
+ find_resource(:execute, "update initramfs") do
+ command initramfs_command
+ action :nothing
+ end
end
new_resource.run_action(:unload)