summaryrefslogtreecommitdiff
path: root/chef/lib/chef
diff options
context:
space:
mode:
authorThomas Dudziak <tomdzk@gmail.com>2012-09-17 11:41:35 -0700
committerBryan McLellan <btm@opscode.com>2012-10-05 15:14:50 -0700
commit9f265a6d0e3c961157a4675d1843d5c70293c8d6 (patch)
tree57d2bb7d174a998a57203947330244df907b12cc /chef/lib/chef
parentf4629cad69374a10724b9e3d94694547eaad318c (diff)
downloadchef-9f265a6d0e3c961157a4675d1843d5c70293c8d6.tar.gz
Fixes CHEF-3455: Add commandline options to allow scripting of knife configure --initial
Diffstat (limited to 'chef/lib/chef')
-rw-r--r--chef/lib/chef/knife/configure.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/chef/lib/chef/knife/configure.rb b/chef/lib/chef/knife/configure.rb
index 0526244053..f6d0ee3624 100644
--- a/chef/lib/chef/knife/configure.rb
+++ b/chef/lib/chef/knife/configure.rb
@@ -42,6 +42,22 @@ class Chef
:boolean => true,
:description => "Create an initial API Client"
+ option :admin_client_name,
+ :long => "--admin_client_name NAME",
+ :description => "The existing admin clientname (usually chef-webui)"
+
+ option :admin_client_key,
+ :long => "--admin_client_key PATH",
+ :description => "The path to the admin client's private key (usually a file named webui.pem)"
+
+ option :validation_client_name,
+ :long => "--validation_client_name NAME",
+ :description => "The validation clientname (usually chef-validator)"
+
+ option :validation_key,
+ :long => "--validation_key PATH",
+ :description => "The location of the location of the validation key (usually a file named validation.pem)"
+
def configure_chef
# We are just faking out the system so that you can do this without a key specified
Chef::Config[:node_name] = 'woot'
@@ -120,14 +136,17 @@ EOH
@new_client_name = config[:node_name] || ask_question("Please enter a clientname for the new client: ", :default => Etc.getlogin)
@admin_client_name = config[:admin_client_name] || ask_question("Please enter the existing admin clientname: ", :default => 'chef-webui')
@admin_client_key = config[:admin_client_key] || ask_question("Please enter the location of the existing admin client's private key: ", :default => '/etc/chef/webui.pem')
+ @admin_client_key = File.expand_path(@admin_client_key)
else
@new_client_name = config[:node_name] || ask_question("Please enter an existing username or clientname for the API: ", :default => Etc.getlogin)
end
@validation_client_name = config[:validation_client_name] || ask_question("Please enter the validation clientname: ", :default => 'chef-validator')
@validation_key = config[:validation_key] || ask_question("Please enter the location of the validation key: ", :default => '/etc/chef/validation.pem')
+ @validation_key = File.expand_path(@validation_key)
@chef_repo = config[:repository] || ask_question("Please enter the path to a chef repository (or leave blank): ")
@new_client_key = config[:client_key] || File.join(chef_config_path, "#{@new_client_name}.pem")
+ @new_client_key = File.expand_path(@new_client_key)
end
def guess_servername