diff options
author | Bryan McLellan <btm@opscode.com> | 2013-04-12 12:01:15 -0700 |
---|---|---|
committer | Bryan McLellan <btm@opscode.com> | 2013-04-12 12:01:15 -0700 |
commit | ee797aed9ad3a6ca0c5a58ee73d6326ce627d5bb (patch) | |
tree | f3f3bd92602921c9b0dd4452e26b78794c8d52ed | |
parent | f052f8affdc370d640382fc5b2e5f7ea112c1600 (diff) | |
parent | 5edd16f8dfff419e9a4c5ac3b077ae2680e2e939 (diff) | |
download | chef-ee797aed9ad3a6ca0c5a58ee73d6326ce627d5bb.tar.gz |
Merge branch 'CHEF-3803'
-rw-r--r-- | lib/chef/provider/mount.rb | 2 | ||||
-rw-r--r-- | spec/unit/provider/mount_spec.rb | 16 |
2 files changed, 14 insertions, 4 deletions
diff --git a/lib/chef/provider/mount.rb b/lib/chef/provider/mount.rb index fe41997d39..6b9dd91ac8 100644 --- a/lib/chef/provider/mount.rb +++ b/lib/chef/provider/mount.rb @@ -79,7 +79,7 @@ class Chef end def action_enable - unless @current_resource.enabled + unless @current_resource.enabled && mount_options_unchanged? converge_by("remount #{@current_resource.device}") do status = enable_fs if status diff --git a/spec/unit/provider/mount_spec.rb b/spec/unit/provider/mount_spec.rb index ca69db3c4b..1a98f10cb0 100644 --- a/spec/unit/provider/mount_spec.rb +++ b/spec/unit/provider/mount_spec.rb @@ -108,14 +108,24 @@ describe Chef::Provider::Mount do describe "when enabling the filesystem to be mounted" do it "should enable the mount if it isn't enable" do @current_resource.stub!(:enabled).and_return(false) - @provider.should_receive(:enable_fs).with.and_return(true) + @provider.should_not_receive(:mount_options_unchanged?) + @provider.should_receive(:enable_fs).and_return(true) @provider.run_action(:enable) @new_resource.should be_updated_by_last_action end - it "should not enable the mount if it is enabled" do + it "should enable the mount if it is enabled and mount options have changed" do @current_resource.stub!(:enabled).and_return(true) - @provider.should_not_receive(:enable_fs) + @provider.should_receive(:mount_options_unchanged?).and_return(false) + @provider.should_receive(:enable_fs).and_return(true) + @provider.run_action(:enable) + @new_resource.should be_updated_by_last_action + end + + it "should not enable the mount if it is enabled and mount options have not changed" do + @current_resource.stub!(:enabled).and_return(true) + @provider.should_receive(:mount_options_unchanged?).and_return(true) + @provider.should_not_receive(:enable_fs).and_return(true) @provider.run_action(:enable) @new_resource.should_not be_updated_by_last_action end |