Method: KnifeCloudstack::CsStackCreate#knife_ssh_action

Defined in:
lib/chef/knife/cs_stack_create.rb

#knife_ssh_action(query, command) ⇒ Object



214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
# File 'lib/chef/knife/cs_stack_create.rb', line 214

def knife_ssh_action(query, command)

  public_ips = find_public_ips(query)
  return if public_ips.nil? || public_ips.empty?
  host_list = public_ips.join(' ')

  ssh = knife_ssh(host_list, command)
  begin
    ssh.run
  rescue Net::SSH::AuthenticationFailed
    unless config[:ssh_password]
      puts "Failed to authenticate #{config[:ssh_user]} - trying password auth"
      ssh = knife_ssh_with_password_auth(host_list, command)
      ssh.run
    end
  end

end