Class: Create

Inherits:
Command show all
Defined in:
lib/maws/commands/create.rb

Instance Attribute Summary

Attributes inherited from Command

#connection, #maws

Instance Method Summary collapse

Methods inherited from Command

#add_generic_options, #add_specific_options, #initialize, #instances, #process_options, #verify_configs, #verify_options

Constructor Details

This class inherits a constructor from Command

Instance Method Details

#descriptionObject



4
5
6
# File 'lib/maws/commands/create.rb', line 4

def description
  "create - creates all specified instances if they don't exist"
end

#run!Object



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

def run!
  instances_to_create = instances.specified.not_alive
  if instances_to_create.empty?
    info "nothing to create"
    return
  end

  instances_to_create.each {|i| i.create}

  # create tags
  instances_to_be_tagged =  instances_to_create.alive.with_service(:ec2)
  unless instances_to_be_tagged.empty?
    sleep 2
    # connection.silent = true
    instances_to_be_tagged.each {|i| i.create_tags}
  end
end