capistrano-asg 0.6.1 → 0.7.0

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
  SHA256:
3
- metadata.gz: 1680ae513823f0f0424fd658bb227f17fda46ab729aa3e9f6d587aba46a857a4
4
- data.tar.gz: 92ba04736530880bd4e8711ade8b9a035893288ea48207112612de9d7c724682
3
+ metadata.gz: c5cf7466ccf300560f72599cca1617b23dc97a0fc9fb47f555d947e4aed9754f
4
+ data.tar.gz: f2dae7eaf2acbfacc9d5aef30e92b18c77584ad4f0958cee985992b6d0ff85dc
5
5
  SHA512:
6
- metadata.gz: 85390054c2513c1a0f941b2bf6d4f55d7a3ccfa56fc4ad5bd0f9d67eee9bdbb787c31f4c00c58ef6f17b975e1e0da4b5d3b7694fd53b5fd3ace450d893dccd82
7
- data.tar.gz: 85737a500e447723154316b37845f424ac3bde6a51bc785f94c9c9f182eaff3b4df3c3489dee7e90be280b20a37135fe82fb4523dda05fcfba96d1fdf90eb973
6
+ metadata.gz: 476cf23e974d98864f846cf4153b21a670b4c215f5d2edb2c866a564938bb5c6050ed32a4ceffd0667b51b0dbd230d9bc1186be1b20b0f0b667ced90fc305a29
7
+ data.tar.gz: ebe4e1fc3dc267076174e5d89d676694d2bfa212e7a6769c81c99f49bebeceaf5cc314df07f3110748d7ac6b2ccf5b37cbe40e3f437fef6d537779ea6315f2c2
@@ -2,14 +2,17 @@ language: ruby
2
2
  cache: bundler
3
3
  rvm:
4
4
  - 2.3.3
5
- - 2.4.1
5
+ - 2.4.3
6
+ - 2.5.1
6
7
  sudo: false
7
8
  env:
8
9
  - AWS_REGION: us-west-2
10
+ - AWS_ACCESS_KEY_ID: AK123456789
11
+ - AWS_SECRET_ACCESS_KEY: abcdefg123456
9
12
  deploy:
10
13
  provider: rubygems
11
14
  gem:
12
15
  master: capistrano-asg
13
16
  on:
14
- repo: sixfeetover/capistrano-asg
17
+ repo: veracross/capistrano-asg
15
18
  branch: master
@@ -1,6 +1,12 @@
1
+ # 0.7.0
2
+
3
+ * Update to AWS SDK v3. Thanks @jpatters and @milgner
4
+ * Set iam_instance_profile on newly created launch configurations
5
+
1
6
  # 0.6.1
2
7
 
3
8
  * Provide a way to bypass new AMI/LC generation by setting `set :create_ami, false`.
9
+
4
10
  # 0.6.0
5
11
 
6
12
  * Breaking change/bug fix: Region-specific settings were not being preserved. A
@@ -26,7 +26,8 @@ Gem::Specification.new do |spec|
26
26
  spec.add_development_dependency 'webmock'
27
27
  spec.add_development_dependency 'byebug'
28
28
 
29
- spec.add_dependency 'aws-sdk', '~> 2'
29
+ spec.add_dependency 'aws-sdk-ec2', '~> 1'
30
+ spec.add_dependency 'aws-sdk-autoscaling', '~> 1'
30
31
  spec.add_dependency 'capistrano', '> 3.0.0'
31
32
  spec.add_dependency 'activesupport', '>= 4.0.0'
32
33
  end
@@ -1,4 +1,5 @@
1
- require 'aws-sdk'
1
+ require 'aws-sdk-ec2'
2
+ require 'aws-sdk-autoscaling'
2
3
  require 'capistrano/all'
3
4
  require 'active_support/concern'
4
5
 
@@ -7,6 +8,7 @@ require 'capistrano/asg/retryable'
7
8
  require 'capistrano/asg/taggable'
8
9
  require 'capistrano/asg/logger'
9
10
  require 'capistrano/asg/aws/credentials'
11
+ require 'capistrano/asg/aws/region'
10
12
  require 'capistrano/asg/aws/autoscaling'
11
13
  require 'capistrano/asg/aws/ec2'
12
14
  require 'capistrano/asg/aws_resource'
@@ -18,7 +20,6 @@ module Capistrano
18
20
  end
19
21
  end
20
22
 
21
- require 'aws-sdk'
22
23
  require 'capistrano/dsl'
23
24
 
24
25
  load File.expand_path('../asg/tasks/asg.rake', __FILE__)
@@ -7,10 +7,11 @@ module Capistrano
7
7
  module AutoScaling
8
8
  extend ActiveSupport::Concern
9
9
  include Credentials
10
+ include Region
10
11
  include Capistrano::DSL
11
12
 
12
13
  def autoscaling_client
13
- @_autoscaling_client ||= ::Aws::AutoScaling::Client.new(credentials)
14
+ @_autoscaling_client ||= ::Aws::AutoScaling::Client.new(region: region, credentials: credentials)
14
15
  end
15
16
 
16
17
  def autoscaling_resource
@@ -8,11 +8,9 @@ module Capistrano
8
8
  include Capistrano::DSL
9
9
 
10
10
  def credentials
11
- {
12
- access_key_id: fetch(:aws_access_key_id, ENV['AWS_ACCESS_KEY_ID']),
13
- secret_access_key: fetch(:aws_secret_access_key, ENV['AWS_SECRET_ACCESS_KEY']),
14
- region: fetch(:aws_region, ENV['AWS_REGION'])
15
- }
11
+ access_key_id = fetch(:aws_access_key_id, ENV['AWS_ACCESS_KEY_ID'])
12
+ secret_access_key = fetch(:aws_secret_access_key, ENV['AWS_SECRET_ACCESS_KEY'])
13
+ ::Aws::Credentials.new(access_key_id, secret_access_key)
16
14
  end
17
15
  end
18
16
  end
@@ -7,6 +7,7 @@ module Capistrano
7
7
  module EC2
8
8
  extend ActiveSupport::Concern
9
9
  include Credentials
10
+ include Region
10
11
  include Capistrano::DSL
11
12
 
12
13
  def ec2_resource
@@ -20,7 +21,7 @@ module Capistrano
20
21
  private
21
22
 
22
23
  def ec2_client
23
- ::Aws::EC2::Client.new(credentials)
24
+ ::Aws::EC2::Client.new(region: region, credentials: credentials)
24
25
  end
25
26
  end
26
27
  end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Capistrano
4
+ module Asg
5
+ module Aws
6
+ module Region
7
+ extend ActiveSupport::Concern
8
+ include Capistrano::DSL
9
+
10
+ def region
11
+ fetch(:aws_region, ENV['AWS_REGION'])
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -22,7 +22,7 @@ module Capistrano
22
22
  private
23
23
 
24
24
  def base_ec2_instance
25
- autoscaling_group.instances[0]
25
+ autoscaling_group.instances.first
26
26
  end
27
27
 
28
28
  def environment
@@ -4,7 +4,7 @@ module Capistrano
4
4
  class LaunchConfiguration < AWSResource
5
5
  attr_reader :region_config
6
6
 
7
- def self.create(ami, region_config, &_block)
7
+ def self.create(ami, region_config = {}, &_block)
8
8
  lc = new(region_config)
9
9
  lc.cleanup do
10
10
  lc.save(ami)
@@ -19,6 +19,7 @@ module Capistrano
19
19
  def save(ami)
20
20
  info "Creating an EC2 Launch Configuration for AMI: #{ami.aws_counterpart.id}"
21
21
  ec2_instance = ec2_resource.instance(base_ec2_instance.id)
22
+
22
23
  with_retry do
23
24
  @aws_counterpart = autoscaling_resource.create_launch_configuration(
24
25
  launch_configuration_name: name,
@@ -29,7 +30,8 @@ module Capistrano
29
30
  instance_monitoring: {
30
31
  enabled: fetch(:aws_launch_configuration_detailed_instance_monitoring, true)
31
32
  },
32
- user_data: region_config.fetch(:aws_launch_configuration_user_data, nil)
33
+ user_data: region_config.fetch(:aws_launch_configuration_user_data, nil),
34
+ iam_instance_profile: ec2_instance.iam_instance_profile.arn
33
35
  )
34
36
  end
35
37
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Capistrano
4
4
  module Asg
5
- VERSION = '0.6.1'
5
+ VERSION = '0.7.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-asg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Logan Serman
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2018-02-09 00:00:00.000000000 Z
13
+ date: 2018-06-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -83,19 +83,33 @@ dependencies:
83
83
  - !ruby/object:Gem::Version
84
84
  version: '0'
85
85
  - !ruby/object:Gem::Dependency
86
- name: aws-sdk
86
+ name: aws-sdk-ec2
87
87
  requirement: !ruby/object:Gem::Requirement
88
88
  requirements:
89
89
  - - "~>"
90
90
  - !ruby/object:Gem::Version
91
- version: '2'
91
+ version: '1'
92
92
  type: :runtime
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
96
  - - "~>"
97
97
  - !ruby/object:Gem::Version
98
- version: '2'
98
+ version: '1'
99
+ - !ruby/object:Gem::Dependency
100
+ name: aws-sdk-autoscaling
101
+ requirement: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - "~>"
104
+ - !ruby/object:Gem::Version
105
+ version: '1'
106
+ type: :runtime
107
+ prerelease: false
108
+ version_requirements: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - "~>"
111
+ - !ruby/object:Gem::Version
112
+ version: '1'
99
113
  - !ruby/object:Gem::Dependency
100
114
  name: capistrano
101
115
  requirement: !ruby/object:Gem::Requirement
@@ -150,6 +164,7 @@ files:
150
164
  - lib/capistrano/asg/aws/autoscaling.rb
151
165
  - lib/capistrano/asg/aws/credentials.rb
152
166
  - lib/capistrano/asg/aws/ec2.rb
167
+ - lib/capistrano/asg/aws/region.rb
153
168
  - lib/capistrano/asg/aws_resource.rb
154
169
  - lib/capistrano/asg/launch_configuration.rb
155
170
  - lib/capistrano/asg/logger.rb