Class: Dployr::Commands::Ssh

Inherits:
Base
  • Object
show all
Defined in:
lib/dployr/commands/ssh.rb

Instance Method Summary collapse

Methods inherited from Base

#create, #create_compute_client, #get_config, #get_region_config

Methods included from Utils

parse_attributes, parse_flags, parse_matrix

Constructor Details

#initialize(options) ⇒ Ssh

Returns a new instance of Ssh.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/dployr/commands/ssh.rb', line 9

def initialize(options)
  super options

  puts "Connecting to #{@provider}...".yellow
  @client = Dployr::Compute.const_get(@provider.to_sym).new @options, @p_attrs

  puts "Looking for #{@p_attrs["name"]} in #{@options[:region]}...".yellow
  @ip = @client.get_ip
  if @ip
    puts "#{@p_attrs["name"]} found with IP #{@ip}".yellow
  else
    raise "#{@p_attrs["name"]} not found"
  end

  Dployr::Scripts::Ssh.new @ip, @config
end