Class: Kontena::Plugin::Aws::Nodes::RestartCommand

Inherits:
Command
  • Object
show all
Includes:
Cli::Common, Cli::GridOptions, Prompts, Prompts::Common::Defaults
Defined in:
lib/kontena/plugin/aws/nodes/restart_command.rb

Constant Summary

Constants included from Prompts::Common::Defaults

Prompts::Common::Defaults::CREATE_KEYPAIR_TEXT, Prompts::Common::Defaults::DEFAULT_INSTANCE_TYPE, Prompts::Common::Defaults::DEFAULT_REGION, Prompts::Common::Defaults::DEFAULT_SSH_KEY_PATH, Prompts::Common::Defaults::DEFAULT_STORAGE

Instance Method Summary collapse

Methods included from Prompts

#ask_node, #aws_client, #resolve_region

Methods included from Prompts::Common::Defaults

#default_access_key, #default_key_pair, #default_region, #default_region_aws_client, #default_secret_key, #default_storage, #default_subnet_id, #default_type, #default_vpc_id, #default_zone, #import_key_pair

Instance Method Details

#default_aws_regionObject



36
37
38
# File 'lib/kontena/plugin/aws/nodes/restart_command.rb', line 36

def default_aws_region
  resolve_region(@node) || default_region
end

#executeObject



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/kontena/plugin/aws/nodes/restart_command.rb', line 18

def execute
  require_current_grid
  node_name = self.name || ask_node
  @node = client.get("nodes/#{current_grid}/#{node_name}")

  require_relative '../../../machine/aws'
  Aws.use_bundled_cert! if aws_bundled_cert?

  restarter.run!(node_name)
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

#restarterObject



32
33
34
# File 'lib/kontena/plugin/aws/nodes/restart_command.rb', line 32

def restarter
  Kontena::Machine::Aws::NodeRestarter.new(access_key, secret_key, aws_region)
end