diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2018-05-10 13:58:45 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2018-05-10 13:58:45 -0700 |
commit | 8f5a6701c590abf01525e3ca64ed90f3adce497c (patch) | |
tree | 24c56d735937093d72ff47eb5130a78c133e2395 | |
parent | 79f5a8502787ba19ea8872349bc4b167d7abb900 (diff) | |
download | chef-8f5a6701c590abf01525e3ca64ed90f3adce497c.tar.gz |
move should_set? to superclass
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r-- | lib/chef/provider/user.rb | 7 | ||||
-rw-r--r-- | lib/chef/provider/user/aix.rb | 4 | ||||
-rw-r--r-- | lib/chef/provider/user/linux.rb | 4 | ||||
-rw-r--r-- | lib/chef/provider/user/solaris.rb | 5 |
4 files changed, 6 insertions, 14 deletions
diff --git a/lib/chef/provider/user.rb b/lib/chef/provider/user.rb index 18cf2d4d99..b27839bbcf 100644 --- a/lib/chef/provider/user.rb +++ b/lib/chef/provider/user.rb @@ -1,6 +1,6 @@ # # Author:: Adam Jacob (<adam@chef.io>) -# Copyright:: Copyright 2008-2017, Chef Software Inc. +# Copyright:: Copyright 2008-2018, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -199,6 +199,11 @@ class Chef def check_lock raise NotImplementedError end + + # helper used by e.g. linux, aix, solaris providers + def should_set?(sym) + current_resource.send(sym).to_s != new_resource.send(sym).to_s && new_resource.send(sym) + end end end end diff --git a/lib/chef/provider/user/aix.rb b/lib/chef/provider/user/aix.rb index 351d603c93..e89e56d90b 100644 --- a/lib/chef/provider/user/aix.rb +++ b/lib/chef/provider/user/aix.rb @@ -103,10 +103,6 @@ class Chef opts end - def should_set?(sym) - current_resource.send(sym).to_s != new_resource.send(sym).to_s && new_resource.send(sym) - end - # FIXME: move to superclass, and one of these implements must be buggy? def updating_home? return true if current_resource.home.nil? && new_resource.home diff --git a/lib/chef/provider/user/linux.rb b/lib/chef/provider/user/linux.rb index 07df198ae2..3aac717242 100644 --- a/lib/chef/provider/user/linux.rb +++ b/lib/chef/provider/user/linux.rb @@ -85,10 +85,6 @@ class Chef opts end - def should_set?(sym) - current_resource.send(sym).to_s != new_resource.send(sym).to_s && new_resource.send(sym) - end - # FIXME: move to superclass, and one of these implementations must be buggy? def updating_home? return false unless new_resource.home diff --git a/lib/chef/provider/user/solaris.rb b/lib/chef/provider/user/solaris.rb index 494b10237a..a635899505 100644 --- a/lib/chef/provider/user/solaris.rb +++ b/lib/chef/provider/user/solaris.rb @@ -119,11 +119,6 @@ class Chef new_resource.home && Pathname.new(current_resource.home).cleanpath != Pathname.new(new_resource.home).cleanpath end - # FIXME: move to superclass - def should_set?(sym) - current_resource.send(sym).to_s != new_resource.send(sym).to_s && new_resource.send(sym) - end - def manage_password return unless current_resource.password != new_resource.password && new_resource.password logger.trace("#{new_resource} setting password to #{new_resource.password}") |