diff options
Diffstat (limited to 'lib/chef/provider')
-rw-r--r-- | lib/chef/provider/user.rb | 12 | ||||
-rw-r--r-- | lib/chef/provider/user/dscl.rb | 6 | ||||
-rw-r--r-- | lib/chef/provider/user/linux.rb | 10 | ||||
-rw-r--r-- | lib/chef/provider/user/pw.rb | 6 | ||||
-rw-r--r-- | lib/chef/provider/user/solaris.rb | 4 | ||||
-rw-r--r-- | lib/chef/provider/user/useradd.rb | 10 |
6 files changed, 19 insertions, 29 deletions
diff --git a/lib/chef/provider/user.rb b/lib/chef/provider/user.rb index c44adbf818..43102e7dec 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-2016, Chef Software Inc. +# Copyright:: Copyright 2008-2017, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -205,16 +205,6 @@ class Chef def check_lock raise NotImplementedError end - - def non_unique? - # XXX: THIS GOES AWAY IN CHEF-13 AND BECOMES JUST new_resource.non_unique - new_resource.non_unique || new_resource.supports[:non_unique] - end - - def managing_home_dir? - # XXX: THIS GOES AWAY IN CHEF-13 AND BECOMES JUST new_resource.manage_home - new_resource.manage_home || new_resource.supports[:manage_home] - end end end end diff --git a/lib/chef/provider/user/dscl.rb b/lib/chef/provider/user/dscl.rb index 2302a874e2..60167856d1 100644 --- a/lib/chef/provider/user/dscl.rb +++ b/lib/chef/provider/user/dscl.rb @@ -1,6 +1,6 @@ # # Author:: Dreamcat4 (<dreamcat4@gmail.com>) -# Copyright:: Copyright 2009-2016, Chef Software Inc. +# Copyright:: Copyright 2009-2017, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -297,7 +297,7 @@ user password using shadow hash.") return end - if managing_home_dir? + if new_resource.manage_home validate_home_dir_specification! if (current_resource.home == new_resource.home) && !new_home_exists? @@ -442,7 +442,7 @@ user password using shadow hash.") # and deleting home directory if needed. # def remove_user - if managing_home_dir? + if new_resource.manage_home # Remove home directory FileUtils.rm_rf(current_resource.home) end diff --git a/lib/chef/provider/user/linux.rb b/lib/chef/provider/user/linux.rb index 445421ad38..cf75bdc38b 100644 --- a/lib/chef/provider/user/linux.rb +++ b/lib/chef/provider/user/linux.rb @@ -1,5 +1,5 @@ # -# Copyright:: Copyright 2016, Chef Software Inc. +# Copyright:: Copyright 2016-2017, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -52,14 +52,14 @@ class Chef opts << "-s" << new_resource.shell if should_set?(:shell) opts << "-u" << new_resource.uid if should_set?(:uid) opts << "-d" << new_resource.home if updating_home? - opts << "-o" if non_unique? + opts << "-o" if new_resource.non_unique opts end def usermod_options opts = [] if updating_home? - if managing_home_dir? + if new_resource.manage_home opts << "-m" end end @@ -69,7 +69,7 @@ class Chef def useradd_options opts = [] opts << "-r" if new_resource.system - opts << if managing_home_dir? + opts << if new_resource.manage_home "-m" else "-M" @@ -79,7 +79,7 @@ class Chef def userdel_options opts = [] - opts << "-r" if managing_home_dir? + opts << "-r" if new_resource.manage_home opts << "-f" if new_resource.force opts end diff --git a/lib/chef/provider/user/pw.rb b/lib/chef/provider/user/pw.rb index 42d862a983..cf47bb7fde 100644 --- a/lib/chef/provider/user/pw.rb +++ b/lib/chef/provider/user/pw.rb @@ -1,6 +1,6 @@ # # Author:: Stephen Haynes (<sh@nomitor.com>) -# Copyright:: Copyright 2009-2016, Chef Software Inc. +# Copyright:: Copyright 2009-2017, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -42,7 +42,7 @@ class Chef def remove_user command = [ "pw", "userdel", new_resource.username ] - command << "-r" if managing_home_dir? + command << "-r" if new_resource.manage_home shell_out_compact!(command) end @@ -83,7 +83,7 @@ class Chef opts << new_resource.send(field_symbol) end end - if managing_home_dir? + if new_resource.manage_home Chef::Log.debug("#{new_resource} is managing the users home directory") opts << "-m" end diff --git a/lib/chef/provider/user/solaris.rb b/lib/chef/provider/user/solaris.rb index 4e772312ae..25ec13fe5c 100644 --- a/lib/chef/provider/user/solaris.rb +++ b/lib/chef/provider/user/solaris.rb @@ -2,7 +2,7 @@ # Author:: Stephen Nelson-Smith (<sns@chef.io>) # Author:: Jon Ramsey (<jonathon.ramsey@gmail.com>) # Author:: Dave Eddy (<dave@daveeddy.com>) -# Copyright:: Copyright 2012-2016, Chef Software Inc. +# Copyright:: Copyright 2012-2017, Chef Software Inc. # Copyright:: Copyright 2015-2016, Dave Eddy # License:: Apache License, Version 2.0 # @@ -77,7 +77,7 @@ class Chef # @return [Array<String>] def useradd_options opts = [] - opts << "-m" if managing_home_dir? + opts << "-m" if new_resource.manage_home opts end diff --git a/lib/chef/provider/user/useradd.rb b/lib/chef/provider/user/useradd.rb index cf6f4e727f..0a32126903 100644 --- a/lib/chef/provider/user/useradd.rb +++ b/lib/chef/provider/user/useradd.rb @@ -1,6 +1,6 @@ # # Author:: Adam Jacob (<adam@chef.io>) -# Copyright:: Copyright 2008-2016, Chef Software Inc. +# Copyright:: Copyright 2008-2017, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -46,7 +46,7 @@ class Chef def remove_user command = [ "userdel" ] - command << "-r" if managing_home_dir? + command << "-r" if new_resource.manage_home command << "-f" if new_resource.force command << new_resource.username shell_out_compact!(command) @@ -117,14 +117,14 @@ class Chef end if updating_home? opts << "-d" << new_resource.home - if managing_home_dir? + if new_resource.manage_home Chef::Log.debug("#{new_resource} managing the users home directory") opts << "-m" else Chef::Log.debug("#{new_resource} setting home to #{new_resource.home}") end end - opts << "-o" if non_unique? + opts << "-o" if new_resource.non_unique opts end end @@ -139,7 +139,7 @@ class Chef def useradd_options opts = [] opts << "-r" if new_resource.system - opts << "-M" unless managing_home_dir? + opts << "-M" unless new_resource.manage_home opts end |