summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLance Albertson <lance@osuosl.org>2021-03-29 11:42:53 -0700
committerLance Albertson <lance@osuosl.org>2021-03-29 17:29:16 -0700
commitdb941bf50aa35c64ede1b731f0368a760885985a (patch)
tree4260ec12d3dee4ad742a7ace5077ff535b60766b
parenta0ecc1fea80f1e8fe0170442e86478953f93a4b5 (diff)
downloadchef-db941bf50aa35c64ede1b731f0368a760885985a.tar.gz
Fix idempotency issues with network mounts
Resolves #11255 This is basically a continuation of #11031 where I fixed it in one place but then created a regression with idempotency as noted in #11255. This ensures that the /etc/fstab file actually gets the output we expect with network mounts using a root device. Signed-off-by: Lance Albertson <lance@osuosl.org>
-rw-r--r--lib/chef/provider/mount.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/chef/provider/mount.rb b/lib/chef/provider/mount.rb
index 44fb94ca01..954bc442f3 100644
--- a/lib/chef/provider/mount.rb
+++ b/lib/chef/provider/mount.rb
@@ -176,7 +176,12 @@ 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 issue.
- device = @new_resource.device == "/" ? @new_resource.device : @new_resource.device.chomp("/")
+ device =
+ if @new_resource.device == "/" || @new_resource.device.match?(":/$")
+ @new_resource.device
+ else
+ @new_resource.device.chomp("/")
+ end
case @new_resource.device_type
when :device
device