summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2021-02-04 16:55:17 -0800
committerTim Smith <tsmith84@gmail.com>2021-02-04 18:58:56 -0800
commitff38b4035f15e22149c467e9f108154e5c1d2eef (patch)
treed3941a073430966ffb1cf3d191c7a7fbfe27f39a
parent273f25770d74394fa9789c2e018b070e802efe0d (diff)
downloadchef-ff38b4035f15e22149c467e9f108154e5c1d2eef.tar.gz
Extend the reboot_pending? helper to all debian-ish platforms
This works on Debian as well and we want to check it on all Ubuntu-derivatives. Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/chef/dsl/reboot_pending.rb3
-rw-r--r--lib/chef/resource/user_ulimit.rb2
-rw-r--r--spec/unit/dsl/reboot_pending_spec.rb4
3 files changed, 4 insertions, 5 deletions
diff --git a/lib/chef/dsl/reboot_pending.rb b/lib/chef/dsl/reboot_pending.rb
index 5a6f8ee219..e115d5441d 100644
--- a/lib/chef/dsl/reboot_pending.rb
+++ b/lib/chef/dsl/reboot_pending.rb
@@ -45,8 +45,7 @@ class Chef
# Vista + Server 2008 and newer may have reboots pending from CBS
registry_key_exists?('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending')
- elsif platform?("ubuntu")
- # This should work for Debian as well if update-notifier-common happens to be installed. We need an API for that.
+ elsif platform_family?("debian")
File.exist?("/var/run/reboot-required")
else
false
diff --git a/lib/chef/resource/user_ulimit.rb b/lib/chef/resource/user_ulimit.rb
index 8679161693..f004bb1aa2 100644
--- a/lib/chef/resource/user_ulimit.rb
+++ b/lib/chef/resource/user_ulimit.rb
@@ -106,7 +106,7 @@ class Chef
end
end
- action :delete, description: "Delete an existing ulimit configuration file" do
+ action :delete, description: "Delete an existing ulimit configuration file" do
file "/etc/security/limits.d/#{new_resource.filename}" do
action :delete
end
diff --git a/spec/unit/dsl/reboot_pending_spec.rb b/spec/unit/dsl/reboot_pending_spec.rb
index 3ad1be9e38..90945c3b80 100644
--- a/spec/unit/dsl/reboot_pending_spec.rb
+++ b/spec/unit/dsl/reboot_pending_spec.rb
@@ -51,9 +51,9 @@ describe Chef::DSL::RebootPending do
end
end
- context "platform is ubuntu" do
+ context "platform_family is debian" do
before do
- allow(recipe).to receive(:platform?).with("ubuntu").and_return(true)
+ allow(recipe).to receive(:platform_family?).with("debian").and_return(true)
end
it "should return true if /var/run/reboot-required exists" do