diff options
author | elijah <elijah@riseup.net> | 2013-09-21 18:40:36 -0700 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2013-09-21 18:40:36 -0700 |
commit | 16cec251edc8fa3761efa588bedd2730cf1153b3 (patch) | |
tree | 7284d350c887975ee2bed70a21a63b5d039a7e1b | |
parent | 67d5aa499f8aef1d398a8b39f04f75c05831662e (diff) | |
download | leap_cli-16cec251edc8fa3761efa588bedd2730cf1153b3.tar.gz leap_cli-16cec251edc8fa3761efa588bedd2730cf1153b3.tar.bz2 |
remove ping from `leap node init`
-rw-r--r-- | lib/leap_cli/commands/node.rb | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/leap_cli/commands/node.rb b/lib/leap_cli/commands/node.rb index 0d33071..056ec28 100644 --- a/lib/leap_cli/commands/node.rb +++ b/lib/leap_cli/commands/node.rb @@ -51,7 +51,6 @@ module LeapCli; module Commands node.arg_name 'FILTER' #, :optional => false, :multiple => false node.command :init do |init| init.switch 'echo', :desc => 'If set, passwords are visible as you type them (default is hidden)', :negatable => false - init.switch 'noping', :desc => 'If set, skip initial ping of node (in case ICMP is being blocked).', :negatable => false init.flag :port, :desc => 'Override the default SSH port.', :arg_name => 'PORT' init.flag :ip, :desc => 'Override the default SSH IP address.', :arg_name => 'IPADDRESS' @@ -59,7 +58,7 @@ module LeapCli; module Commands assert! args.any?, 'You must specify a FILTER' finished = [] manager.filter!(args).each_node do |node| - ping_node(node, options) unless options[:noping] + is_node_alive(node, options) save_public_host_key(node, global, options) unless node.vagrant? update_compiled_ssh_configs ssh_connect_options = connect_options(options).merge({:bootstrap => true, :echo => options[:echo]}) @@ -206,10 +205,12 @@ module LeapCli; module Commands return SshKey.load(public_key, key_type) end - def ping_node(node, options) - ip = options[:ip] || node.ip_address - log :pinging, node.name - assert_run!("ping -W 1 -c 1 #{ip}", "Could not ping #{node.name} (address #{ip}). Try again, we only send a single ping.") + def is_node_alive(node, options) + address = options[:ip] || node.ip_address + port = options[:port] || node.ssh.port + log :connecting, "to node #{node.name}" + assert_run! "nc -zw3 #{address} #{port}", + "Failed to reach #{node.name} (address #{address}, port #{port}). You can override the configured IP address and port with --ip or --port." end def seed_node_data(node, args) |