summaryrefslogtreecommitdiff
path: root/lib/chef/knife/bootstrap.rb
diff options
context:
space:
mode:
authorClaire McQuin <claire@getchef.com>2014-08-22 11:12:10 -0700
committerSerdar Sutay <serdar@opscode.com>2014-08-26 15:49:51 -0700
commit3812f7cb6b267014c4057cd6787b7fc2011ef816 (patch)
treeaa243d522421364716df0da0bc020cedf6907668 /lib/chef/knife/bootstrap.rb
parentde8e2612785c1f9f4bdd05787dcc47d55ef348c6 (diff)
downloadchef-3812f7cb6b267014c4057cd6787b7fc2011ef816.tar.gz
Add --ssl-verify-mode and --[no-]verify-api-cert options.
Diffstat (limited to 'lib/chef/knife/bootstrap.rb')
-rw-r--r--lib/chef/knife/bootstrap.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/chef/knife/bootstrap.rb b/lib/chef/knife/bootstrap.rb
index cf4f3c7a0c..3c934431ec 100644
--- a/lib/chef/knife/bootstrap.rb
+++ b/lib/chef/knife/bootstrap.rb
@@ -188,6 +188,23 @@ class Chef
:description => "Add options to curl when install chef-client",
:proc => Proc.new { |co| Chef::Config[:knife][:bootstrap_curl_options] = co }
+ option :ssl_verify_mode,
+ :long => "--ssl-verify-mode [none|all]",
+ :description => "Whether or not to verify the SSL cert for all HTTPS requests.",
+ :proc => Proc.new { |verify_mode|
+ if verify_mode == "all"
+ mode = :verify_peer
+ elsif verify_mode == "none"
+ mode = :verify_none
+ end
+ Chef::Config[:knife][:ssl_verify_mode] = mode
+ }
+
+ option :verify_api_cert,
+ :long => "--[no-]verify-api-cert",
+ :description => "Verify the SSL cert for HTTPS requests to the Chef server API.",
+ :boolean => true
+
def bootstrap_template
# For some reason knife.merge_configs doesn't pick up the default values from
# Chef::Config[:knife][:bootstrap_template] unless Chef::Config[:knife][:bootstrap_template]
@@ -204,6 +221,7 @@ class Chef
if File.exists?(template)
Chef::Log.debug("Using the specified bootstrap template: #{File.dirname(template)}")
return template
+
end
# Otherwise search the template directories until we find the right one