kontena-cli 0.14.7 → 0.15.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (166) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -1
  3. data/VERSION +1 -1
  4. data/bin/kontena +3 -50
  5. data/examples/kontena-plugin-hello/.gitignore +9 -0
  6. data/examples/kontena-plugin-hello/Gemfile +4 -0
  7. data/examples/kontena-plugin-hello/README.md +3 -0
  8. data/examples/kontena-plugin-hello/bin/console +14 -0
  9. data/examples/kontena-plugin-hello/bin/setup +8 -0
  10. data/examples/kontena-plugin-hello/kontena-plugin-hello.gemspec +22 -0
  11. data/examples/kontena-plugin-hello/lib/kontena/plugin/hello.rb +7 -0
  12. data/examples/kontena-plugin-hello/lib/kontena/plugin/hello/world_command.rb +6 -0
  13. data/examples/kontena-plugin-hello/lib/kontena/plugin/hello_command.rb +9 -0
  14. data/examples/kontena-plugin-hello/lib/kontena_cli_plugin.rb +5 -0
  15. data/kontena-cli.gemspec +1 -3
  16. data/lib/kontena/cli/apps/build_command.rb +3 -0
  17. data/lib/kontena/cli/apps/common.rb +6 -1
  18. data/lib/kontena/cli/apps/deploy_command.rb +1 -1
  19. data/lib/kontena/cli/apps/docker_helper.rb +13 -14
  20. data/lib/kontena/cli/apps/service_generator.rb +19 -11
  21. data/lib/kontena/cli/apps/service_generator_v2.rb +1 -0
  22. data/lib/kontena/cli/apps/yaml/reader.rb +15 -0
  23. data/lib/kontena/cli/apps/yaml/service_extender.rb +28 -0
  24. data/lib/kontena/cli/apps/yaml/validations.rb +38 -24
  25. data/lib/kontena/cli/apps/yaml/validator.rb +7 -7
  26. data/lib/kontena/cli/apps/yaml/validator_v2.rb +7 -6
  27. data/lib/kontena/cli/certificate/authorize_command.rb +23 -0
  28. data/lib/kontena/cli/certificate/get_command.rb +25 -0
  29. data/lib/kontena/cli/certificate/register_command.rb +19 -0
  30. data/lib/kontena/cli/certificate_command.rb +14 -0
  31. data/lib/kontena/cli/containers/containers_helper.rb +22 -0
  32. data/lib/kontena/cli/containers/exec_command.rb +9 -2
  33. data/lib/kontena/cli/grids/logs_command.rb +14 -3
  34. data/lib/kontena/cli/master_command.rb +1 -12
  35. data/lib/kontena/cli/node_command.rb +0 -16
  36. data/lib/kontena/cli/plugin_command.rb +15 -0
  37. data/lib/kontena/cli/plugins/install_command.rb +28 -0
  38. data/lib/kontena/cli/plugins/list_command.rb +13 -0
  39. data/lib/kontena/cli/plugins/search_command.rb +29 -0
  40. data/lib/kontena/cli/plugins/uninstall_command.rb +30 -0
  41. data/lib/kontena/cli/registry/create_command.rb +1 -1
  42. data/lib/kontena/cli/services/create_command.rb +16 -0
  43. data/lib/kontena/cli/services/list_command.rb +17 -3
  44. data/lib/kontena/cli/services/logs_command.rb +63 -18
  45. data/lib/kontena/cli/services/services_helper.rb +47 -4
  46. data/lib/kontena/cli/services/update_command.rb +16 -0
  47. data/lib/kontena/cli/stack_command.rb +20 -0
  48. data/lib/kontena/cli/stacks/common.rb +39 -0
  49. data/lib/kontena/cli/stacks/create_command.rb +27 -0
  50. data/lib/kontena/cli/stacks/deploy_command.rb +26 -0
  51. data/lib/kontena/cli/stacks/list_command.rb +38 -0
  52. data/lib/kontena/cli/stacks/remove_command.rb +26 -0
  53. data/lib/kontena/cli/stacks/show_command.rb +38 -0
  54. data/lib/kontena/cli/stacks/update_command.rb +27 -0
  55. data/lib/kontena/client.rb +11 -4
  56. data/lib/kontena/command.rb +4 -0
  57. data/lib/kontena/main_command.rb +61 -0
  58. data/lib/kontena/plugin_manager.rb +38 -0
  59. data/lib/kontena/util.rb +17 -0
  60. data/lib/kontena_cli.rb +6 -0
  61. data/spec/fixtures/health.yml +26 -0
  62. data/spec/fixtures/kontena-build.yml +16 -0
  63. data/spec/fixtures/kontena_build_v2.yaml +26 -0
  64. data/spec/kontena/cli/app/build_command_spec.rb +13 -1
  65. data/spec/kontena/cli/app/common_spec.rb +11 -0
  66. data/spec/kontena/cli/app/deploy_command_spec.rb +1 -1
  67. data/spec/kontena/cli/app/docker_helper_spec.rb +45 -0
  68. data/spec/kontena/cli/app/service_generator_spec.rb +52 -1
  69. data/spec/kontena/cli/app/yaml/service_extender_spec.rb +24 -0
  70. data/spec/kontena/cli/app/yaml/validator_spec.rb +97 -14
  71. data/spec/kontena/cli/common_spec.rb +0 -5
  72. data/spec/kontena/cli/containers/containers_helper_spec.rb +16 -0
  73. data/spec/kontena/cli/services/services_helper_spec.rb +50 -1
  74. data/spec/kontena/cli/version_command_spec.rb +1 -1
  75. data/spec/kontena/client_spec.rb +156 -0
  76. data/spec/kontena/plugin_manager_spec.rb +22 -0
  77. data/spec/spec_helper.rb +1 -0
  78. metadata +54 -125
  79. data/lib/kontena/cli/master/aws/create_command.rb +0 -48
  80. data/lib/kontena/cli/master/aws_command.rb +0 -8
  81. data/lib/kontena/cli/master/azure/create_command.rb +0 -37
  82. data/lib/kontena/cli/master/azure_command.rb +0 -13
  83. data/lib/kontena/cli/master/digital_ocean/create_command.rb +0 -38
  84. data/lib/kontena/cli/master/digital_ocean_command.rb +0 -13
  85. data/lib/kontena/cli/master/packet/create_command.rb +0 -42
  86. data/lib/kontena/cli/master/packet_command.rb +0 -14
  87. data/lib/kontena/cli/master/upcloud/create_command.rb +0 -39
  88. data/lib/kontena/cli/master/upcloud_command.rb +0 -13
  89. data/lib/kontena/cli/master/vagrant/create_command.rb +0 -25
  90. data/lib/kontena/cli/master/vagrant/restart_command.rb +0 -20
  91. data/lib/kontena/cli/master/vagrant/ssh_command.rb +0 -15
  92. data/lib/kontena/cli/master/vagrant/start_command.rb +0 -20
  93. data/lib/kontena/cli/master/vagrant/stop_command.rb +0 -20
  94. data/lib/kontena/cli/master/vagrant/terminate_command.rb +0 -13
  95. data/lib/kontena/cli/master/vagrant_command.rb +0 -23
  96. data/lib/kontena/cli/nodes/aws/create_command.rb +0 -44
  97. data/lib/kontena/cli/nodes/aws/restart_command.rb +0 -29
  98. data/lib/kontena/cli/nodes/aws/terminate_command.rb +0 -21
  99. data/lib/kontena/cli/nodes/aws_command.rb +0 -15
  100. data/lib/kontena/cli/nodes/azure/create_command.rb +0 -38
  101. data/lib/kontena/cli/nodes/azure/restart_command.rb +0 -32
  102. data/lib/kontena/cli/nodes/azure/terminate_command.rb +0 -21
  103. data/lib/kontena/cli/nodes/azure_command.rb +0 -15
  104. data/lib/kontena/cli/nodes/digital_ocean/create_command.rb +0 -32
  105. data/lib/kontena/cli/nodes/digital_ocean/restart_command.rb +0 -27
  106. data/lib/kontena/cli/nodes/digital_ocean/terminate_command.rb +0 -19
  107. data/lib/kontena/cli/nodes/digital_ocean_command.rb +0 -15
  108. data/lib/kontena/cli/nodes/packet/create_command.rb +0 -35
  109. data/lib/kontena/cli/nodes/packet/restart_command.rb +0 -17
  110. data/lib/kontena/cli/nodes/packet/terminate_command.rb +0 -20
  111. data/lib/kontena/cli/nodes/packet_command.rb +0 -15
  112. data/lib/kontena/cli/nodes/upcloud/create_command.rb +0 -33
  113. data/lib/kontena/cli/nodes/upcloud/restart_command.rb +0 -20
  114. data/lib/kontena/cli/nodes/upcloud/terminate_command.rb +0 -20
  115. data/lib/kontena/cli/nodes/upcloud_command.rb +0 -15
  116. data/lib/kontena/cli/nodes/vagrant/create_command.rb +0 -27
  117. data/lib/kontena/cli/nodes/vagrant/restart_command.rb +0 -26
  118. data/lib/kontena/cli/nodes/vagrant/ssh_command.rb +0 -21
  119. data/lib/kontena/cli/nodes/vagrant/start_command.rb +0 -26
  120. data/lib/kontena/cli/nodes/vagrant/stop_command.rb +0 -26
  121. data/lib/kontena/cli/nodes/vagrant/terminate_command.rb +0 -17
  122. data/lib/kontena/cli/nodes/vagrant_command.rb +0 -21
  123. data/lib/kontena/machine/aws.rb +0 -13
  124. data/lib/kontena/machine/aws/cloudinit.yml +0 -71
  125. data/lib/kontena/machine/aws/cloudinit_master.yml +0 -118
  126. data/lib/kontena/machine/aws/common.rb +0 -58
  127. data/lib/kontena/machine/aws/master_provisioner.rb +0 -187
  128. data/lib/kontena/machine/aws/node_destroyer.rb +0 -51
  129. data/lib/kontena/machine/aws/node_provisioner.rb +0 -204
  130. data/lib/kontena/machine/azure.rb +0 -13
  131. data/lib/kontena/machine/azure/cloudinit.yml +0 -64
  132. data/lib/kontena/machine/azure/cloudinit_master.yml +0 -106
  133. data/lib/kontena/machine/azure/logger.rb +0 -27
  134. data/lib/kontena/machine/azure/master_provisioner.rb +0 -128
  135. data/lib/kontena/machine/azure/node_destroyer.rb +0 -53
  136. data/lib/kontena/machine/azure/node_provisioner.rb +0 -132
  137. data/lib/kontena/machine/digital_ocean.rb +0 -13
  138. data/lib/kontena/machine/digital_ocean/cloudinit.yml +0 -64
  139. data/lib/kontena/machine/digital_ocean/cloudinit_master.yml +0 -118
  140. data/lib/kontena/machine/digital_ocean/master_provisioner.rb +0 -99
  141. data/lib/kontena/machine/digital_ocean/node_destroyer.rb +0 -40
  142. data/lib/kontena/machine/digital_ocean/node_provisioner.rb +0 -88
  143. data/lib/kontena/machine/packet.rb +0 -17
  144. data/lib/kontena/machine/packet/cloudinit.yml +0 -66
  145. data/lib/kontena/machine/packet/cloudinit_master.yml +0 -118
  146. data/lib/kontena/machine/packet/master_provisioner.rb +0 -93
  147. data/lib/kontena/machine/packet/node_destroyer.rb +0 -42
  148. data/lib/kontena/machine/packet/node_provisioner.rb +0 -77
  149. data/lib/kontena/machine/packet/node_restarter.rb +0 -41
  150. data/lib/kontena/machine/packet/packet_common.rb +0 -89
  151. data/lib/kontena/machine/upcloud.rb +0 -9
  152. data/lib/kontena/machine/upcloud/cloudinit.yml +0 -64
  153. data/lib/kontena/machine/upcloud/cloudinit_master.yml +0 -118
  154. data/lib/kontena/machine/upcloud/master_provisioner.rb +0 -138
  155. data/lib/kontena/machine/upcloud/node_destroyer.rb +0 -85
  156. data/lib/kontena/machine/upcloud/node_provisioner.rb +0 -121
  157. data/lib/kontena/machine/upcloud/node_restarter.rb +0 -49
  158. data/lib/kontena/machine/upcloud/upcloud_common.rb +0 -74
  159. data/lib/kontena/machine/vagrant.rb +0 -12
  160. data/lib/kontena/machine/vagrant/Vagrantfile.master.rb.erb +0 -104
  161. data/lib/kontena/machine/vagrant/Vagrantfile.node.rb.erb +0 -32
  162. data/lib/kontena/machine/vagrant/cloudinit.yml +0 -73
  163. data/lib/kontena/machine/vagrant/master_destroyer.rb +0 -37
  164. data/lib/kontena/machine/vagrant/master_provisioner.rb +0 -79
  165. data/lib/kontena/machine/vagrant/node_destroyer.rb +0 -40
  166. data/lib/kontena/machine/vagrant/node_provisioner.rb +0 -68
@@ -1,21 +0,0 @@
1
- module Kontena::Cli::Nodes::Azure
2
- class TerminateCommand < Clamp::Command
3
- include Kontena::Cli::Common
4
- include Kontena::Cli::GridOptions
5
-
6
- parameter "NAME", "Node name"
7
- option "--subscription-id", "SUBSCRIPTION ID", "Azure subscription id", required: true
8
- option "--subscription-cert", "CERTIFICATE", "Path to Azure management certificate", attribute_name: :certificate, required: true
9
-
10
- def execute
11
- require_api_url
12
- require_current_grid
13
-
14
- require 'kontena/machine/azure'
15
-
16
- grid = client(require_token).get("grids/#{current_grid}")
17
- destroyer = Kontena::Machine::Azure::NodeDestroyer.new(client(require_token), subscription_id, certificate)
18
- destroyer.run!(grid, name)
19
- end
20
- end
21
- end
@@ -1,15 +0,0 @@
1
- require_relative 'azure/create_command'
2
- require_relative 'azure/restart_command'
3
- require_relative 'azure/terminate_command'
4
-
5
- module Kontena::Cli::Nodes
6
- class AzureCommand < Clamp::Command
7
-
8
- subcommand "create", "Create a new Azure node", Azure::CreateCommand
9
- subcommand "restart", "Restart Azure node", Azure::RestartCommand
10
- subcommand "terminate", "Terminate Azure node", Azure::TerminateCommand
11
-
12
- def execute
13
- end
14
- end
15
- end
@@ -1,32 +0,0 @@
1
- module Kontena::Cli::Nodes::DigitalOcean
2
- class CreateCommand < Clamp::Command
3
- include Kontena::Cli::Common
4
- include Kontena::Cli::GridOptions
5
-
6
- parameter "[NAME]", "Node name"
7
- option "--token", "TOKEN", "DigitalOcean API token", required: true
8
- option "--ssh-key", "SSH_KEY", "Path to ssh public key", required: true
9
- option "--size", "SIZE", "Droplet size", default: '1gb'
10
- option "--region", "REGION", "Region", default: 'ams2'
11
- option "--version", "VERSION", "Define installed Kontena version", default: 'latest'
12
-
13
- def execute
14
- require_api_url
15
- require_current_grid
16
-
17
- require 'kontena/machine/digital_ocean'
18
- grid = client(require_token).get("grids/#{current_grid}")
19
- provisioner = Kontena::Machine::DigitalOcean::NodeProvisioner.new(client(require_token), token)
20
- provisioner.run!(
21
- master_uri: api_url,
22
- grid_token: grid['token'],
23
- grid: current_grid,
24
- ssh_key: ssh_key,
25
- name: name,
26
- size: size,
27
- region: region,
28
- version: version
29
- )
30
- end
31
- end
32
- end
@@ -1,27 +0,0 @@
1
- module Kontena::Cli::Nodes::DigitalOcean
2
- class RestartCommand < Clamp::Command
3
- include Kontena::Cli::Common
4
- include Kontena::Cli::GridOptions
5
-
6
- parameter "NAME", "Node name"
7
- option "--token", "TOKEN", "DigitalOcean API token", required: true
8
-
9
- def execute
10
- require_api_url
11
- require_current_grid
12
-
13
- require 'kontena/machine/digital_ocean'
14
-
15
- client = DropletKit::Client.new(access_token: token)
16
- droplet = client.droplets.all.find{|d| d.name == name}
17
- if droplet
18
- ShellSpinner "Restarting DigitalOcean droplet #{name.colorize(:cyan)} " do
19
- client.droplet_actions.reboot(droplet_id: droplet.id)
20
- sleep 5 until client.droplets.find(id: droplet.id).status == 'active'
21
- end
22
- else
23
- abort "Cannot find droplet #{name.colorize(:cyan)} in DigitalOcean"
24
- end
25
- end
26
- end
27
- end
@@ -1,19 +0,0 @@
1
- module Kontena::Cli::Nodes::DigitalOcean
2
- class TerminateCommand < Clamp::Command
3
- include Kontena::Cli::Common
4
- include Kontena::Cli::GridOptions
5
-
6
- parameter "NAME", "Node name"
7
- option "--token", "TOKEN", "DigitalOcean API token", required: true
8
-
9
- def execute
10
- require_api_url
11
- require_current_grid
12
-
13
- require 'kontena/machine/digital_ocean'
14
- grid = client(require_token).get("grids/#{current_grid}")
15
- destroyer = Kontena::Machine::DigitalOcean::NodeDestroyer.new(client(require_token), token)
16
- destroyer.run!(grid, name)
17
- end
18
- end
19
- end
@@ -1,15 +0,0 @@
1
- require_relative 'digital_ocean/create_command'
2
- require_relative 'digital_ocean/restart_command'
3
- require_relative 'digital_ocean/terminate_command'
4
-
5
- module Kontena::Cli::Nodes
6
- class DigitalOceanCommand < Clamp::Command
7
-
8
- subcommand "create", "Create a new DigitalOcean node", DigitalOcean::CreateCommand
9
- subcommand "restart", "Restart DigitalOcean node", DigitalOcean::RestartCommand
10
- subcommand "terminate", "Terminate DigitalOcean node", DigitalOcean::TerminateCommand
11
-
12
- def execute
13
- end
14
- end
15
- end
@@ -1,35 +0,0 @@
1
- module Kontena::Cli::Nodes::Packet
2
- class CreateCommand < Clamp::Command
3
- include Kontena::Cli::Common
4
- include Kontena::Cli::GridOptions
5
-
6
- parameter "[NAME]", "Node name"
7
- option "--token", "TOKEN", "Packet API token", required: true
8
- option "--project", "PROJECT ID", "Packet project id", required: true
9
- option "--type", "TYPE", "Server type (baremetal_0, baremetal_1, ..)", default: 'baremetal_0', attribute_name: :plan
10
- option "--facility", "FACILITY CODE", "Facility", default: 'ams1'
11
- option "--billing", "BILLING", "Billing cycle", default: 'hourly'
12
- option "--ssh-key", "PATH", "Path to ssh public key (optional)"
13
- option "--version", "VERSION", "Define installed Kontena version", default: 'latest'
14
-
15
- def execute
16
- require_api_url
17
- require_current_grid
18
-
19
- require 'kontena/machine/packet'
20
- grid = client(require_token).get("grids/#{current_grid}")
21
- provisioner = Kontena::Machine::Packet::NodeProvisioner.new(client(require_token), token)
22
- provisioner.run!(
23
- master_uri: api_url,
24
- grid_token: grid['token'],
25
- grid: current_grid,
26
- project: project,
27
- billing: billing,
28
- ssh_key: ssh_key,
29
- plan: plan,
30
- facility: facility,
31
- version: version
32
- )
33
- end
34
- end
35
- end
@@ -1,17 +0,0 @@
1
- module Kontena::Cli::Nodes::Packet
2
- class RestartCommand < Clamp::Command
3
- include Kontena::Cli::Common
4
- include Kontena::Cli::GridOptions
5
-
6
- parameter "NAME", "Node name"
7
- option "--token", "TOKEN", "Packet API token", required: true
8
- option "--project", "PROJECT ID", "Packet project id", required: true
9
-
10
- def execute
11
- require 'kontena/machine/packet'
12
-
13
- restarter = Kontena::Machine::Packet::NodeRestarter.new(token)
14
- restarter.run!(project, name)
15
- end
16
- end
17
- end
@@ -1,20 +0,0 @@
1
- module Kontena::Cli::Nodes::Packet
2
- class TerminateCommand < Clamp::Command
3
- include Kontena::Cli::Common
4
- include Kontena::Cli::GridOptions
5
-
6
- parameter "NAME", "Node name"
7
- option "--token", "TOKEN", "Packet API token", required: true
8
- option "--project", "PROJECT ID", "Packet project id", required: true
9
-
10
- def execute
11
- require_api_url
12
- require_current_grid
13
-
14
- require 'kontena/machine/packet'
15
- grid = client(require_token).get("grids/#{current_grid}")
16
- destroyer = Kontena::Machine::Packet::NodeDestroyer.new(client(require_token), token)
17
- destroyer.run!(grid, project, name)
18
- end
19
- end
20
- end
@@ -1,15 +0,0 @@
1
- require_relative 'packet/create_command'
2
- require_relative 'packet/restart_command'
3
- require_relative 'packet/terminate_command'
4
-
5
- module Kontena::Cli::Nodes
6
- class PacketCommand < Clamp::Command
7
-
8
- subcommand "create", "Create a new Packet node", Packet::CreateCommand
9
- subcommand "restart", "Restart a Packet node", Packet::RestartCommand
10
- subcommand "terminate", "Terminate a Packet node", Packet::TerminateCommand
11
-
12
- def execute
13
- end
14
- end
15
- end
@@ -1,33 +0,0 @@
1
- module Kontena::Cli::Nodes::Upcloud
2
- class CreateCommand < Clamp::Command
3
- include Kontena::Cli::Common
4
- include Kontena::Cli::GridOptions
5
-
6
- parameter "[NAME]", "Node name"
7
- option "--username", "USER", "Upcloud username", required: true
8
- option "--password", "PASS", "Upcloud password", required: true
9
- option "--ssh-key", "SSH_KEY", "Path to ssh public key", required: true
10
- option "--plan", "PLAN", "Server size", default: '1xCPU-1GB'
11
- option "--zone", "ZONE", "Zone", default: 'fi-hel1'
12
- option "--version", "VERSION", "Define installed Kontena version", default: 'latest'
13
-
14
- def execute
15
- require_api_url
16
- require_current_grid
17
-
18
- require 'kontena/machine/upcloud'
19
- grid = client(require_token).get("grids/#{current_grid}")
20
- provisioner = Kontena::Machine::Upcloud::NodeProvisioner.new(client(require_token), username, password)
21
- provisioner.run!(
22
- master_uri: api_url,
23
- grid_token: grid['token'],
24
- grid: current_grid,
25
- ssh_key: ssh_key,
26
- name: name,
27
- plan: plan,
28
- zone: zone,
29
- version: version
30
- )
31
- end
32
- end
33
- end
@@ -1,20 +0,0 @@
1
- module Kontena::Cli::Nodes::Upcloud
2
- class RestartCommand < Clamp::Command
3
- include Kontena::Cli::Common
4
- include Kontena::Cli::GridOptions
5
-
6
- parameter "NAME", "Node name"
7
- option "--username", "USER", "Upcloud username", required: true
8
- option "--password", "PASS", "Upcloud password", required: true
9
-
10
- def execute
11
- require_api_url
12
- require_current_grid
13
-
14
- require 'kontena/machine/upcloud'
15
-
16
- restarter = Kontena::Machine::Upcloud::NodeRestarter.new(username, password)
17
- restarter.run!(name)
18
- end
19
- end
20
- end
@@ -1,20 +0,0 @@
1
- module Kontena::Cli::Nodes::Upcloud
2
- class TerminateCommand < Clamp::Command
3
- include Kontena::Cli::Common
4
- include Kontena::Cli::GridOptions
5
-
6
- parameter "NAME", "Node name"
7
- option "--username", "USER", "Upcloud username", required: true
8
- option "--password", "PASS", "Upcloud password", required: true
9
-
10
- def execute
11
- require_api_url
12
- require_current_grid
13
-
14
- require 'kontena/machine/upcloud'
15
- grid = client(require_token).get("grids/#{current_grid}")
16
- destroyer = Kontena::Machine::Upcloud::NodeDestroyer.new(client(require_token), username, password)
17
- destroyer.run!(grid, name)
18
- end
19
- end
20
- end
@@ -1,15 +0,0 @@
1
- require_relative 'upcloud/create_command'
2
- require_relative 'upcloud/restart_command'
3
- require_relative 'upcloud/terminate_command'
4
-
5
- module Kontena::Cli::Nodes
6
- class UpcloudCommand < Clamp::Command
7
-
8
- subcommand "create", "Create a new Upcloud node", Upcloud::CreateCommand
9
- subcommand "restart", "Restart Upcloud node", Upcloud::RestartCommand
10
- subcommand "terminate", "Terminate Upcloud node", Upcloud::TerminateCommand
11
-
12
- def execute
13
- end
14
- end
15
- end
@@ -1,27 +0,0 @@
1
- module Kontena::Cli::Nodes::Vagrant
2
- class CreateCommand < Clamp::Command
3
- include Kontena::Cli::Common
4
- include Kontena::Cli::GridOptions
5
-
6
- parameter "[NAME]", "Node name"
7
- option "--memory", "MEMORY", "How much memory node has", default: '1024'
8
- option "--version", "VERSION", "Define installed Kontena version", default: 'latest'
9
-
10
- def execute
11
- require_api_url
12
- require_current_grid
13
-
14
- require 'kontena/machine/vagrant'
15
- grid = client(require_token).get("grids/#{current_grid}")
16
- provisioner = Kontena::Machine::Vagrant::NodeProvisioner.new(client(require_token))
17
- provisioner.run!(
18
- master_uri: api_url,
19
- grid_token: grid['token'],
20
- grid: current_grid,
21
- name: name,
22
- memory: memory,
23
- version: version
24
- )
25
- end
26
- end
27
- end
@@ -1,26 +0,0 @@
1
- module Kontena::Cli::Nodes::Vagrant
2
- class RestartCommand < Clamp::Command
3
- include Kontena::Cli::Common
4
- include Kontena::Cli::GridOptions
5
-
6
- parameter "NAME", "Node name"
7
-
8
- def execute
9
- require_api_url
10
- require_current_grid
11
-
12
- require 'kontena/machine/vagrant'
13
- vagrant_path = "#{Dir.home}/.kontena/#{current_grid}/#{name}"
14
- abort("Cannot find Vagrant node #{name}".colorize(:red)) unless Dir.exist?(vagrant_path)
15
- Dir.chdir(vagrant_path) do
16
- ShellSpinner "Restarting Vagrant machine #{name.colorize(:cyan)} " do
17
- Open3.popen2('vagrant reload') do |stdin, output, wait|
18
- while o = output.gets
19
- print o if ENV['DEBUG']
20
- end
21
- end
22
- end
23
- end
24
- end
25
- end
26
- end
@@ -1,21 +0,0 @@
1
- module Kontena::Cli::Nodes::Vagrant
2
- class SshCommand < Clamp::Command
3
- include Kontena::Cli::Common
4
- include Kontena::Cli::GridOptions
5
-
6
- parameter "NAME", "Node name"
7
-
8
- def execute
9
- require_api_url
10
- require_current_grid
11
-
12
- require 'kontena/machine/vagrant'
13
- vagrant_path = "#{Dir.home}/.kontena/#{current_grid}/#{name}"
14
- abort("Cannot find Vagrant node #{name}".colorize(:red)) unless Dir.exist?(vagrant_path)
15
-
16
- Dir.chdir(vagrant_path) do
17
- system('vagrant ssh')
18
- end
19
- end
20
- end
21
- end
@@ -1,26 +0,0 @@
1
- module Kontena::Cli::Nodes::Vagrant
2
- class StartCommand < Clamp::Command
3
- include Kontena::Cli::Common
4
- include Kontena::Cli::GridOptions
5
-
6
- parameter "NAME", "Node name"
7
-
8
- def execute
9
- require_api_url
10
- require_current_grid
11
-
12
- require 'kontena/machine/vagrant'
13
- vagrant_path = "#{Dir.home}/.kontena/#{current_grid}/#{name}"
14
- abort("Cannot find Vagrant node #{name}".colorize(:red)) unless Dir.exist?(vagrant_path)
15
- Dir.chdir(vagrant_path) do
16
- ShellSpinner "Starting Vagrant machine #{name.colorize(:cyan)} " do
17
- Open3.popen2('vagrant up') do |stdin, output, wait|
18
- while o = output.gets
19
- print o if ENV['DEBUG']
20
- end
21
- end
22
- end
23
- end
24
- end
25
- end
26
- end
@@ -1,26 +0,0 @@
1
- module Kontena::Cli::Nodes::Vagrant
2
- class StopCommand < Clamp::Command
3
- include Kontena::Cli::Common
4
- include Kontena::Cli::GridOptions
5
-
6
- parameter "NAME", "Node name"
7
-
8
- def execute
9
- require_api_url
10
- require_current_grid
11
-
12
- require 'kontena/machine/vagrant'
13
- vagrant_path = "#{Dir.home}/.kontena/#{current_grid}/#{name}"
14
- abort("Cannot find Vagrant node #{name}".colorize(:red)) unless Dir.exist?(vagrant_path)
15
- Dir.chdir(vagrant_path) do
16
- ShellSpinner "Stopping Vagrant machine #{name.colorize(:cyan)} " do
17
- Open3.popen2('vagrant halt') do |stdin, output, wait|
18
- while o = output.gets
19
- print o if ENV['DEBUG']
20
- end
21
- end
22
- end
23
- end
24
- end
25
- end
26
- end