lib/chef/knife/user_create.rb in knife-17.10.0 vs lib/chef/knife/user_create.rb in knife-17.10.95
- old
+ new
@@ -126,19 +126,21 @@
first_name: user.first_name,
last_name: user.last_name,
display_name: "#{user.first_name} #{user.last_name}",
email: user.email,
password: password,
+ create_key: user.create_key,
}
else
user_hash = {
username: user.username,
first_name: user.first_name,
last_name: user.last_name,
display_name: user.display_name,
email: user.email,
password: password,
+ create_key: user.create_key,
}
end
# Check the file before creating the user so the api is more transactional.
if config[:file]
@@ -157,16 +159,16 @@
association_id = response["uri"].split("/").last
root_rest.put("users/#{user.username}/association_requests/#{association_id}", { response: "accept" })
end
ui.info("Created #{user.username}")
- if final_user["private_key"]
+ if final_user["chef_key"] && final_user["chef_key"]["private_key"]
if config[:file]
File.open(config[:file], "w") do |f|
- f.print(final_user["private_key"])
+ f.print(final_user["chef_key"]["private_key"])
end
else
- ui.msg final_user["private_key"]
+ ui.msg final_user["chef_key"]["private_key"]
end
end
end
def prompt_for_password