kontena-plugin-aws 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3ca8c2bc0d5ee4a945f734701b60e5a8a29707c2
4
- data.tar.gz: 63a8134d04363b9d990ab02169c62a88ffa8048e
3
+ metadata.gz: a28182797e437cd768edcfe0389d8e1f6d5697e2
4
+ data.tar.gz: e2a8e7500f1054b2adcd5d91368c7c8a1a732749
5
5
  SHA512:
6
- metadata.gz: d18bf736802ed123874a7288bf757ad5e73dd25dbe337713dab047d8f7779bac64f1ffacdc7e46607c472dc9cda9a84e88d0772e876bcf1a88917bdac9af4a78
7
- data.tar.gz: b05b77d2e41b8c9644078593fccab320248a8c824fbb2ffc7fc7faad986fb0baddf19f6fa18022095a0da34a09166b70283ee224bc434578f51cc35a30fc0ccf
6
+ metadata.gz: 6c1626f39fcfefdadf18521db20521ea5ebf6e1c146d599a499f41eea80dcfc3be2b2ade3d1591d385c4a59545a0f415de1a9575e1051f080da721c0726eddcb
7
+ data.tar.gz: da43074a23370c4913c151c931c3ed2bab55e67177aabaff9c83ec7fcd0332e8d5410c6517e4e193319454fa97d67d3d49d42ea9454db85bb25f2742918e920c
@@ -1,7 +1,7 @@
1
1
  module Kontena
2
2
  module Plugin
3
3
  module Aws
4
- VERSION = "0.2.4"
4
+ VERSION = "0.2.5"
5
5
  end
6
6
  end
7
7
  end
@@ -25,7 +25,7 @@ module Kontena::Plugin::Aws::Master
25
25
  option "--security-groups", "SECURITY_GROUPS", "Comma separated list of security groups (names) where the new instance will be attached (default: create 'kontena_master' group if not already existing)"
26
26
 
27
27
  def execute
28
- require 'kontena/machine/aws'
28
+ require_relative '../../../machine/aws'
29
29
  aws_access_key = ask_aws_access_key
30
30
  aws_secret_key = ask_aws_secret_key
31
31
  aws_region = ask_aws_region(aws_access_key, aws_secret_key)
@@ -16,14 +16,15 @@ module Kontena::Plugin::Aws::Nodes
16
16
  option "--storage", "STORAGE", "Storage size (GiB)"
17
17
  option "--count", "COUNT", "How many instances to create"
18
18
  option "--version", "VERSION", "Define installed Kontena version", default: 'latest'
19
- option "--associate-public-ip-address", :flag, "Whether to associated public IP in case the VPC defaults to not doing it", default: true, attribute_name: :associate_public_ip
19
+ option "--[no-]associate-public-ip-address", :flag, "Whether to associated public IP in case the VPC defaults to not doing it", default: true, attribute_name: :associate_public_ip
20
20
  option "--security-groups", "SECURITY GROUPS", "Comma separated list of security groups (names) where the new instance will be attached (default: create grid specific group if not already existing)"
21
21
 
22
+ requires_current_master
23
+
22
24
  def execute
23
- require_api_url
24
25
  require_current_grid
25
26
 
26
- require 'kontena/machine/aws'
27
+ require_relative '../../../machine/aws'
27
28
  grid = fetch_grid(current_grid)
28
29
  aws_access_key = ask_aws_access_key
29
30
  aws_secret_key = ask_aws_secret_key
@@ -36,7 +37,7 @@ module Kontena::Plugin::Aws::Nodes
36
37
  aws_type = ask_aws_instance_type
37
38
  aws_storage = ask_aws_storage
38
39
  aws_count = ask_instance_count
39
- provisioner = provisioner(client(require_token), aws_access_key, aws_secret_key, aws_region)
40
+ provisioner = provisioner(client, aws_access_key, aws_secret_key, aws_region)
40
41
  provisioner.run!(
41
42
  master_uri: api_url,
42
43
  grid_token: grid['token'],
@@ -58,7 +59,7 @@ module Kontena::Plugin::Aws::Nodes
58
59
  # @param [String] id
59
60
  # @return [Hash]
60
61
  def fetch_grid(id)
61
- client(require_token).get("grids/#{id}")
62
+ client.get("grids/#{id}")
62
63
  end
63
64
 
64
65
  # @param [Kontena::Client] client
@@ -9,12 +9,12 @@ module Kontena::Plugin::Aws::Nodes
9
9
  option "--secret-key", "SECRET_KEY", "AWS secret access key", environment_variable: "AWS_SECRET_ACCESS_KEY"
10
10
  option "--region", "REGION", "EC2 Region", environment_variable: "AWS_REGION"
11
11
 
12
+ requires_current_master
13
+
12
14
  def execute
13
- require_api_url
14
15
  require_current_grid
15
- token = require_token
16
- node_name = self.name || ask_node(token)
17
- node = client(token).get("grids/#{current_grid}/nodes/#{node_name}")
16
+ node_name = self.name || ask_node
17
+ node = client.get("grids/#{current_grid}/nodes/#{node_name}")
18
18
 
19
19
  aws_access_key = ask_aws_access_key
20
20
  aws_secret_key = ask_aws_secret_key
@@ -6,29 +6,29 @@ module Kontena::Plugin::Aws::Nodes
6
6
 
7
7
  parameter "[NAME]", "Node name"
8
8
  option "--access-key", "ACCESS_KEY", "AWS access key ID", environment_variable: "AWS_ACCESS_KEY_ID"
9
- option "--secret-key", "SECRET_KEY", "AWS secret access key", environment_variable: "AWS_SECRET_ACCESS_KEY"
9
+ option "--secret-key", "SECRET_KEY", "AWS secret access key", environment_variable: "AWS_SECRET_ACCESS_KEY"
10
10
  option "--region", "REGION", "EC2 Region (default: node's region)", environment_variable: "AWS_REGION"
11
11
  option "--force", :flag, "Force remove", default: false, attribute_name: :forced
12
12
 
13
+ requires_current_master
14
+
13
15
  def execute
14
- require_api_url
15
16
  require_current_grid
16
17
 
17
- token = require_token
18
- node_name = self.name || ask_node(token)
19
- node = client(token).get("grids/#{current_grid}/nodes/#{node_name}")
18
+ node_name = self.name || ask_node
19
+ node = client.get("grids/#{current_grid}/nodes/#{node_name}")
20
20
  aws_access_key = ask_aws_access_key
21
21
  aws_secret_key = ask_aws_secret_key
22
22
  aws_region = self.region || resolve_or_ask_region(node, aws_access_key, aws_secret_key)
23
23
 
24
24
  confirm_command(node_name) unless forced?
25
- require 'kontena/machine/aws'
26
- grid = client(require_token).get("grids/#{current_grid}")
27
- destroyer = destroyer(client(require_token), aws_access_key, aws_secret_key, aws_region)
25
+ require_relative '../../../machine/aws'
26
+ grid = client.get("grids/#{current_grid}")
27
+ destroyer = destroyer(aws_access_key, aws_secret_key, aws_region)
28
28
  destroyer.run!(grid, node_name)
29
29
  end
30
30
 
31
- def destroyer(client, access_key, secret_key, region)
31
+ def destroyer(access_key, secret_key, region)
32
32
  Kontena::Machine::Aws::NodeDestroyer.new(client, access_key, secret_key, region)
33
33
  end
34
34
 
@@ -128,9 +128,9 @@ module Kontena::Plugin::Aws::Prompts
128
128
  end
129
129
  end
130
130
 
131
- def ask_node(token)
131
+ def ask_node
132
132
  if self.name.nil?
133
- nodes = client(token).get("grids/#{current_grid}/nodes")
133
+ nodes = client.get("grids/#{current_grid}/nodes")
134
134
  nodes = nodes['nodes'].select{ |n|
135
135
  n['labels'] && n['labels'].include?('provider=aws'.freeze)
136
136
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kontena-plugin-aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
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-01-03 00:00:00.000000000 Z
11
+ date: 2017-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kontena-cli