Skip to content
Browse files

#6 Fixed client key name and path generation so it includes config na…

…me in it to avoid conflicts when configuring 2 different chef servers with the same client name.
  • Loading branch information...
1 parent f0da6e9 commit d2852f81c0a9ab29d44cbfdaecd5c536119013a5 Andrian Jardan committed
Showing with 3 additions and 0 deletions.
  1. +3 −0 lib/chef/knife/block.rb
3 lib/chef/knife/block.rb
@@ -113,12 +113,15 @@ def run
@chef_server = ui.ask_question("Please enter the url to your Chef Server: ")
+ @client_name = ui.ask_question("Please enter the name of the Chef client: ")
require 'ohai'
require 'chef/knife/configure'
knife_config =
knife_config.config[:config_file] = "#{::Chef::Knife::chef_config_dir}/knife-#{@config_name}.rb"
knife_config.config[:chef_server_url] = @chef_server
+ knife_config.config[:node_name] = @client_name
+ knife_config.config[:client_key] = "#{::Chef::Knife::chef_config_dir}/#{@client_name}-#{@config_name}.pem"
puts "#{::Chef::Knife::chef_config_dir}/knife-#{@config_name}.rb has been sucessfully created"

0 comments on commit d2852f8

Please sign in to comment.
Something went wrong with that request. Please try again.