summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--RELEASE_NOTES.md9
-rw-r--r--lib/chef/provider/mount.rb2
-rw-r--r--lib/chef/resource/mount.rb2
-rw-r--r--spec/unit/provider/mount_spec.rb7
-rw-r--r--spec/unit/resource/mount_spec.rb3
5 files changed, 21 insertions, 2 deletions
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index 56191bae74..71161cb3da 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -29,4 +29,13 @@ _This file holds "in progress" release notes for the current release under devel
end
```
+- Alias `unmount` to `umount` for mount resource
+Example:
+
+ ```ruby
+ mount '/mount/tmp' do
+ action :unmount
+ end
+ ```
+
## Highlighted bug fixes for this release:
diff --git a/lib/chef/provider/mount.rb b/lib/chef/provider/mount.rb
index 9e9ee29bde..5168c93348 100644
--- a/lib/chef/provider/mount.rb
+++ b/lib/chef/provider/mount.rb
@@ -108,6 +108,8 @@ class Chef
end
end
+ alias :action_unmount :action_umount
+
#
# Abstract Methods to be implemented by subclasses
#
diff --git a/lib/chef/resource/mount.rb b/lib/chef/resource/mount.rb
index 2d85b3897c..3e35325246 100644
--- a/lib/chef/resource/mount.rb
+++ b/lib/chef/resource/mount.rb
@@ -28,7 +28,7 @@ class Chef
state_attrs :mount_point, :device_type, :fstype, :username, :password, :domain
default_action :mount
- allowed_actions :mount, :umount, :remount, :enable, :disable
+ allowed_actions :mount, :umount, :unmount, :remount, :enable, :disable
def initialize(name, run_context = nil)
super
diff --git a/spec/unit/provider/mount_spec.rb b/spec/unit/provider/mount_spec.rb
index 19967e8496..b2497cf1b2 100644
--- a/spec/unit/provider/mount_spec.rb
+++ b/spec/unit/provider/mount_spec.rb
@@ -70,6 +70,13 @@ describe Chef::Provider::Mount do
expect(new_resource).to be_updated_by_last_action
end
+ it "should unmount the filesystem if it is mounted" do
+ allow(current_resource).to receive(:mounted).and_return(true)
+ expect(provider).to receive(:umount_fs).and_return(true)
+ provider.run_action(:unmount)
+ expect(new_resource).to be_updated_by_last_action
+ end
+
it "should not umount the filesystem if it is not mounted" do
allow(current_resource).to receive(:mounted).and_return(false)
expect(provider).not_to receive(:umount_fs)
diff --git a/spec/unit/resource/mount_spec.rb b/spec/unit/resource/mount_spec.rb
index 188eaa67d6..832f7644ac 100644
--- a/spec/unit/resource/mount_spec.rb
+++ b/spec/unit/resource/mount_spec.rb
@@ -41,9 +41,10 @@ describe Chef::Resource::Mount do
expect(@resource.action).to eql([:mount])
end
- it "should accept mount, umount and remount as actions" do
+ it "should accept mount, umount, unmount and remount as actions" do
expect { @resource.action :mount }.not_to raise_error
expect { @resource.action :umount }.not_to raise_error
+ expect { @resource.action :unmount }.not_to raise_error
expect { @resource.action :remount }.not_to raise_error
expect { @resource.action :brooklyn }.to raise_error(ArgumentError)
end