Class: Kontena::Plugin::Aws::Master::CreateCommand

Inherits:
Command
  • Object
show all
Includes:
Cli::Common, Prompts, Prompts::Common
Defined in:
lib/kontena/plugin/aws/master/create_command.rb

Instance Method Summary collapse

Methods included from Prompts::Common

included

Methods included from Prompts

#ask_node, #aws_client, #resolve_region

Instance Method Details

#executeObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/kontena/plugin/aws/master/create_command.rb', line 18

def execute
  require 'securerandom'
  require 'kontena/machine/aws'

  provisioner.run!(
    name: name,
    type: type,
    vpc: vpc_id,
    zone: zone,
    subnet: subnet_id,
    ssl_cert: ssl_cert,
    storage: storage,
    version: version,
    key_pair: key_pair,
    vault_secret: vault_secret || SecureRandom.hex(24),
    vault_iv: vault_iv || SecureRandom.hex(24),
    mongodb_uri: mongodb_uri,
    associate_public_ip: associate_public_ip?,
    security_groups: security_groups,
    initial_admin_code: SecureRandom.hex(16),
    ami: ami
  )
rescue Seahorse::Client::NetworkingError => ex
  raise ex unless ex.message.match(/certificate verify failed/)
  exit_with_error Kontena::Machine::Aws.ssl_fail_message(aws_bundled_cert?)
end

#provisionerObject



45
46
47
# File 'lib/kontena/plugin/aws/master/create_command.rb', line 45

def provisioner
  Kontena::Machine::Aws::MasterProvisioner.new(access_key, secret_key, region)
end