diff options
author | antima-gupta <agupta@msystechnologies.com> | 2020-09-30 16:54:43 +0530 |
---|---|---|
committer | antima-gupta <agupta@msystechnologies.com> | 2020-11-12 21:31:30 -0800 |
commit | 5951200470b3db0fd75b121db0fc08c3946eafe8 (patch) | |
tree | 52dbdd61f1e73bfeb33195ba2fdf727c5d170001 | |
parent | e263bbe44937bda779cba6322ceb0480b12508ca (diff) | |
download | chef-5951200470b3db0fd75b121db0fc08c3946eafe8.tar.gz |
Updated enabled? method to fix multiple entry issue in fstab.
Fixed test case failure.
Signed-off-by: antima-gupta <agupta@msystechnologies.com>
-rw-r--r-- | lib/chef/provider/mount/mount.rb | 4 | ||||
-rw-r--r-- | spec/unit/provider/mount/mount_spec.rb | 9 |
2 files changed, 0 insertions, 13 deletions
diff --git a/lib/chef/provider/mount/mount.rb b/lib/chef/provider/mount/mount.rb index e065ce09e5..ad3f74ebc8 100644 --- a/lib/chef/provider/mount/mount.rb +++ b/lib/chef/provider/mount/mount.rb @@ -70,10 +70,6 @@ class Chef @current_resource.dump($4.to_i) @current_resource.pass($5.to_i) logger.trace("Found mount #{device_fstab} to #{@new_resource.mount_point} in /etc/fstab") - next - when %r{^[/\w]+\s+#{Regexp.escape(@new_resource.mount_point)}\s+} - enabled = false - logger.trace("Found conflicting mount point #{@new_resource.mount_point} in /etc/fstab") end end @current_resource.enabled(enabled) diff --git a/spec/unit/provider/mount/mount_spec.rb b/spec/unit/provider/mount/mount_spec.rb index b84a07e9ce..2ac9d12f42 100644 --- a/spec/unit/provider/mount/mount_spec.rb +++ b/spec/unit/provider/mount/mount_spec.rb @@ -247,15 +247,6 @@ describe Chef::Provider::Mount::Mount do expect(@provider.current_resource.enabled).to be_falsey end - it "should set enabled to false if the mount point is not last in fstab" do - line_1 = "#{@new_resource.device} #{@new_resource.mount_point} ext3 defaults 1 2\n" - line_2 = "/dev/sdy1 #{@new_resource.mount_point} ext3 defaults 1 2\n" - allow(::File).to receive(:foreach).with("/etc/fstab").and_yield(line_1).and_yield(line_2) - - @provider.load_current_resource - expect(@provider.current_resource.enabled).to be_falsey - end - it "should not mangle the mount options if the device in fstab is a symlink" do # expand the target path to correct specs on Windows target = "/dev/mapper/target" |