kontena-plugin-packet 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -4
- data/README.md +1 -2
- data/kontena-plugin-packet.gemspec +1 -1
- data/lib/kontena/machine/packet/master_provisioner.rb +3 -1
- data/lib/kontena/machine/packet/node_destroyer.rb +1 -5
- data/lib/kontena/machine/packet/packet_common.rb +14 -1
- data/lib/kontena/plugin/packet.rb +1 -1
- data/lib/kontena/plugin/packet/master/create_command.rb +6 -6
- data/lib/kontena/plugin/packet/master_command.rb +1 -7
- data/lib/kontena/plugin/packet/node_command.rb +3 -11
- data/lib/kontena/plugin/packet/nodes/create_command.rb +5 -6
- data/lib/kontena/plugin/packet/nodes/restart_command.rb +1 -2
- data/lib/kontena/plugin/packet/nodes/terminate_command.rb +10 -4
- data/lib/kontena/plugin/packet/token_option.rb +1 -1
- data/lib/kontena/plugin/packet_command.rb +2 -9
- data/lib/kontena_cli_plugin.rb +3 -3
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ad1fb71e03dea023766c8cfdab6b25c99f89050
|
4
|
+
data.tar.gz: de48c4136195379e8a5bc094ea82a8a12a9af892
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e3d7a57a42d6c0b66a95c52c66e47a7afc4b1d838f90c244ee6d75259e022a11cb4ecca9e6c20d005d09b58a0de469d94a6f5455d29756d3571a259cc63b4fe
|
7
|
+
data.tar.gz: 61112a7899b4a70ce9210a36f227fb39a1e5bc3a3befcf6bc3db04c79129f35830c68a110d338701829ae5931998d6daf21af614ca7abae6bb9add3359fd4a39
|
data/.travis.yml
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
- 2.
|
4
|
-
- 2.
|
5
|
-
- 2.
|
6
|
-
- 2.
|
3
|
+
- 2.1.10
|
4
|
+
- 2.2.6
|
5
|
+
- 2.3.3
|
6
|
+
- 2.4.1
|
7
7
|
env:
|
8
8
|
- secure: "cUyvZs8EwaLZrE1xQFNTKq4Ft6evckt2qeU3lB0PuNONYUfRli2RqOUjD8So7yiPYucNKlqJ2u641WRV4AYY8TUnu2jKFGlEEmZuYkWj0jv6HAy02vWt+d4fjgq6R4+TCW+7wKQcrN8zYH9KJImPcN9S01XqaTm4oHsaZZk4dRWL7PnKHAnnxPnpSpytF2jgtETmfOQWAfECOtR5+ypFmmmoCz+6/RPO6Ys+mIL0MbbJQxqq+FEothgoZD92cR/kzZI4YIwoijw54JlIIpRlK9Y1szfC13LxaCujYfic2ny7HnfV8tfl7lt/OVE/NQCYJfK4Bao73zMemQ2th80O68WzF9px5p5gRrPhumjT8Oxf9MTEcH46PDQprznZW0UnZF51oPGDQWDIFwLgiokalKgzR/tPHM8sm/kJs6BPlTUHxkRDWWfiSR+rIz8t94HSBK2N9mCdesIM9oNUx8tUbEvQXmVOGmpRivHr2Fa5rtv0/dbXW0Y78XyF7WNPBIeuFwDQLTTwtzbYxuhC6V0q9yV9Tos2fRqzIn1Ddc01xOjRVfnz8J8cw1su7a0SarXZgnjzWuxU6N/xMyh4QNKvJPbUAMKi243tN+QyG0Kq8nT4SL525khZBoHx1wr9sRDSjd9vgHi51/cV3YGh+9FXsFJ8kkRCE825k/gnZxo3JvA="
|
9
9
|
cache: bundler
|
@@ -14,3 +14,4 @@ deploy:
|
|
14
14
|
gem: kontena-plugin-packet
|
15
15
|
on:
|
16
16
|
tags: true
|
17
|
+
rvm: 2.4.1
|
data/README.md
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["info@kontena.io"]
|
11
11
|
|
12
12
|
spec.summary = "Kontena Packet plugin"
|
13
|
-
spec.description = "Packet
|
13
|
+
spec.description = "Kontena Packet plugin"
|
14
14
|
spec.homepage = "https://github.com/kontena/kontena-plugin-packet"
|
15
15
|
spec.license = "Apache-2.0"
|
16
16
|
|
@@ -66,7 +66,9 @@ module Kontena
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
-
public_ip =
|
69
|
+
public_ip = spinner "Looking for device public IP" do
|
70
|
+
device_public_ip(device)
|
71
|
+
end
|
70
72
|
master_url = "https://#{public_ip['address']}"
|
71
73
|
|
72
74
|
Excon.defaults[:ssl_verify_peer] = false
|
@@ -29,11 +29,7 @@ module Kontena
|
|
29
29
|
end
|
30
30
|
|
31
31
|
node = api_client.get("grids/#{grid['id']}/nodes")['nodes'].find{|n| n['name'] == name}
|
32
|
-
if node
|
33
|
-
spinner "Removing node #{name.colorize(:cyan)} from grid #{grid['name'].colorize(:cyan)} " do
|
34
|
-
api_client.delete("grids/#{grid['id']}/nodes/#{name}")
|
35
|
-
end
|
36
|
-
end
|
32
|
+
Kontena.run(['node', 'rm', '--force', '--grid', grid['name'], name]) if node
|
37
33
|
end
|
38
34
|
end
|
39
35
|
end
|
@@ -51,11 +51,24 @@ module Kontena
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def device_public_ip(device)
|
54
|
+
start_time = Time.now.to_i
|
54
55
|
api_retry "Packet API did not find a public ip address for the device" do
|
55
|
-
|
56
|
+
loop do
|
57
|
+
ip = refresh(device).ip_addresses.find{|ip| ip['public'] && ip['address_family'] == 4}
|
58
|
+
return ip if ip
|
59
|
+
sleep 0.5
|
60
|
+
raise 'Timeout while looking for device public ip' if (Time.now.to_i - start_time) > 300
|
61
|
+
end
|
56
62
|
end
|
57
63
|
end
|
58
64
|
|
65
|
+
# Reloads the device data from Packet API
|
66
|
+
# @param device [Packet::Device]
|
67
|
+
# @return refreshed_device [Packet::Device]
|
68
|
+
def refresh(device)
|
69
|
+
client.get_device(device.id)
|
70
|
+
end
|
71
|
+
|
59
72
|
# Retry API requests to recover from random tls errors
|
60
73
|
# @param [String] message Message to output when giving up
|
61
74
|
# @param [Fixnum] times Default: 5
|
@@ -1,8 +1,7 @@
|
|
1
|
-
require '
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
require_relative '../facility_option'
|
1
|
+
require 'kontena/plugin/packet/token_option'
|
2
|
+
require 'kontena/plugin/packet/project_option'
|
3
|
+
require 'kontena/plugin/packet/type_option'
|
4
|
+
require 'kontena/plugin/packet/facility_option'
|
6
5
|
|
7
6
|
module Kontena::Plugin::Packet::Master
|
8
7
|
class CreateCommand < Kontena::Command
|
@@ -22,7 +21,8 @@ module Kontena::Plugin::Packet::Master
|
|
22
21
|
option "--version", "VERSION", "Define installed Kontena version", default: 'latest'
|
23
22
|
|
24
23
|
def execute
|
25
|
-
|
24
|
+
require 'securerandom'
|
25
|
+
require 'kontena/machine/packet'
|
26
26
|
|
27
27
|
provisioner = provisioner(token)
|
28
28
|
provisioner.run!(
|
@@ -1,9 +1,3 @@
|
|
1
|
-
require_relative 'master/create_command'
|
2
|
-
|
3
1
|
class Kontena::Plugin::Packet::MasterCommand < Kontena::Command
|
4
|
-
|
5
|
-
subcommand "create", "Create a new master to Packet", Kontena::Plugin::Packet::Master::CreateCommand
|
6
|
-
|
7
|
-
def execute
|
8
|
-
end
|
2
|
+
subcommand "create", "Create a new master to Packet", load_subcommand('kontena/plugin/packet/master/create_command')
|
9
3
|
end
|
@@ -1,13 +1,5 @@
|
|
1
|
-
require_relative 'nodes/create_command'
|
2
|
-
require_relative 'nodes/restart_command'
|
3
|
-
require_relative 'nodes/terminate_command'
|
4
|
-
|
5
1
|
class Kontena::Plugin::Packet::NodeCommand < Kontena::Command
|
6
|
-
|
7
|
-
subcommand "
|
8
|
-
subcommand "
|
9
|
-
subcommand "terminate", "Terminate a Packet node", Kontena::Plugin::Packet::Nodes::TerminateCommand
|
10
|
-
|
11
|
-
def execute
|
12
|
-
end
|
2
|
+
subcommand "create", "Create a new node to Packet", load_subcommand('kontena/plugin/packet/nodes/create_command')
|
3
|
+
subcommand "restart", "Restart a Packet node", load_subcommand('kontena/plugin/packet/nodes/restart_command')
|
4
|
+
subcommand "terminate", "Terminate a Packet node", load_subcommand('kontena/plugin/packet/nodes/terminate_command')
|
13
5
|
end
|
@@ -1,7 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
require 'kontena/plugin/packet/token_option'
|
2
|
+
require 'kontena/plugin/packet/project_option'
|
3
|
+
require 'kontena/plugin/packet/type_option'
|
4
|
+
require 'kontena/plugin/packet/facility_option'
|
5
5
|
|
6
6
|
module Kontena::Plugin::Packet::Nodes
|
7
7
|
class CreateCommand < Kontena::Command
|
@@ -21,8 +21,7 @@ module Kontena::Plugin::Packet::Nodes
|
|
21
21
|
def execute
|
22
22
|
require_api_url
|
23
23
|
require_current_grid
|
24
|
-
|
25
|
-
require_relative '../../../machine/packet'
|
24
|
+
require 'kontena/machine/packet'
|
26
25
|
grid = fetch_grid
|
27
26
|
provisioner = provisioner(client, token)
|
28
27
|
provisioner.run!(
|
@@ -8,8 +8,7 @@ module Kontena::Plugin::Packet::Nodes
|
|
8
8
|
option "--project", "PROJECT ID", "Packet project id", required: true
|
9
9
|
|
10
10
|
def execute
|
11
|
-
|
12
|
-
|
11
|
+
require 'kontena/machine/packet'
|
13
12
|
restarter = Kontena::Machine::Packet::NodeRestarter.new(token)
|
14
13
|
restarter.run!(project, name)
|
15
14
|
end
|
@@ -1,17 +1,23 @@
|
|
1
|
+
require 'kontena/plugin/packet/token_option'
|
2
|
+
require 'kontena/plugin/packet/project_option'
|
3
|
+
|
1
4
|
module Kontena::Plugin::Packet::Nodes
|
2
5
|
class TerminateCommand < Kontena::Command
|
3
6
|
include Kontena::Cli::Common
|
4
7
|
include Kontena::Cli::GridOptions
|
5
8
|
|
6
9
|
parameter "NAME", "Node name"
|
7
|
-
|
8
|
-
|
10
|
+
|
11
|
+
include Kontena::Plugin::Packet::TokenOption
|
12
|
+
include Kontena::Plugin::Packet::ProjectOption
|
13
|
+
|
14
|
+
option '--force', :flag, 'Force terminate'
|
9
15
|
|
10
16
|
def execute
|
17
|
+
confirm_command(name) unless force?
|
11
18
|
require_api_url
|
12
19
|
require_current_grid
|
13
|
-
|
14
|
-
require_relative '../../../machine/packet'
|
20
|
+
require 'kontena/machine/packet'
|
15
21
|
grid = client(require_token).get("grids/#{current_grid}")
|
16
22
|
destroyer = destroyer(client(require_token), token)
|
17
23
|
destroyer.run!(grid, project, name)
|
@@ -4,7 +4,7 @@ module Kontena::Plugin::Packet
|
|
4
4
|
base.option "--token", "TOKEN", "Packet API token", environment_variable: 'PACKET_TOKEN'
|
5
5
|
base.class_eval do
|
6
6
|
def default_token
|
7
|
-
Kontena.prompt.ask("Packet API token:")
|
7
|
+
Kontena.prompt.ask("Packet API token:", echo: false)
|
8
8
|
end
|
9
9
|
end
|
10
10
|
end
|
@@ -1,11 +1,4 @@
|
|
1
|
-
require_relative 'packet/master_command'
|
2
|
-
require_relative 'packet/node_command'
|
3
|
-
|
4
1
|
class Kontena::Plugin::PacketCommand < Kontena::Command
|
5
|
-
|
6
|
-
subcommand '
|
7
|
-
subcommand 'node', 'Packet node related commands', Kontena::Plugin::Packet::NodeCommand
|
8
|
-
|
9
|
-
def execute
|
10
|
-
end
|
2
|
+
subcommand 'master', 'Packet master related commands', load_subcommand('kontena/plugin/packet/master_command')
|
3
|
+
subcommand 'node', 'Packet node related commands', load_subcommand('kontena/plugin/packet/node_command')
|
11
4
|
end
|
data/lib/kontena_cli_plugin.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'kontena_cli'
|
2
|
-
|
3
|
-
|
2
|
+
require 'kontena/plugin/packet'
|
3
|
+
require 'kontena/cli/subcommand_loader'
|
4
4
|
|
5
|
-
Kontena::MainCommand.register("packet", "Packet specific commands", Kontena::
|
5
|
+
Kontena::MainCommand.register("packet", "Packet specific commands", Kontena::Cli::SubcommandLoader.new('kontena/plugin/packet_command'))
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kontena-plugin-packet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kontena, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kontena-cli
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '10.0'
|
69
|
-
description: Packet
|
69
|
+
description: Kontena Packet plugin
|
70
70
|
email:
|
71
71
|
- info@kontena.io
|
72
72
|
executables: []
|
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
122
|
version: '0'
|
123
123
|
requirements: []
|
124
124
|
rubyforge_project:
|
125
|
-
rubygems_version: 2.4.
|
125
|
+
rubygems_version: 2.4.5
|
126
126
|
signing_key:
|
127
127
|
specification_version: 4
|
128
128
|
summary: Kontena Packet plugin
|