diff options
author | Tim Smith <tsmith@chef.io> | 2021-05-10 15:11:12 -0700 |
---|---|---|
committer | Tim Smith <tsmith@chef.io> | 2021-05-10 15:11:12 -0700 |
commit | c2626f889fd49891552bd9471d1f4c6ea0782f74 (patch) | |
tree | cb238f5e5d1794ee958349c0bab753fe9c032163 | |
parent | 9b2aefbea69540fd7e3999390b4a3dbada337e87 (diff) | |
download | chef-c2626f889fd49891552bd9471d1f4c6ea0782f74.tar.gz |
Revert "Kept a check in pattern matching for a mount of type loop"
This reverts commit 1d0ad75f33e74f1b9248f19c6f940deeaa3f5af7.
-rw-r--r-- | cspell.json | 1 | ||||
-rw-r--r-- | lib/chef/provider/mount/linux.rb | 8 | ||||
-rw-r--r-- | lib/chef/provider/mount/mount.rb | 5 | ||||
-rw-r--r-- | spec/unit/provider/mount/linux_spec.rb | 14 |
4 files changed, 1 insertions, 27 deletions
diff --git a/cspell.json b/cspell.json index 5e14fa0c4a..35f0bd8f24 100644 --- a/cspell.json +++ b/cspell.json @@ -837,7 +837,6 @@ "logstring", "LONGLONG", "loopback", - "losetup", "lowercased", "LOWORD", "lpar", diff --git a/lib/chef/provider/mount/linux.rb b/lib/chef/provider/mount/linux.rb index 6b07ec9d32..382e37d41a 100644 --- a/lib/chef/provider/mount/linux.rb +++ b/lib/chef/provider/mount/linux.rb @@ -45,14 +45,6 @@ class Chef when /\A#{Regexp.escape(real_mount_point)}\s+#{device_mount_regex}\s/ mounted = true logger.trace("Special device #{device_logstring} mounted as #{real_mount_point}") - # Permalink for loop type devices mount points https://rubular.com/r/a0bS4p2RvXsGxx - when %r{\A#{Regexp.escape(real_mount_point)}\s+\/dev\/loop+[0-9]+\s} - @loop_mount_points.each_line do |mount_point| - if mount_point.include? device_real - mounted = true - break - end - end # Permalink for multiple devices mounted to the same mount point(i.e. '/proc') https://rubular.com/r/a356yzspU7N9TY when %r{\A#{Regexp.escape(real_mount_point)}\s+([/\w])+\s} mounted = false diff --git a/lib/chef/provider/mount/mount.rb b/lib/chef/provider/mount/mount.rb index cd42c79aa8..802ee11c23 100644 --- a/lib/chef/provider/mount/mount.rb +++ b/lib/chef/provider/mount/mount.rb @@ -29,7 +29,6 @@ class Chef def initialize(new_resource, run_context) super @real_device = nil - initialize_loop_mounts end attr_accessor :real_device @@ -41,10 +40,6 @@ class Chef enabled? end - def initialize_loop_mounts - @loop_mount_points = shell_out!("losetup --list").stdout - end - def mountable? # only check for existence of non-remote devices if device_should_exist? && !::File.exists?(device_real) diff --git a/spec/unit/provider/mount/linux_spec.rb b/spec/unit/provider/mount/linux_spec.rb index 3e1ce1ace1..3e41f895d1 100644 --- a/spec/unit/provider/mount/linux_spec.rb +++ b/spec/unit/provider/mount/linux_spec.rb @@ -12,7 +12,7 @@ describe Chef::Provider::Mount::Linux do new_resource = Chef::Resource::Mount.new("/tmp/foo") new_resource.device "/dev/sdz1" new_resource.device_type :device - new_resource.fstype "ext3" + new_resource.fstype "ext3" new_resource.supports remount: false new_resource end @@ -104,16 +104,4 @@ describe Chef::Provider::Mount::Linux do end end - context "to check if loop resource is mounted" do - it "should set mounted true in case of loop resource" do - new_resource.options "loop" - mount = "/tmp/foo /dev/loop16 iso660 cifs ro\n" - losetup = "/dev/loop16 0 0 1 1 /dev/sdz1 \n" - allow(provider).to receive(:shell_out!).with("findmnt -rn").and_return(double(stdout: mount)) - allow(provider).to receive(:shell_out!).with("losetup --list").and_return(double(stdout: losetup)) - provider.load_current_resource - expect(provider.current_resource.mounted).to be_truthy - end - end - end |