summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2018-04-21 18:56:12 -0700
committerTim Smith <tsmith@chef.io>2018-06-11 12:40:59 -0700
commitc46594b9c18541b30a495f4f96ead1ec20f09a44 (patch)
treee11a0c5f76f56c1cfb748a5038d6adf3dfdb9973
parentce666826c4e4671eb23e9c8c22577bd89ef782cb (diff)
downloadchef-c46594b9c18541b30a495f4f96ead1ec20f09a44.tar.gz
Add descriptions
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/chef/resource/kernel_module.rb32
1 files changed, 24 insertions, 8 deletions
diff --git a/lib/chef/resource/kernel_module.rb b/lib/chef/resource/kernel_module.rb
index e7c11cb67f..4f02e74166 100644
--- a/lib/chef/resource/kernel_module.rb
+++ b/lib/chef/resource/kernel_module.rb
@@ -14,12 +14,24 @@ class Chef
resource_name :kernel_module
provides(:kernel_module) { true }
- property :modname, String, name_property: true, identity: true
- property :load_dir, String, default: "/etc/modules-load.d"
- property :unload_dir, String, default: "/etc/modprobe.d"
+ description "Use the kernel_module resource to manage kernel modules on Linux systems. This resource can load, unload, blacklist, install, and uninstall modules."
+ introduced "15.0"
+
+ property :modname, String,
+ description: "The name of the kernel module.",
+ name_property: true, identity: true
+
+ property :load_dir, String,
+ description: "The directory to load modules from.",
+ default: "/etc/modules-load.d"
+
+ property :unload_dir, String,
+ description: "The modprobe.d directory.",
+ default: "/etc/modprobe.d"
- # Load kernel module, and ensure it loads on reboot
action :install do
+ description "Load kernel module, and ensure it loads on reboot"
+
declare_resource(:directory, new_resource.load_dir) do
recursive true
end
@@ -37,8 +49,9 @@ class Chef
new_resource.run_action(:load)
end
- # Unload module and remove module config, so it doesn't load on reboot.
action :uninstall do
+ description "Unload a kernel module and remove module config, so it doesn't load on reboot."
+
declare_resource(:file, "#{new_resource.load_dir}/#{new_resource.modname}.conf") do
action :delete
notifies :run, "execute[update initramfs]"
@@ -57,8 +70,9 @@ class Chef
new_resource.run_action(:unload)
end
- # Blacklist kernel module
action :blacklist do
+ description "Blacklist a kernel module."
+
declare_resource(:file, "#{new_resource.unload_dir}/blacklist_#{new_resource.modname}.conf") do
content "blacklist #{new_resource.modname}"
notifies :run, "execute[update initramfs]"
@@ -72,8 +86,9 @@ class Chef
new_resource.run_action(:unload)
end
- # Load kernel module
action :load do
+ description "Load a kernel module."
+
unless module_loaded?
converge_by("load kernel module #{new_resource.modname}") do
shell_out!("modprobe #{new_resource.modname}")
@@ -81,8 +96,9 @@ class Chef
end
end
- # Unload kernel module
action :unload do
+ description "Unload kernel module"
+
if module_loaded?
converge_by("unload kernel module #{new_resource.modname}") do
shell_out!("modprobe -r #{new_resource.modname}")