Class: Kontena::Plugin::Packet::Nodes::CreateCommand

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

Constant Summary

Constants included from SshKeyOption

SshKeyOption::DEFAULT_PATH

Instance Method Summary collapse

Methods included from SshKeyOption

included

Methods included from FacilityOption

included

Methods included from TypeOption

included

Methods included from ProjectOption

included

Methods included from TokenOption

included

Instance Method Details

#executeObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/kontena/plugin/packet/nodes/create_command.rb', line 22

def execute
  require_api_url
  require_current_grid
  require 'kontena/machine/packet'
  grid = fetch_grid
  provisioner = provisioner(client, token)
  provisioner.run!(
    master_uri: api_url,
    grid_token: grid['token'],
    grid: current_grid,
    project: project,
    billing: billing,
    ssh_key: ssh_key,
    plan: plan,
    facility: facility,
    version: version
  )
end

#fetch_gridHash

Returns:

  • (Hash)


48
49
50
# File 'lib/kontena/plugin/packet/nodes/create_command.rb', line 48

def fetch_grid
  client.get("grids/#{current_grid}")
end

#provisioner(client, token) ⇒ Object

Parameters:

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


43
44
45
# File 'lib/kontena/plugin/packet/nodes/create_command.rb', line 43

def provisioner(client, token)
  Kontena::Machine::Packet::NodeProvisioner.new(client, token)
end