diff options
author | snehaldwivedi <sdwivedi@msystechnologies.com> | 2020-08-06 21:53:12 -0700 |
---|---|---|
committer | snehaldwivedi <sdwivedi@msystechnologies.com> | 2021-02-16 02:45:13 -0800 |
commit | 37ac3c34cf04630026d09c4f084ddf2394141165 (patch) | |
tree | 97da64bf59fff7929254513d3bd9fb77b6b4b33c | |
parent | c9080be779d38478960425b53afc08fd52a96562 (diff) | |
download | chef-37ac3c34cf04630026d09c4f084ddf2394141165.tar.gz |
Updated reviewed changes
Signed-off-by: snehaldwivedi <sdwivedi@msystechnologies.com>
-rw-r--r-- | lib/chef/knife/user_create.rb | 12 | ||||
-rw-r--r-- | lib/chef/knife/user_dissociate.rb | 2 | ||||
-rw-r--r-- | lib/chef/org.rb | 2 | ||||
-rw-r--r-- | spec/unit/knife/user_delete_spec.rb | 1 | ||||
-rw-r--r-- | spec/unit/knife/user_list_spec.rb | 4 |
5 files changed, 13 insertions, 8 deletions
diff --git a/lib/chef/knife/user_create.rb b/lib/chef/knife/user_create.rb index 471fc24bd8..6e552e25b6 100644 --- a/lib/chef/knife/user_create.rb +++ b/lib/chef/knife/user_create.rb @@ -65,6 +65,10 @@ class Chef Chef::UserV1.from_hash(hash).create end + def chef_rest + user.chef_root_rest_v0 + end + def run test_mandatory_field(@name_args[0], "username") user.username @name_args[0] @@ -119,13 +123,13 @@ class Chef end end - final_user = user.chef_root_rest_v0.post("users/", user_hash) + final_user = chef_rest.post("users/", user_hash) if config[:orgname] request_body = { user: user.username } - response = user.chef_root_rest_v0.post("organizations/#{config[:orgname]}/association_requests", request_body) + response = chef_rest.post("organizations/#{config[:orgname]}/association_requests", request_body) association_id = response["uri"].split("/").last - user.chef_root_rest_v0.put("users/#{user.username}/association_requests/#{association_id}", { response: "accept" }) + chef_rest.put("users/#{user.username}/association_requests/#{association_id}", { response: "accept" }) end ui.info("Created #{user}") @@ -141,7 +145,7 @@ class Chef end def prompt_for_password - ui.ask("Please enter the user's password: ") { |q| q.echo = false } + ui.ask("Please enter the user's password: ", echo: false) end end end diff --git a/lib/chef/knife/user_dissociate.rb b/lib/chef/knife/user_dissociate.rb index a69394dabd..6af1559608 100644 --- a/lib/chef/knife/user_dissociate.rb +++ b/lib/chef/knife/user_dissociate.rb @@ -1,6 +1,6 @@ # # Author:: Steven Danna (<steve@chef.io>) -# Copyright:: Copyright 2011-2016 Chef Software, Inc. +# Copyright:: Copyright (c) Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/lib/chef/org.rb b/lib/chef/org.rb index 4ba27d1ea0..8f65f3ddd1 100644 --- a/lib/chef/org.rb +++ b/lib/chef/org.rb @@ -1,6 +1,6 @@ # # Author:: Steven Danna (steve@chef.io) -# Copyright:: Copyright 2011-2016 Chef Software, Inc. +# Copyright:: Copyright (c) Chef Software Inc # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/spec/unit/knife/user_delete_spec.rb b/spec/unit/knife/user_delete_spec.rb index 64d9679895..4dd2665cda 100644 --- a/spec/unit/knife/user_delete_spec.rb +++ b/spec/unit/knife/user_delete_spec.rb @@ -1,4 +1,5 @@ # +# Author:: Steven Danna (<steve@chef.io>) # Copyright:: Copyright (c) Chef Software Inc. # License:: Apache License, Version 2.0 # diff --git a/spec/unit/knife/user_list_spec.rb b/spec/unit/knife/user_list_spec.rb index d91ec09434..63df590591 100644 --- a/spec/unit/knife/user_list_spec.rb +++ b/spec/unit/knife/user_list_spec.rb @@ -1,6 +1,6 @@ # -# Author:: Snehal Dwivedi (<sdwivedi@msystechnologies.com>) -# Copyright:: Copyright 2014-2016 Chef Software, Inc. +# Author:: Steven Danna +# Copyright:: Copyright (c) Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); |