summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/chef/provider/mount.rb8
-rw-r--r--lib/chef/provider/mount/linux.rb4
-rw-r--r--lib/chef/provider/mount/mount.rb3
-rw-r--r--spec/unit/provider/mount/linux_spec.rb10
4 files changed, 4 insertions, 21 deletions
diff --git a/lib/chef/provider/mount.rb b/lib/chef/provider/mount.rb
index e4592a810d..64c7bc3f29 100644
--- a/lib/chef/provider/mount.rb
+++ b/lib/chef/provider/mount.rb
@@ -175,15 +175,13 @@ 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 issues
- device = @new_resource.device.chomp("/")
case @new_resource.device_type
when :device
- device
+ @new_resource.device
when :label
- "LABEL=#{device}"
+ "LABEL=#{@new_resource.device}"
when :uuid
- "UUID=#{device}"
+ "UUID=#{@new_resource.device}"
end
end
end
diff --git a/lib/chef/provider/mount/linux.rb b/lib/chef/provider/mount/linux.rb
index bd1844e717..3199024f1b 100644
--- a/lib/chef/provider/mount/linux.rb
+++ b/lib/chef/provider/mount/linux.rb
@@ -53,10 +53,6 @@ class Chef
when %r{\A#{Regexp.escape(real_mount_point)}\s+([/\w])+\[#{device_mount_regex}\]\s}
mounted = true
logger.trace("Bind device #{device_logstring} mounted as #{real_mount_point}")
- # Permalink for network device mounted to an existing mount point: https://rubular.com/r/HicK63SqchPLvk
- when %r{\A#{Regexp.escape(real_mount_point)}\s+#{device_mount_regex}\[([\/\w])+\]\s}
- mounted = true
- logger.trace("Network device #{device_logstring} mounted as #{real_mount_point}")
end
end
@current_resource.mounted(mounted)
diff --git a/lib/chef/provider/mount/mount.rb b/lib/chef/provider/mount/mount.rb
index 71cecb47aa..c9b7f95c6c 100644
--- a/lib/chef/provider/mount/mount.rb
+++ b/lib/chef/provider/mount/mount.rb
@@ -202,8 +202,7 @@ class Chef
@real_device = device_line.chomp unless device_line.nil?
end
end
- # Removed "/" from the end of str, because it was causing idempotency issue.
- @real_device.chomp("/")
+ @real_device
end
def device_logstring
diff --git a/spec/unit/provider/mount/linux_spec.rb b/spec/unit/provider/mount/linux_spec.rb
index 3e41f895d1..1141175780 100644
--- a/spec/unit/provider/mount/linux_spec.rb
+++ b/spec/unit/provider/mount/linux_spec.rb
@@ -24,7 +24,6 @@ describe Chef::Provider::Mount::Linux do
before(:each) do
allow(::File).to receive(:exists?).with("/dev/sdz1").and_return true
allow(::File).to receive(:exists?).with("/tmp/foo").and_return true
- allow(::File).to receive(:exists?).with("//192.168.11.102/Share/backup").and_return true
allow(::File).to receive(:realpath).with("/dev/sdz1").and_return "/dev/sdz1"
allow(::File).to receive(:realpath).with("/tmp/foo").and_return "/tmp/foo"
end
@@ -93,15 +92,6 @@ describe Chef::Provider::Mount::Linux do
expect(provider.current_resource.mounted).to be_falsey
end
- it "should set mounted true if network_device? is true and the mount point is found in the mounts list" do
- new_resource.device "//192.168.11.102/Share/backup"
- new_resource.fstype "cifs"
- mount = "/tmp/foo //192.168.11.102/Share/backup[/backup] cifs rw\n"
- mount << "#{new_resource.mount_point} #{new_resource.device} type #{new_resource.fstype}\n"
- allow(provider).to receive(:shell_out!).and_return(double(stdout: mount))
- provider.load_current_resource
- expect(provider.current_resource.mounted).to be_truthy
- end
end
end