summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/provider/mount/linux.rb5
-rw-r--r--lib/chef/provider/mount/mount.rb8
2 files changed, 13 insertions, 0 deletions
diff --git a/lib/chef/provider/mount/linux.rb b/lib/chef/provider/mount/linux.rb
index 83fbfab957..899053b613 100644
--- a/lib/chef/provider/mount/linux.rb
+++ b/lib/chef/provider/mount/linux.rb
@@ -71,6 +71,11 @@ class Chef
when /\A#{Regexp.escape(real_mount_point)}\s+#{device_mount_regex}\[/
mounted = true
logger.trace("Network device #{device_logstring} mounted as #{real_mount_point}")
+ # Permalink for network device mounted with a space in device name https://rubular.com/r/CK5zWWms96CRES
+ # See the comment in "device_with_space_escape" for an explanation what's going here.
+ when /\A#{Regexp.escape(real_mount_point)}\s+#{device_with_space_escape}\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 2bc9d2c78f..6b062d1225 100644
--- a/lib/chef/provider/mount/mount.rb
+++ b/lib/chef/provider/mount/mount.rb
@@ -217,6 +217,14 @@ class Chef
end
end
+ def device_with_space_escape
+ # For CIFS (and perhaps other remote network mounts) when a space is in the "device name"
+ # it will appear with the space substituted with a special character. However, when mounting,
+ # the mount needs to be done with an actual space. This function provides the device name with
+ # the special character to determine if the device is mounted.
+ device_mount_regex.gsub(" ", "\\x20")
+ end
+
def device_mount_regex
if network_device?
# ignore trailing slash