diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2017-02-26 15:53:22 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2017-02-28 11:19:49 -0800 |
commit | 80547d21f52630d65a321975a6b9d19d9f2f49f4 (patch) | |
tree | 7e21d9e64025caa17325a5758b6570afa36044d6 /lib/chef | |
parent | f539a7f985c9c7f92b6197b883d8f6c201cf70e8 (diff) | |
download | chef-80547d21f52630d65a321975a6b9d19d9f2f49f4.tar.gz |
Chef-13: Remove supports API from all user providers
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef')
-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 | ||||
-rw-r--r-- | lib/chef/resource/user.rb | 18 | ||||
-rw-r--r-- | lib/chef/resource/user/aix_user.rb | 2 | ||||
-rw-r--r-- | lib/chef/resource/user/dscl_user.rb | 2 | ||||
-rw-r--r-- | lib/chef/resource/user/linux_user.rb | 11 | ||||
-rw-r--r-- | lib/chef/resource/user/pw_user.rb | 2 | ||||
-rw-r--r-- | lib/chef/resource/user/solaris_user.rb | 2 | ||||
-rw-r--r-- | lib/chef/resource/user/windows_user.rb | 2 |
13 files changed, 27 insertions, 60 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 diff --git a/lib/chef/resource/user.rb b/lib/chef/resource/user.rb index fc7720bc25..288335a599 100644 --- a/lib/chef/resource/user.rb +++ b/lib/chef/resource/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"); @@ -42,10 +42,6 @@ class Chef @manage_home = false @force = false @non_unique = false - @supports = { - manage_home: false, - non_unique: false, - } @iterations = 27855 @salt = nil end @@ -157,17 +153,7 @@ class Chef end def supports(args = {}) - if args.key?(:manage_home) - Chef.deprecated(:supports_property, "supports { manage_home: #{args[:manage_home]} } on the user resource is deprecated and will be removed in Chef 13, set manage_home #{args[:manage_home]} instead") - end - if args.key?(:non_unique) - Chef.deprecated(:supports_property, "supports { non_unique: #{args[:non_unique]} } on the user resource is deprecated and will be removed in Chef 13, set non_unique #{args[:non_unique]} instead") - end - super - end - - def supports=(args) - supports(args) + raise Chef::Exceptions::User, "calling supports on a user resource is no longer supported in Chef-13, you probably need to use the manage_home or non_unique properties directly" end end end diff --git a/lib/chef/resource/user/aix_user.rb b/lib/chef/resource/user/aix_user.rb index 7c07db2e25..d5f1829b63 100644 --- a/lib/chef/resource/user/aix_user.rb +++ b/lib/chef/resource/user/aix_user.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"); diff --git a/lib/chef/resource/user/dscl_user.rb b/lib/chef/resource/user/dscl_user.rb index 61517d8b44..6eb1c953f4 100644 --- a/lib/chef/resource/user/dscl_user.rb +++ b/lib/chef/resource/user/dscl_user.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"); diff --git a/lib/chef/resource/user/linux_user.rb b/lib/chef/resource/user/linux_user.rb index ec60ac89bf..056a421197 100644 --- a/lib/chef/resource/user/linux_user.rb +++ b/lib/chef/resource/user/linux_user.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"); @@ -26,15 +26,6 @@ class Chef provides :linux_user provides :user, os: "linux" - def initialize(name, run_context = nil) - super - @supports = { - manage_home: false, - non_unique: false, - } - @manage_home = false - end - end end end diff --git a/lib/chef/resource/user/pw_user.rb b/lib/chef/resource/user/pw_user.rb index 873be19d59..3672943f5c 100644 --- a/lib/chef/resource/user/pw_user.rb +++ b/lib/chef/resource/user/pw_user.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"); diff --git a/lib/chef/resource/user/solaris_user.rb b/lib/chef/resource/user/solaris_user.rb index bb897228b9..cca90e6743 100644 --- a/lib/chef/resource/user/solaris_user.rb +++ b/lib/chef/resource/user/solaris_user.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"); diff --git a/lib/chef/resource/user/windows_user.rb b/lib/chef/resource/user/windows_user.rb index d1a249fb50..baedc14f5e 100644 --- a/lib/chef/resource/user/windows_user.rb +++ b/lib/chef/resource/user/windows_user.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"); |