summaryrefslogtreecommitdiff
path: root/lib/chef/provider/user.rb
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2018-05-10 15:35:11 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2018-05-10 15:35:11 -0700
commitb3a1cc9165904e6be09b8a62065e9289a905bfb4 (patch)
tree9810a8e7f2b763b7fc765683de5c8f2116371396 /lib/chef/provider/user.rb
parentb584400b5f7b7e315e9602937c4803d453bad3ab (diff)
downloadchef-b3a1cc9165904e6be09b8a62065e9289a905bfb4.tar.gz
clean up updating_home?lcg/cleanup-user
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef/provider/user.rb')
-rw-r--r--lib/chef/provider/user.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/chef/provider/user.rb b/lib/chef/provider/user.rb
index b27839bbcf..7145045785 100644
--- a/lib/chef/provider/user.rb
+++ b/lib/chef/provider/user.rb
@@ -200,10 +200,22 @@ class Chef
raise NotImplementedError
end
- # helper used by e.g. linux, aix, solaris providers
+ private
+
+ #
+ # helpers for subclasses
+ #
+
def should_set?(sym)
current_resource.send(sym).to_s != new_resource.send(sym).to_s && new_resource.send(sym)
end
+
+ def updating_home?
+ return false if new_resource.home.nil?
+ return true if current_resource.home.nil?
+ # Pathname#cleanpath matches more edge conditions than File.expand_path()
+ new_resource.home && Pathname.new(current_resource.home).cleanpath != Pathname.new(new_resource.home).cleanpath
+ end
end
end
end