Skip to content

Commit

Permalink
Add --ssh-init-delay option to make sleep time configurable
Browse files Browse the repository at this point in the history
I've personally had trouble with CentOS images getting provisioned with
the right SSH keys before the traditional 10-second delay.
  • Loading branch information
Larry Gilbert committed Dec 16, 2014
1 parent d2402da commit 26db188
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/chef/knife/joyent_server_create.rb
Expand Up @@ -110,6 +110,10 @@ class JoyentServerCreate < Knife
:description => "The ssh gateway server",
:proc => Proc.new { |key| Chef::Config[:knife][:ssh_gateway] = key }

option :ssh_init_delay,
:long => "--ssh-init-delay SECS",
:description => "Seconds to sleep after SSH starts answering on new machine",
:default => 10

def is_linklocal(ip)
linklocal = IPAddr.new "169.254.0.0/16"
Expand Down Expand Up @@ -209,7 +213,9 @@ def run

puts ui.color("Waiting for SSH to come up on: #{bootstrap_ip}", :cyan)
tcp_test_ssh(bootstrap_ip)
sleep 10

puts ui.color("Sleeping for #{config[:ssh_init_delay]} seconds", :cyan)
sleep config[:ssh_init_delay]

bootstrap_for_node(server, bootstrap_ip).run

Expand Down

0 comments on commit 26db188

Please sign in to comment.