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 11:42:53 -0700
commit0dce37c18e54823eb8728f1bc0cbdc10ecb449e7 (patch)
treed7b3f030eb3fa68d5be6214834dc186e8a3c9a79
parent0c44408bb35cbcd2497a340ce2bc39e643bcaf3e (diff)
downloadchef-0dce37c18e54823eb8728f1bc0cbdc10ecb449e7.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 591ff4b0a0..40211e4bbb 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