Class: Dployr::Commands::Start

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

Instance Method Summary collapse

Methods inherited from Base

#create, #create_compute_client, #get_region_config

Methods included from Utils

parse_attributes, parse_flags, parse_matrix

Constructor Details

#initialize(options) ⇒ Start

Returns a new instance of Start.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/dployr/commands/start.rb', line 7

def initialize(options)
  super options
  begin
    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

    Dployr::Scripts::Default_Hooks.new @ip, @config, "start", self
  rescue Exception => e
    @log.error e
    exit 1
  end
end

Instance Method Details

#actionObject



23
24
25
26
27
28
29
30
31
# File 'lib/dployr/commands/start.rb', line 23

def action
  if @ip
    puts "#{@name} found with IP #{@ip}".yellow
  else
    @ip = @client.start
    puts "Startded instance for #{@p_attrs["name"]} in #{@options[:region]} with IP #{@ip} succesfully".yellow
  end
  @ip
end