Class: Dployr::Commands::Execute

Inherits:
Base
  • Object
show all
Defined in:
lib/dployr/commands/execute.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, stages) ⇒ Execute

Returns a new instance of Execute.



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

def initialize(options, stages)
  super options

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

  puts "Looking for #{@name} in #{@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

  stages.each do |stage|
    Dployr::Scripts::Hook.new @ip, @config, stage
  end
end