aerosol 1.1.0 → 1.2.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
  SHA1:
3
- metadata.gz: 31c767638dd285ff3db576f4dacdaff662ca52e8
4
- data.tar.gz: 4052d794ed7b58ab82fd571a28ce9e9c52255458
3
+ metadata.gz: 3fe36e5e375099bfc35214d89869ebfd01a56d31
4
+ data.tar.gz: 62408a6905eee21aa2b00963bf1b7839e0bd0255
5
5
  SHA512:
6
- metadata.gz: f4b7fcfcb3958c646d6c2707a91fb9cff4b72186f679d63129872cb5d2dcfb4694282c6b0fb3b73d211dabb33cfaf77e2ddd54357c95d4aa37fd8ff2a652d92d
7
- data.tar.gz: f1240b253337fd73fd9316808ceb08d0d12676905f539c6d25469ae5431b6be43453d25a4647f080593bf0e5c948616b17f4f4c8cca0b5b11441107bed0c575a
6
+ metadata.gz: 0fb1282a4e7a02d2a6e0e2fe6f07acb8e2c09bdd2132cb8e158205db96e6ce4740fb2f86f5d203a4c5427715dbc5a1d93e6958ccdd8f0be1358d7b9b9601108b
7
+ data.tar.gz: 9494fe769e3b3a4a923768d439e5eea4ca49e549ae3223544dfd269e00aed17639e0dfcdf4d022bdd965f42afe037aef1830cf13e2c407462817058fcbb3a1e7
data/aerosol.gemspec CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |gem|
22
22
  gem.add_dependency 'grit'
23
23
  gem.add_dependency 'net-ssh'
24
24
  gem.add_dependency 'net-ssh-gateway'
25
- gem.add_dependency 'dockly-util', '~> 0.0.5'
25
+ gem.add_dependency 'dockly-util', '~> 0.1.0'
26
26
  gem.add_development_dependency 'cane'
27
27
  gem.add_development_dependency 'pry'
28
28
  gem.add_development_dependency 'rake'
@@ -1,3 +1,5 @@
1
+ require 'active_support/core_ext/object/blank'
2
+
1
3
  class Aerosol::Instance
2
4
  include Aerosol::AWSModel
3
5
 
@@ -38,10 +40,22 @@ class Aerosol::Instance
38
40
  @description ||= describe!
39
41
  end
40
42
 
43
+ def self.request_all_for_token(next_token)
44
+ options = next_token.nil? ? {} : { next_token: next_token }
45
+ Aerosol::AWS.auto_scaling.describe_auto_scaling_instances(options)
46
+ end
47
+
41
48
  def self.request_all
42
- Aerosol::AWS.auto_scaling
43
- .describe_auto_scaling_instances
44
- .auto_scaling_instances
49
+ next_token = nil
50
+ instances = []
51
+
52
+ begin
53
+ new_instances = request_all_for_token(next_token)
54
+ instances.concat(new_instances.auto_scaling_instances)
55
+ next_token = new_instances.next_token
56
+ end until next_token.nil?
57
+
58
+ instances
45
59
  end
46
60
 
47
61
  private
@@ -6,9 +6,11 @@ class Aerosol::LaunchConfiguration
6
6
  aws_attribute :launch_configuration_name, :image_id, :instance_type, :security_groups, :user_data,
7
7
  :iam_instance_profile, :kernel_id, :key_name, :spot_price, :created_time,
8
8
  :associate_public_ip_address
9
+ dsl_attribute :meta_data
9
10
 
10
11
  primary_key :launch_configuration_name
11
12
  default_value(:security_groups) { [] }
13
+ default_value(:meta_data) { {} }
12
14
 
13
15
  def launch_configuration_name(arg = nil)
14
16
  if arg
@@ -90,6 +92,12 @@ class Aerosol::LaunchConfiguration
90
92
  }}
91
93
  end
92
94
 
95
+ def corrected_user_data
96
+ realized_user_data = user_data.is_a?(Proc) ? user_data.call : user_data
97
+
98
+ Base64.encode64(Aerosol::Util.strip_heredoc(realized_user_data || ''))
99
+ end
100
+
93
101
  private
94
102
  def create_options
95
103
  { # TODO Add dsl so that 'BlockDeviceMappings' may be specified
@@ -98,7 +106,7 @@ private
98
106
  key_name: key_name,
99
107
  security_groups: security_groups,
100
108
  spot_price: spot_price,
101
- user_data: Base64.encode64(Aerosol::Util.strip_heredoc(user_data || '')),
109
+ user_data: corrected_user_data,
102
110
  associate_public_ip_address: associate_public_ip_address
103
111
  }.reject { |k, v| v.nil? }
104
112
  end
@@ -1,5 +1,5 @@
1
1
  # Copyright Swipely, Inc. All rights reserved.
2
2
 
3
3
  module Aerosol
4
- VERSION = '1.1.0'
4
+ VERSION = '1.2.0'
5
5
  end
@@ -394,4 +394,47 @@ describe Aerosol::LaunchConfiguration do
394
394
  end
395
395
  end
396
396
  end
397
+
398
+ describe '#corrected_user_data' do
399
+ let(:encoded_user_data_string) { Base64.encode64('test') }
400
+
401
+ context 'when the user_data is a String' do
402
+ subject do
403
+ described_class.new do
404
+ name :corrected_user_data
405
+ user_data 'test'
406
+ end
407
+ end
408
+
409
+ it 'correctly encodes to base64' do
410
+ expect(subject.corrected_user_data).to eq(encoded_user_data_string)
411
+ end
412
+ end
413
+
414
+ context 'when the user_data is a Proc' do
415
+ subject do
416
+ described_class.new do
417
+ name :corrected_user_data_2
418
+ user_data { 'test' }
419
+ end
420
+ end
421
+
422
+ it 'correctly encodes to base64' do
423
+ expect(subject.corrected_user_data).to eq(encoded_user_data_string)
424
+ end
425
+ end
426
+ end
427
+
428
+ describe '#meta_data' do
429
+ subject do
430
+ described_class.new do
431
+ name :my_launch_config
432
+ meta_data('Test' => '1')
433
+ end
434
+ end
435
+
436
+ it 'returns the hash' do
437
+ expect(subject.meta_data['Test']).to eq('1')
438
+ end
439
+ end
397
440
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aerosol
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Swipely, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-02 00:00:00.000000000 Z
11
+ date: 2015-07-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 0.0.5
117
+ version: 0.1.0
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 0.0.5
124
+ version: 0.1.0
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: cane
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -275,7 +275,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
275
275
  version: '0'
276
276
  requirements: []
277
277
  rubyforge_project:
278
- rubygems_version: 2.4.5
278
+ rubygems_version: 2.2.2
279
279
  signing_key:
280
280
  specification_version: 4
281
281
  summary: Instance-based deploys made easy
@@ -293,4 +293,3 @@ test_files:
293
293
  - spec/aerosol_spec.rb
294
294
  - spec/spec_helper.rb
295
295
  - spec/support/vcr.rb
296
- has_rdoc: