Skip to content

Commit

Permalink
Merge pull request #87 from ClogenyTechnologies/nim/pass_bootstrap_op…
Browse files Browse the repository at this point in the history
…tions

Passing bootstrap options to client.rb
  • Loading branch information
Nimisha Sharad committed Nov 10, 2015
2 parents 697e345 + e624945 commit 2c4c8db
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/chef/azure/commands/enable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ def configure_chef_only_once
template_file = File.expand_path(File.dirname(File.dirname(__FILE__)))
config[:secret] = bootstrap_options['secret'] || bootstrap_options['encrypted_data_bag_secret']
config[:node_verify_api_cert] = bootstrap_options['node_verify_api_cert'] if bootstrap_options['node_verify_api_cert']
config[:node_ssl_verify_mode] = bootstrap_options['node_ssl_verify_mode'] if bootstrap_options['node_ssl_verify_mode']
runlist = @run_list.empty? ? [] : escape_runlist(@run_list)
# load_cloud_attributes_in_hints
if windows?
Expand Down
23 changes: 23 additions & 0 deletions lib/chef/azure/core/bootstrap_context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,29 @@ def config_content
client_rb << %Q{verify_api_cert #{value}\n}
end

# We configure :ssl_verify_mode only when it's overridden on the CLI
# or when specified in the knife config.
if @config[:node_ssl_verify_mode] || knife_config.has_key?(:ssl_verify_mode)
value = case @config[:node_ssl_verify_mode]
when "peer"
:verify_peer
when "none"
:verify_none
when nil
knife_config[:ssl_verify_mode]
else
nil
end

if value
client_rb << %Q{ssl_verify_mode :#{value}\n}
end
end

if @config[:ssl_verify_mode]
client_rb << %Q{ssl_verify_mode :#{knife_config[:ssl_verify_mode]}\n}
end

client_rb << %Q{log_location "#{@config[:log_location]}/chef-client.log"\n}
client_rb << %Q{chef_server_url "#{@config[:chef_server_url]}"\n} if @config[:chef_server_url]
client_rb << %Q{validation_client_name "#{@config[:validation_client_name]}"\n} if @config[:validation_client_name]
Expand Down

0 comments on commit 2c4c8db

Please sign in to comment.