summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Vlaardingerbroek <kristian.vlaardingerbroek@gmail.com>2013-02-11 21:33:13 +0100
committerBryan McLellan <btm@opscode.com>2013-04-12 11:49:11 -0700
commit99a2ddf0daed2e8dfddaa0b9090af0f0c833d302 (patch)
tree8688f75485e2b38b5d41693f07f320738b17caaf
parentf4b6168b6370647024a059036c8310e576258246 (diff)
downloadchef-99a2ddf0daed2e8dfddaa0b9090af0f0c833d302.tar.gz
Remove string interpolation and adjust comment
-rw-r--r--lib/chef/provider/mount/mount.rb3
-rw-r--r--spec/unit/provider/mount/mount_spec.rb8
2 files changed, 7 insertions, 4 deletions
diff --git a/lib/chef/provider/mount/mount.rb b/lib/chef/provider/mount/mount.rb
index 2e98b7a69c..280513cddc 100644
--- a/lib/chef/provider/mount/mount.rb
+++ b/lib/chef/provider/mount/mount.rb
@@ -226,6 +226,9 @@ class Chef
Regexp.escape(device_real)+"/?"
elsif ::File.symlink?(device_real)
# This regular expression tries to match device_real. If that does not match it will try to match the target of device_real.
+ # So given a symlink like this:
+ # /dev/mapper/vgroot-tmp.vol -> /dev/dm-9
+ # First it will try to match "/dev/mapper/vgroot-tmp.vol". If there is no match it will try matching for "/dev/dm-9".
"(?:#{Regexp.escape(device_real)}|#{Regexp.escape(::File.readlink(device_real))})"
else
Regexp.escape(device_real)
diff --git a/spec/unit/provider/mount/mount_spec.rb b/spec/unit/provider/mount/mount_spec.rb
index f6c6c1b7d4..1e52124343 100644
--- a/spec/unit/provider/mount/mount_spec.rb
+++ b/spec/unit/provider/mount/mount_spec.rb
@@ -221,8 +221,8 @@ describe Chef::Provider::Mount::Mount do
target = "/dev/mapper/target"
options = "rw,noexec,noauto"
- ::File.stub!(:symlink?).with("#{@new_resource.device}").and_return(true)
- ::File.stub!(:readlink).with("#{@new_resource.device}").and_return(target)
+ ::File.stub!(:symlink?).with(@new_resource.device).and_return(true)
+ ::File.stub!(:readlink).with(@new_resource.device).and_return(target)
fstab = "#{@new_resource.device} #{@new_resource.mount_point} #{@new_resource.fstype} #{options} 1 2\n"
::File.stub!(:foreach).with("/etc/fstab").and_yield fstab
@@ -234,8 +234,8 @@ describe Chef::Provider::Mount::Mount do
target = "/dev/mapper/target"
options = "rw,noexec,noauto"
- ::File.stub!(:symlink?).with("#{@new_resource.device}").and_return(true)
- ::File.stub!(:readlink).with("#{@new_resource.device}").and_return(target)
+ ::File.stub!(:symlink?).with(@new_resource.device).and_return(true)
+ ::File.stub!(:readlink).with(@new_resource.device).and_return(target)
fstab = "#{target} #{@new_resource.mount_point} #{@new_resource.fstype} #{options} 1 2\n"
::File.stub!(:foreach).with("/etc/fstab").and_yield fstab