summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Doherty <cdoherty@chef.io>2016-03-31 11:37:41 -0700
committerChris Doherty <cdoherty@chef.io>2016-03-31 12:32:55 -0700
commitc8f525400113b5df7b2100e2cec52df75d084121 (patch)
tree66fafb240abc16b310f1d3a922877a9280dfe7f4
parentd1ae67938a6e02db9f122ce646d62b7b8347f6a3 (diff)
downloadchef-cd/mount-remount-options.tar.gz
Revert PR #1796.cd/mount-remount-options
Closes issue #4056, although as discussed in that issue, we still need followup design and implementation work to make the mount resource behave in a safe and unsurprising way.
-rw-r--r--lib/chef/provider/mount.rb10
-rw-r--r--spec/unit/provider/mount/aix_spec.rb3
-rw-r--r--spec/unit/provider/mount/mount_spec.rb6
-rw-r--r--spec/unit/provider/mount/windows_spec.rb14
-rw-r--r--spec/unit/provider/mount_spec.rb19
5 files changed, 4 insertions, 48 deletions
diff --git a/lib/chef/provider/mount.rb b/lib/chef/provider/mount.rb
index cc4a548ac1..9e9ee29bde 100644
--- a/lib/chef/provider/mount.rb
+++ b/lib/chef/provider/mount.rb
@@ -42,17 +42,13 @@ class Chef
end
def action_mount
- if current_resource.mounted
- if mount_options_unchanged?
- Chef::Log.debug("#{new_resource} is already mounted")
- else
- action_remount
- end
- else
+ unless current_resource.mounted
converge_by("mount #{current_resource.device} to #{current_resource.mount_point}") do
mount_fs
Chef::Log.info("#{new_resource} mounted")
end
+ else
+ Chef::Log.debug("#{new_resource} is already mounted")
end
end
diff --git a/spec/unit/provider/mount/aix_spec.rb b/spec/unit/provider/mount/aix_spec.rb
index 9a34a6d21d..3371c270c5 100644
--- a/spec/unit/provider/mount/aix_spec.rb
+++ b/spec/unit/provider/mount/aix_spec.rb
@@ -126,10 +126,9 @@ ENABLED
@provider.run_action(:mount)
end
- it "should not mount resource if it is already mounted and the options have not changed" do
+ it "should not mount resource if it is already mounted" do
stub_mounted_enabled(@provider, @mounted_output, "")
- allow(@provider).to receive(:mount_options_unchanged?).and_return(true)
expect(@provider).not_to receive(:mount_fs)
@provider.run_action(:mount)
diff --git a/spec/unit/provider/mount/mount_spec.rb b/spec/unit/provider/mount/mount_spec.rb
index 52be15b2a8..42585d9e3e 100644
--- a/spec/unit/provider/mount/mount_spec.rb
+++ b/spec/unit/provider/mount/mount_spec.rb
@@ -323,12 +323,6 @@ describe Chef::Provider::Mount::Mount do
@provider.mount_fs()
end
- it "should not mount the filesystem if it is mounted and the options have not changed" do
- allow(@current_resource).to receive(:mounted).and_return(true)
- expect(@provider).to_not receive(:shell_out!)
- @provider.mount_fs()
- end
-
end
describe "umount_fs" do
diff --git a/spec/unit/provider/mount/windows_spec.rb b/spec/unit/provider/mount/windows_spec.rb
index ec1945de50..fdb44836b5 100644
--- a/spec/unit/provider/mount/windows_spec.rb
+++ b/spec/unit/provider/mount/windows_spec.rb
@@ -112,14 +112,6 @@ describe Chef::Provider::Mount::Windows do
@provider.mount_fs
end
- it "should remount the filesystem if it is mounted and the options have changed" do
- expect(@vol).to receive(:add).with(:remote => @new_resource.device,
- :username => @new_resource.username,
- :domainname => @new_resource.domain,
- :password => @new_resource.password)
- @provider.mount_fs
- end
-
context "mount_options_unchanged?" do
it "should return true if mounted device is the same" do
allow(@current_resource).to receive(:device).and_return(GUID)
@@ -131,12 +123,6 @@ describe Chef::Provider::Mount::Windows do
expect(@provider.send :mount_options_unchanged?).to be false
end
end
-
- it "should not mount the filesystem if it is mounted and the options have not changed" do
- expect(@vol).to_not receive(:add)
- allow(@current_resource).to receive(:mounted).and_return(true)
- @provider.mount_fs
- end
end
describe "when unmounting a file system" do
diff --git a/spec/unit/provider/mount_spec.rb b/spec/unit/provider/mount_spec.rb
index fa168e571e..19967e8496 100644
--- a/spec/unit/provider/mount_spec.rb
+++ b/spec/unit/provider/mount_spec.rb
@@ -60,25 +60,6 @@ describe Chef::Provider::Mount do
provider.run_action(:mount)
expect(new_resource).to be_updated_by_last_action
end
-
- it "should remount the filesystem if it is mounted and the options have changed" do
- allow(current_resource).to receive(:mounted).and_return(true)
- allow(provider).to receive(:mount_options_unchanged?).and_return(false)
- expect(provider).to receive(:umount_fs).and_return(true)
- expect(provider).to receive(:wait_until_unmounted)
- expect(provider).to receive(:mount_fs).and_return(true)
- provider.run_action(:mount)
- expect(new_resource).to be_updated_by_last_action
- end
-
- it "should not mount the filesystem if it is mounted and the options have not changed" do
- allow(current_resource).to receive(:mounted).and_return(true)
- expect(provider).to receive(:mount_options_unchanged?).and_return(true)
- expect(provider).not_to receive(:mount_fs)
- provider.run_action(:mount)
- expect(new_resource).not_to be_updated_by_last_action
- end
-
end
describe "when the target state is an unmounted filesystem" do