Skip to content

Commit

Permalink
Support for using dynamically set password in templates and increase
Browse files Browse the repository at this point in the history
Wait times.
  • Loading branch information
Chirag Jog committed Aug 28, 2012
1 parent 0c56d27 commit 5539903
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/chef/knife/cs_server_create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ module KnifeCloudstack
class CsServerCreate < Chef::Knife

# Seconds to delay between detecting ssh and initiating the bootstrap
BOOTSTRAP_DELAY = 3
BOOTSTRAP_DELAY = 20

# Seconds to wait between ssh pings
SSH_POLL_INTERVAL = 2
SSH_POLL_INTERVAL = 10

deps do
require 'chef/knife/bootstrap'
Expand Down Expand Up @@ -200,7 +200,9 @@ def run
puts "\n"
}

bootstrap_for_node(public_ip).run
username = locate_config_value(:ssh_user) || "root"
password = locate_config_value(:ssh_password) || server.password
bootstrap_for_node(public_ip, username, password).run

puts "\n"
puts "#{ui.color("Name", :cyan)}: #{server['name']}"
Expand Down Expand Up @@ -290,12 +292,12 @@ def is_ssh_open?(ip)
end


def bootstrap_for_node(host)
def bootstrap_for_node(host, username, password)
bootstrap = Chef::Knife::Bootstrap.new
bootstrap.name_args = [host]
bootstrap.config[:run_list] = config[:run_list]
bootstrap.config[:ssh_user] = config[:ssh_user]
bootstrap.config[:ssh_password] = config[:ssh_password]
bootstrap.config[:ssh_user] = username
bootstrap.config[:ssh_password] = password
bootstrap.config[:identity_file] = config[:identity_file]
bootstrap.config[:chef_node_name] = config[:chef_node_name] if config[:chef_node_name]
bootstrap.config[:prerelease] = config[:prerelease]
Expand Down

0 comments on commit 5539903

Please sign in to comment.