summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsachin007jain <sachin.jain@chef.io>2022-02-21 17:21:20 +0530
committersachin007jain <sachin.jain@chef.io>2022-04-08 12:07:46 +0530
commitc8cb222fb38142d3a4f2bcb44a35a257d15fc65c (patch)
tree48933fbcadf2dd6e3b4d15bc6f079e4f0c1515cf
parent4f1723722cdac9d27fbb46c3df304ed7f7a6ce75 (diff)
downloadchef-c8cb222fb38142d3a4f2bcb44a35a257d15fc65c.tar.gz
Fix pem file generation when user is created
Signed-off-by: sachin007jain <sachin.jain@chef.io>
-rw-r--r--knife/lib/chef/knife/user_create.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/knife/lib/chef/knife/user_create.rb b/knife/lib/chef/knife/user_create.rb
index 009f193d46..158e8d11cd 100644
--- a/knife/lib/chef/knife/user_create.rb
+++ b/knife/lib/chef/knife/user_create.rb
@@ -128,6 +128,7 @@ class Chef
display_name: "#{user.first_name} #{user.last_name}",
email: user.email,
password: password,
+ create_key: user.create_key,
}
else
user_hash = {
@@ -137,6 +138,7 @@ class Chef
display_name: user.display_name,
email: user.email,
password: password,
+ create_key: user.create_key,
}
end
@@ -159,13 +161,13 @@ class Chef
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