lib/chef/knife/bootstrap.rb in chef-0.10.8 vs lib/chef/knife/bootstrap.rb in chef-0.10.10.beta.1
- old
+ new
@@ -51,10 +51,16 @@
:long => "--ssh-port PORT",
:description => "The ssh port",
:default => "22",
:proc => Proc.new { |key| Chef::Config[:knife][:ssh_port] = key }
+ option :ssh_gateway,
+ :short => "-G GATEWAY",
+ :long => "--ssh-gateway GATEWAY",
+ :description => "The ssh gateway",
+ :proc => Proc.new { |key| Chef::Config[:knife][:ssh_gateway] = key }
+
option :identity_file,
:short => "-i IDENTITY_FILE",
:long => "--identity-file IDENTITY_FILE",
:description => "The SSH identity file used for authentication"
@@ -79,11 +85,11 @@
option :distro,
:short => "-d DISTRO",
:long => "--distro DISTRO",
:description => "Bootstrap a distro using a template",
- :default => "ubuntu10.04-gems"
+ :default => "chef-full"
option :use_sudo,
:long => "--sudo",
:description => "Execute the bootstrap via sudo",
:boolean => true
@@ -98,25 +104,25 @@
:long => "--run-list RUN_LIST",
:description => "Comma separated list of roles/recipes to apply",
:proc => lambda { |o| o.split(/[\s,]+/) },
:default => []
- option :no_host_key_verify,
- :long => "--no-host-key-verify",
- :description => "Disable host key verification",
+ option :host_key_verify,
+ :long => "--[no-]host-key-verify",
+ :description => "Verify host key, enabled by default.",
:boolean => true,
- :default => false
+ :default => true
def load_template(template=nil)
# Are we bootstrapping using an already shipped template?
if config[:template_file]
bootstrap_files = config[:template_file]
else
bootstrap_files = []
bootstrap_files << File.join(File.dirname(__FILE__), 'bootstrap', "#{config[:distro]}.erb")
- bootstrap_files << File.join(@@chef_config_dir, "bootstrap", "#{config[:distro]}.erb")
- bootstrap_files << File.join(ENV['HOME'], '.chef', 'bootstrap', "#{config[:distro]}.erb")
+ bootstrap_files << File.join(Knife.chef_config_dir, "bootstrap", "#{config[:distro]}.erb") if Knife.chef_config_dir
+ bootstrap_files << File.join(ENV['HOME'], '.chef', 'bootstrap', "#{config[:distro]}.erb") if ENV['HOME']
bootstrap_files << Gem.find_files(File.join("chef","knife","bootstrap","#{config[:distro]}.erb"))
bootstrap_files.flatten!
end
template = Array(bootstrap_files).find do |bootstrap_template|
@@ -176,12 +182,13 @@
ssh.ui = ui
ssh.name_args = [ server_name, ssh_command ]
ssh.config[:ssh_user] = config[:ssh_user]
ssh.config[:ssh_password] = config[:ssh_password]
ssh.config[:ssh_port] = Chef::Config[:knife][:ssh_port] || config[:ssh_port]
+ ssh.config[:ssh_gateway] = Chef::Config[:knife][:ssh_gateway] || config[:ssh_gateway]
ssh.config[:identity_file] = config[:identity_file]
ssh.config[:manual] = true
- ssh.config[:no_host_key_verify] = config[:no_host_key_verify]
+ ssh.config[:host_key_verify] = config[:host_key_verify]
ssh.config[:on_error] = :raise
ssh
end
def knife_ssh_with_password_auth