stemcell 0.12.1 → 0.12.2

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: 0311d6f13f75e1e7e52496b9491eb5768c13eb35
4
- data.tar.gz: 67d5f0c43c6fbc5a81139ff8773a82027bd4fd99
3
+ metadata.gz: 42199bc80153e575d437ce9c618b662e6861af3e
4
+ data.tar.gz: 53e93477347e08429b03e74b4580d4cc714c424d
5
5
  SHA512:
6
- metadata.gz: 1d0e45ae07c7c9995d1c11198b0c6ba9991bc1e71e38fcdc6abf5e460ba91abcb52c45b27142c31b3a282738a86b8e53a3522be13f89e71c4b8f22229b2c8cbf
7
- data.tar.gz: 27fc12f639c4b446edd1439e28d82d3dd078c807bbb2206f21b49fd73af1809d4543b86f6d3477ceaa797d4c93b0ce68d02d7038416a9b462e022bd8a3ffab10
6
+ metadata.gz: 67d1742a36a3f003a849651d9f7b899414a738ce2ea2a684efaf77bee1399fc65d824c174a28abdf981c2aa739e137d973589d29b2a15ef8e94dfcc94e9f1b3d
7
+ data.tar.gz: 0e916fa0c134eb26ff01cba67c6b1e90ae921fa932940f3596a5d09b0607a52abae2b99099d3569e3cf4b67ac4e2a91226666e32af9a250af0a33f081bbd4f71
@@ -6,4 +6,4 @@ rvm:
6
6
  - 2.2.4
7
7
  - 2.3.1
8
8
  before_install:
9
- - gem install bundler
9
+ - gem install bundler -v 1.16.3
@@ -1,3 +1,6 @@
1
+ # 0.12.2
2
+ - Support for using a custom EC2 endpoint
3
+
1
4
  # 0.12.1
2
5
  - Add support for Amazon Linux to the default bootstrap script
3
6
  - Allow setting backing_store options per region
@@ -9,10 +9,14 @@
9
9
 
10
10
  "backing_store": {
11
11
  "ebs": {
12
- "image_id": "ami-23d9a94a"
12
+ "us-east-1": {
13
+ "image_id": "ami-23d9a94a"
14
+ }
13
15
  },
14
16
  "instance_store": {
15
- "image_id": "ami-d9d6a6b0"
17
+ "us-east-1": {
18
+ "image_id": "ami-d9d6a6b0"
19
+ }
16
20
  }
17
21
  },
18
22
 
@@ -75,6 +75,7 @@ module Stemcell
75
75
 
76
76
  @region = opts['region']
77
77
  @vpc_id = opts['vpc_id']
78
+ @ec2_endpoint = opts['ec2_endpoint']
78
79
  @aws_access_key = opts['aws_access_key']
79
80
  @aws_secret_key = opts['aws_secret_key']
80
81
  @aws_session_token = opts['aws_session_token']
@@ -315,7 +316,7 @@ module Stemcell
315
316
  def get_vpc_security_group_ids(vpc_id, group_names)
316
317
  group_map = {}
317
318
  @log.info "resolving security groups #{group_names} in #{vpc_id}"
318
- vpc = AWS::EC2::VPC.new(vpc_id, :ec2_endpoint => "ec2.#{@region}.amazonaws.com")
319
+ vpc = AWS::EC2::VPC.new(vpc_id)
319
320
  vpc.security_groups.each do |sg|
320
321
  next if sg.vpc_id != vpc_id
321
322
  group_map[sg.name] = sg.group_id
@@ -433,13 +434,10 @@ module Stemcell
433
434
  def ec2
434
435
  return @ec2 if @ec2
435
436
 
436
- # calculate our ec2 url
437
- ec2_url = "ec2.#{@region}.amazonaws.com"
438
-
439
437
  if @vpc_id
440
- @ec2 = AWS::EC2::VPC.new(@vpc_id, :ec2_endpoint => ec2_url)
438
+ @ec2 = AWS::EC2::VPC.new(@vpc_id)
441
439
  else
442
- @ec2 = AWS::EC2.new(:ec2_endpoint => ec2_url)
440
+ @ec2 = AWS::EC2.new
443
441
  end
444
442
 
445
443
  @ec2
@@ -457,6 +455,9 @@ module Stemcell
457
455
  def configure_aws_creds_and_region
458
456
  # configure AWS with creds/region
459
457
  aws_configs = {:region => @region}
458
+ aws_configs.merge!({
459
+ :ec2_endpoint => @ec2_endpoint
460
+ }) if @ec2_endpoint
460
461
  aws_configs.merge!({
461
462
  :access_key_id => @aws_access_key,
462
463
  :secret_access_key => @aws_secret_key
@@ -101,6 +101,7 @@ module Stemcell
101
101
  'region' => options['region'],
102
102
  'vpc_id' => options['vpc_id'],
103
103
  'max_attempts' => options['batch_operation_retries'],
104
+ 'ec2_endpoint' => options['ec2_endpoint'],
104
105
  })
105
106
  # Slice off just the options used for launching.
106
107
  launch_options = {}
@@ -42,6 +42,12 @@ module Stemcell
42
42
  :env => 'AWS_SESSION_TOKEN',
43
43
  :hide => true
44
44
  },
45
+ {
46
+ :name => 'ec2_endpoint',
47
+ :desc => 'EC2 endpoint',
48
+ :type => String,
49
+ :env => 'EC2_ENDPOINT',
50
+ },
45
51
  {
46
52
  :name => 'region',
47
53
  :desc => "ec2 region to launch in",
@@ -1,3 +1,3 @@
1
1
  module Stemcell
2
- VERSION = "0.12.1"
2
+ VERSION = "0.12.2"
3
3
  end
@@ -195,4 +195,18 @@ describe Stemcell::Launcher do
195
195
  expect(AWS.config.region).to be_eql('ap-northeast-1')
196
196
  end
197
197
  end
198
+
199
+ describe '#ec2' do
200
+ it 'can return a client with regional endpoint' do
201
+ launcher = Stemcell::Launcher.new({'region' => 'region1', 'ec2_endpoint' => nil})
202
+ client = launcher.send(:ec2)
203
+ expect(client.config.ec2_endpoint).to be_eql('ec2.region1.amazonaws.com')
204
+ end
205
+
206
+ it 'can return a client with custom endpoint' do
207
+ launcher = Stemcell::Launcher.new({'region' => 'region1', 'ec2_endpoint' => 'endpoint1'})
208
+ client = launcher.send(:ec2)
209
+ expect(client.config.ec2_endpoint).to be_eql('endpoint1')
210
+ end
211
+ end
198
212
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stemcell
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.1
4
+ version: 0.12.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Rhoads
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2018-08-02 00:00:00.000000000 Z
14
+ date: 2019-06-18 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: aws-sdk-v1