diff options
author | Tim Smith <tsmith@chef.io> | 2018-05-30 21:10:08 -0700 |
---|---|---|
committer | Tim Smith <tsmith@chef.io> | 2018-11-04 10:52:13 -0800 |
commit | 1316abc8f82f53aac6fbb28e81fd9a0c47155ea8 (patch) | |
tree | 904b178de62664bac572ded3ad8c00026a902e2b /lib/chef/knife/user_edit.rb | |
parent | bab2c55cd1566c28981d3ffd89326215f15c5fb4 (diff) | |
download | chef-1316abc8f82f53aac6fbb28e81fd9a0c47155ea8.tar.gz |
Remove knife user support for open source Chef Server < 12
We shipped Chef 12 server on 2014-11-25. We've maintained backwards compatibility here by shipping double plugins, constantly checking for Chef 11 and then rewriting passed args. We deprecated it with Chef 14. This fully removes support. chef-client will continue to work on chef 11, but users cannot be managed with knife from a workstation running the latest version of Chef/ChefDK.
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/chef/knife/user_edit.rb')
-rw-r--r-- | lib/chef/knife/user_edit.rb | 46 |
1 files changed, 8 insertions, 38 deletions
diff --git a/lib/chef/knife/user_edit.rb b/lib/chef/knife/user_edit.rb index eb6d74c470..a039525001 100644 --- a/lib/chef/knife/user_edit.rb +++ b/lib/chef/knife/user_edit.rb @@ -28,26 +28,6 @@ class Chef banner "knife user edit USER (options)" - def osc_11_warning - <<~EOF - The Chef Server you are using does not support the username field. - This means it is an Open Source 11 Server. - knife user edit for Open Source 11 Server is being deprecated. - Open Source 11 Server user commands now live under the knife oc_user namespace. - For backwards compatibility, we will forward this request to knife osc_user edit. - If you are using an Open Source 11 Server, please use that command to avoid this warning. - NOTE: Backwards compatibility for Open Source 11 Server in these commands will be removed - in Chef 15 which will be released April 2019. -EOF - end - - def run_osc_11_user_edit - # run osc_user_create with our input - ARGV.delete("user") - ARGV.unshift("osc_user") - Chef::Knife.run(ARGV, Chef::Application::Knife.options) - end - def run @user_name = @name_args[0] @@ -57,24 +37,14 @@ EOF exit 1 end - original_user = Chef::UserV1.load(@user_name).to_h - # DEPRECATION NOTE - # Remove this if statement and corrosponding code post OSC 11 support. - # - # if username is nil, we are in the OSC 11 case, - # forward to deprecated command - if original_user["username"].nil? - ui.warn(osc_11_warning) - run_osc_11_user_edit - else # EC / CS 12 user create - edited_user = edit_hash(original_user) - if original_user != edited_user - user = Chef::UserV1.from_hash(edited_user) - user.update - ui.msg("Saved #{user}.") - else - ui.msg("User unchanged, not saving.") - end + original_user = Chef::UserV1.load(@user_name).to_hash + edited_user = edit_hash(original_user) + if original_user != edited_user + user = Chef::UserV1.from_hash(edited_user) + user.update + ui.msg("Saved #{user}.") + else + ui.msg("User unchanged, not saving.") end end end |