Class: Kontena::Plugin::Packet::Master::CreateCommand

Inherits:
Command
  • Object
show all
Includes:
Cli::Common, FacilityOption, ProjectOption, SshKeyOption, TokenOption, TypeOption
Defined in:
lib/kontena/plugin/packet/master/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



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

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

  provisioner = provisioner(token)
  provisioner.run!(
      project: project,
      billing: billing,
      ssh_key: ssh_key,
      ssl_cert: ssl_cert,
      plan: plan,
      facility: facility,
      version: version,
      vault_secret: vault_secret || SecureRandom.hex(24),
      vault_iv: vault_iv || SecureRandom.hex(24),
      initial_admin_code: SecureRandom.hex(16),
      mongodb_uri: mongodb_uri
  )
end

#provisioner(token) ⇒ Object

Parameters:

  • token (String)


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

def provisioner(token)
  Kontena::Machine::Packet::MasterProvisioner.new(token)
end