Class: Kontena::Plugin::Packet::Nodes::TerminateCommand

Inherits:
Command
  • Object
show all
Includes:
Cli::Common, Cli::GridOptions, ProjectOption, TokenOption
Defined in:
lib/kontena/plugin/packet/nodes/terminate_command.rb

Instance Method Summary collapse

Methods included from ProjectOption

included

Methods included from TokenOption

included

Instance Method Details

#destroyer(client, token) ⇒ Object

Parameters:

  • client (Kontena::Client)
  • token (String)


28
29
30
# File 'lib/kontena/plugin/packet/nodes/terminate_command.rb', line 28

def destroyer(client, token)
  Kontena::Machine::Packet::NodeDestroyer.new(client, token)
end

#executeObject



16
17
18
19
20
21
22
23
24
# File 'lib/kontena/plugin/packet/nodes/terminate_command.rb', line 16

def execute
  confirm_command(name) unless force?
  require_api_url
  require_current_grid
  require 'kontena/machine/packet'
  grid = client(require_token).get("grids/#{current_grid}")
  destroyer = destroyer(client(require_token), token)
  destroyer.run!(grid, project, name)
end