kontena-plugin-aws 0.2.6 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 25f871612168855c6a2becb9e555b0ba53a2d6ed
4
- data.tar.gz: 2047bf67a773fa58f09f9445ab61b65e682e600b
3
+ metadata.gz: ae87022c9186594dc522a5eced7bbd4758360822
4
+ data.tar.gz: eec88a482f9dfcde351b10f1ea324d7f323cb747
5
5
  SHA512:
6
- metadata.gz: 0268b7dfe2cbf7a9b600205afd8b72bb217ad2bc37997e3adafcfc324c7a6b4ac4eb3f625b8c0010ab9f764f79cfa307a86b50bbe51014ce2170b17261fc1198
7
- data.tar.gz: 8dc3ef5d935815aa0bc18be4d9ed34dc86d9dd9e522c34dd14486a38e406150ea7f6849a5b3135b09e5d6386bc4ee22ead53725c19a2d8a11bbaa5719a50aeee
6
+ metadata.gz: dce564e74e064e04230e13c21f3072cf86ab545fb1756439fd3165bd61776a6a03e0790f0d2b8f7e53812da399114be16f167bd6200dee915ca352220a821054
7
+ data.tar.gz: 529812334bef114118e1990f1a72450dcefe46f391ec4e565d2b0f5d97c7dffa125393047f4cefe4442cb7f688a75a21bd9006b9b99436b5eed756aac34c434b
data/.travis.yml CHANGED
@@ -1,9 +1,9 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.0.0-p648
4
- - 2.1.8
5
- - 2.2.3
6
- - 2.3.1
3
+ - 2.1.10
4
+ - 2.2.6
5
+ - 2.3.3
6
+ - 2.4.1
7
7
  env:
8
8
  - secure: "JgI//AQcXde0SoT07sOCeQEuIR1jSz1mDa0O6riCcHSDWnPKo1KN91oJl9W4nY44sXOKhpc09HmQLOYP0QpK4GspD5zIAO5txeLpbOz0KDPkp15/oC3w6w1Q2A++V3Q+/6XnNIHaR/0/o2o0SAZgAFzHdOjwW9lAZoM1aydLX11TSGpTj88bqfz/gf0WfV+bOhSxtxgiH2h+I66RA2lc+MnWITfEhsXkc+blbHArXJc6gLXVO1/ks5WE4eEzTB7n7XM1WGvLm3sYmOZ+onphO8YESoYqkGmNR/5nSrMlHwHbn70HqR3IDUUe4G+tpYOVTX2odgeJTZMuH/V9Dy9LpyNqiOgX8cYbE9/GhnVlSjbMBK99m8m8trT49E9zEKIcmhUMQsI4YCfTdP+hfALcGRMB93XGrQNirvEjORw5kxNYg9Um3UPBeNYSKEbNE58zASF/d9/08tT9cQIOEo2OQCs6zkiuGUrnCTZYdnNWh2xY+sPpoDcnvGMb3h2lzvM4hkbf6HfMIEBLbi8m/zgYjaXoDxpxXyDH9TKkq8zO6/1koGaQQGhLW9ojtYGbpH6BOdWysxJVUk1rRUs3Q39kqRW+diS04cb/ipywfHzw/SbmqdaVkCL/e7MFjDlqiqRdNVUYGnZ65ZUTkgJo/2kuTuKXutar8qaBBvILfVZ4Hno="
9
9
  cache: bundler
@@ -14,3 +14,4 @@ deploy:
14
14
  gem: kontena-plugin-aws
15
15
  on:
16
16
  tags: true
17
+ rvm: 2.4.1
@@ -1,6 +1,17 @@
1
1
  module Kontena
2
2
  module Machine
3
3
  module Aws
4
+ def ssl_fail_message(used_option = false)
5
+ if used_option
6
+ "AWS SSL certificate verify failed.\n" +
7
+ "You may need to download cacert.pem and set environment variable\n" +
8
+ "SSL_CERT_FILE=/path/to/cacert.pem"
9
+ else
10
+ "AWS SSL certificate verify failed.\n" +
11
+ "Try running the command again with option --aws-bundled-cert"
12
+ end
13
+ end
14
+ module_function :ssl_fail_message
4
15
  end
5
16
  end
6
17
  end
@@ -1,7 +1,7 @@
1
1
  module Kontena
2
2
  module Plugin
3
3
  module Aws
4
- VERSION = "0.2.6"
4
+ VERSION = "0.2.7"
5
5
  end
6
6
  end
7
7
  end
@@ -23,9 +23,13 @@ module Kontena::Plugin::Aws::Master
23
23
  option "--version", "VERSION", "Define installed Kontena version", default: 'latest'
24
24
  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
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
+ option "--aws-bundled-cert", :flag, "Use CA certificate bundled in AWS SDK", default: false
26
27
 
27
28
  def execute
28
29
  require_relative '../../../machine/aws'
30
+
31
+ Aws.use_bundled_cert! if aws_bundled_cert?
32
+
29
33
  aws_access_key = ask_aws_access_key
30
34
  aws_secret_key = ask_aws_secret_key
31
35
  aws_region = ask_aws_region(aws_access_key, aws_secret_key)
@@ -55,6 +59,9 @@ module Kontena::Plugin::Aws::Master
55
59
  security_groups: security_groups,
56
60
  initial_admin_code: SecureRandom.hex(16)
57
61
  )
62
+ rescue Seahorse::Client::NetworkingError => ex
63
+ raise ex unless ex.message.match(/certificate verify failed/)
64
+ exit_with_error Kontena::Machine::Aws.ssl_fail_message(aws_bundled_cert?)
58
65
  end
59
66
 
60
67
  def provisioner(access_key, secret_key, region)
@@ -18,13 +18,15 @@ module Kontena::Plugin::Aws::Nodes
18
18
  option "--version", "VERSION", "Define installed Kontena version", default: 'latest'
19
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
+ option "--aws-bundled-cert", :flag, "Use CA certificate bundled in AWS SDK", default: false
21
22
 
22
23
  requires_current_master
23
24
 
24
25
  def execute
25
26
  require_current_grid
26
-
27
27
  require_relative '../../../machine/aws'
28
+ Aws.use_bundled_cert! if aws_bundled_cert?
29
+
28
30
  grid = fetch_grid(current_grid)
29
31
  aws_access_key = ask_aws_access_key
30
32
  aws_secret_key = ask_aws_secret_key
@@ -54,6 +56,9 @@ module Kontena::Plugin::Aws::Nodes
54
56
  associate_public_ip: associate_public_ip?,
55
57
  security_groups: security_groups
56
58
  )
59
+ rescue Seahorse::Client::NetworkingError => ex
60
+ raise ex unless ex.message.match(/certificate verify failed/)
61
+ exit_with_error Kontena::Machine::Aws.ssl_fail_message(aws_bundled_cert?)
57
62
  end
58
63
 
59
64
  # @param [String] id
@@ -8,6 +8,7 @@ module Kontena::Plugin::Aws::Nodes
8
8
  option "--access-key", "ACCESS_KEY", "AWS access key ID", environment_variable: "AWS_ACCESS_KEY_ID"
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
+ option "--aws-bundled-cert", :flag, "Use CA certificate bundled in AWS SDK", default: false
11
12
 
12
13
  requires_current_master
13
14
 
@@ -20,9 +21,13 @@ module Kontena::Plugin::Aws::Nodes
20
21
  aws_secret_key = ask_aws_secret_key
21
22
  aws_region = self.region || resolve_or_ask_region(node, aws_access_key, aws_secret_key)
22
23
  require_relative '../../../machine/aws'
24
+ Aws.use_bundled_cert! if aws_bundled_cert?
23
25
 
24
26
  restarter = restarter(aws_access_key, aws_secret_key, aws_region)
25
27
  restarter.run!(node_name)
28
+ rescue Seahorse::Client::NetworkingError => ex
29
+ raise ex unless ex.message.match(/certificate verify failed/)
30
+ exit_with_error Kontena::Machine::Aws.ssl_fail_message(aws_bundled_cert?)
26
31
  end
27
32
 
28
33
  def restarter(access_key, secret_key, region)
@@ -9,6 +9,7 @@ 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 (default: node's region)", environment_variable: "AWS_REGION"
11
11
  option "--force", :flag, "Force remove", default: false, attribute_name: :forced
12
+ option "--aws-bundled-cert", :flag, "Use CA certificate bundled in AWS SDK", default: false
12
13
 
13
14
  requires_current_master
14
15
 
@@ -23,9 +24,14 @@ module Kontena::Plugin::Aws::Nodes
23
24
 
24
25
  confirm_command(node_name) unless forced?
25
26
  require_relative '../../../machine/aws'
27
+ Aws.use_bundled_cert! if aws_bundled_cert?
28
+
26
29
  grid = client.get("grids/#{current_grid}")
27
30
  destroyer = destroyer(aws_access_key, aws_secret_key, aws_region)
28
31
  destroyer.run!(grid, node_name)
32
+ rescue Seahorse::Client::NetworkingError => ex
33
+ raise ex unless ex.message.match(/certificate verify failed/)
34
+ exit_with_error Kontena::Machine::Aws.ssl_fail_message(aws_bundled_cert?)
29
35
  end
30
36
 
31
37
  def destroyer(access_key, secret_key, region)
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.6
4
+ version: 0.2.7
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-03-20 00:00:00.000000000 Z
11
+ date: 2017-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kontena-cli