summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2020-11-24 08:32:12 -0800
committerGitHub <noreply@github.com>2020-11-24 08:32:12 -0800
commitc30a07ca6e0851b9eede18c98e9a4989b0693c0e (patch)
tree235790bf59b98f6bd1f52b004f99ffc37071e2ea
parent81ee4dd334c763d6b419042b6c0fbdbc6ec0a6fb (diff)
parentc600ba4886fd5ab9af333f57ae95d5ed6a71164b (diff)
downloadchef-c30a07ca6e0851b9eede18c98e9a4989b0693c0e.tar.gz
Merge pull request #10671 from MsysTechnologiesllc/antima/fixes_for_aix_test_failure
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/chef/provider/mount.rb2
-rw-r--r--lib/chef/provider/mount/mount.rb2
-rw-r--r--spec/functional/resource/mount_spec.rb12
3 files changed, 12 insertions, 4 deletions
diff --git a/lib/chef/provider/mount.rb b/lib/chef/provider/mount.rb
index f8c71c6706..44fb94ca01 100644
--- a/lib/chef/provider/mount.rb
+++ b/lib/chef/provider/mount.rb
@@ -176,7 +176,7 @@ class Chef
# Returns the new_resource device as per device_type
def device_fstab
# Removed "/" from the end of str, because it was causing idempotency issue.
- device = @new_resource.device.chomp("/")
+ device = @new_resource.device == "/" ? @new_resource.device : @new_resource.device.chomp("/")
case @new_resource.device_type
when :device
device
diff --git a/lib/chef/provider/mount/mount.rb b/lib/chef/provider/mount/mount.rb
index 71cecb47aa..0bd81d5453 100644
--- a/lib/chef/provider/mount/mount.rb
+++ b/lib/chef/provider/mount/mount.rb
@@ -203,7 +203,7 @@ class Chef
end
end
# Removed "/" from the end of str, because it was causing idempotency issue.
- @real_device.chomp("/")
+ @real_device == "/" ? @real_device : @real_device.chomp("/")
end
def device_logstring
diff --git a/spec/functional/resource/mount_spec.rb b/spec/functional/resource/mount_spec.rb
index 55738a4326..f11f97d6c7 100644
--- a/spec/functional/resource/mount_spec.rb
+++ b/spec/functional/resource/mount_spec.rb
@@ -129,8 +129,9 @@ describe Chef::Resource::Mount, :requires_root, external: include_flag do
end
# Actual tests begin here.
- before(:all) do
+ before do |test|
@device, @fstype = setup_device_for_mount
+ @device = "/" if test.metadata[:skip_before]
@mount_point = Dir.mktmpdir("testmount")
@@ -145,13 +146,20 @@ describe Chef::Resource::Mount, :requires_root, external: include_flag do
end
after(:all) do
- Dir.rmdir(@mount_point)
+ Dir.rmdir(@mount_point) if @mount_point
end
after(:each) do
cleanup_mount(new_resource.mount_point)
end
+ describe "when device is '/'" do
+ it "should mount the filesystem if device is '/'", :skip_before do
+ new_resource.run_action(:mount)
+ mount_should_exist(new_resource.mount_point, new_resource.device)
+ end
+ end
+
describe "when the target state is a mounted filesystem" do
it "should mount the filesystem if it isn't mounted" do
expect(current_resource.enabled).to be_falsey