aws-carb 0.0.5 → 0.0.6

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: 19fc64169fc88e5ce4bdfef17a52f2d233cf74da
4
- data.tar.gz: ec9b44e8702bccb8bbabe4e3e9337de20475be3f
3
+ metadata.gz: 6bf032650347a62069764cc805a50168484e9b1a
4
+ data.tar.gz: 8e47753073f6988f85537e13dfbca80a1a77bee2
5
5
  SHA512:
6
- metadata.gz: 21bf4ccc56724803da05635bdd1de6898a782caa32761a753350c3dd74275be730cd7cdf3226049bc616bac45dc1b675b9cf28947f52fe2b8cb4b6a67a8094a5
7
- data.tar.gz: 462bd7aef352740406d6efb07373a8ed62584864c032f469c0583dcd01d581bdaac55cce468065f7f6d7b9fcd307f5822c72e21226642ba14735ca29c381a433
6
+ metadata.gz: 32849d7aff9c0cf490f7530246b8476fe278bc5aa5240b84a58132d2c88c6a369347ec387f4137faea22db2037d8b8f54733fcae91035c3eef9807a5a43ce4e0
7
+ data.tar.gz: 1f344e552169ac6c8e98ccae7bf538cb49df2c0e0a94bea6dc3ac4cfd594ae85832fa72fcfc23ed15d117587b2b3e23f2970b722b083c1592c54f48bbb419941
data/README.md CHANGED
@@ -59,9 +59,8 @@ carb -v create --user-data-template ~/.carb/templates/basic.cloud-config.erb --c
59
59
  # list all the ec2 options:
60
60
  carb help create
61
61
 
62
- #
63
- --block-device-mappings="{ :device_name => "/dev/sdc", :ebs => { :volume_size => "100G" } }"
64
-
62
+ # example with block-device-mappings..
63
+ carb -v create --user-data-template ~/.carb/templates/basic.cloud-config.erb --common-variables "{ 'hostname' => 'asdasdasasdasdsaaa' }" --block-device-mappings "{ 'device_name' => '/dev/sdc', 'ebs' => { 'volume_size' => '100G' } }"
65
64
 
66
65
 
67
66
 
@@ -105,7 +105,7 @@ module AWSCarb
105
105
  begin
106
106
  data = eval(common_variables)
107
107
  raise unless data.class == Hash
108
- cli_arguments.subcommand.config_overrides.common_variables = data.deep_symbolize_keys
108
+ cli_arguments.subcommand.config_overrides.common_variables = ActiveSupport::HashWithIndifferentAccess.new(data)
109
109
  rescue => e
110
110
  puts "# could not parse argument for --common-variables, is it a valid hash?"
111
111
  die e
@@ -118,7 +118,7 @@ module AWSCarb
118
118
  begin
119
119
  data = eval(general_variables)
120
120
  raise unless data.class == Hash
121
- cli_arguments.subcommand.config_overrides.general_variables = data.deep_symbolize_keys
121
+ cli_arguments.subcommand.config_overrides.general_variables = ActiveSupport::HashWithIndifferentAccess.new(data)
122
122
  rescue => e
123
123
  puts "# could not parse argument for --general-variables, is it a valid hash?"
124
124
  die e
@@ -131,7 +131,7 @@ module AWSCarb
131
131
  begin
132
132
  data = eval(ec2_variables)
133
133
  raise unless data.class == Hash
134
- cli_arguments.subcommand.config_overrides.ec2_variables = data.deep_symbolize_keys
134
+ cli_arguments.subcommand.config_overrides.ec2_variables = ActiveSupport::HashWithIndifferentAccess.new(data)
135
135
  rescue => e
136
136
  puts "# could not parse argument for --ec2-variables, is it a valid hash?"
137
137
  die e
@@ -144,7 +144,7 @@ module AWSCarb
144
144
  begin
145
145
  data = eval(route53_variables)
146
146
  raise unless data.class == Hash
147
- cli_arguments.subcommand.config_overrides.route53_variables = data.deep_symbolize_keys
147
+ cli_arguments.subcommand.config_overrides.route53_variables = ActiveSupport::HashWithIndifferentAccess.new(data)
148
148
  rescue => e
149
149
  puts "# could not parse argument for --route53-variables, is it a valid hash?"
150
150
  die e
@@ -157,7 +157,7 @@ module AWSCarb
157
157
  begin
158
158
  data = eval(user_data_template_variables)
159
159
  raise unless data.class == Hash
160
- cli_arguments.subcommand.config_overrides.user_data_template_variables = data.deep_symbolize_keys
160
+ cli_arguments.subcommand.config_overrides.user_data_template_variables = ActiveSupport::HashWithIndifferentAccess.new(data)
161
161
  rescue => e
162
162
  puts "# could not parse argument for --user-data-template-variables, is it a valid hash?"
163
163
  die e
@@ -204,17 +204,17 @@ module AWSCarb
204
204
 
205
205
  block_device_help = <<-HEREDOC.strip_heredoc
206
206
 
207
- :virtual_name - (String) Specifies the virtual device name.
208
- :device_name - (String) Specifies the device name (e.g., /dev/sdh).
209
- :ebs - (Hash) Specifies parameters used to automatically setup Amazon\n#{indent} EBS volumes when the instance is launched.
210
- :snapshot_id - (String) The ID of the snapshot from which the volume will be created.
211
- :volume_size - (Integer) The size of the volume, in gigabytes.
212
- :delete_on_termination - (Boolean) Specifies whether the Amazon EBS volume is\n#{indent} deleted on instance termination.
213
- :volume_type - (String) Valid values include:
207
+ virtual_name - (String) Specifies the virtual device name.
208
+ device_name - (String) Specifies the device name (e.g., /dev/sdh).
209
+ ebs - (Hash) Specifies parameters used to automatically setup Amazon\n#{indent} EBS volumes when the instance is launched.
210
+ snapshot_id - (String) The ID of the snapshot from which the volume will be created.
211
+ volume_size - (Integer) The size of the volume, in gigabytes.
212
+ delete_on_termination - (Boolean) Specifies whether the Amazon EBS volume is\n#{indent} deleted on instance termination.
213
+ volume_type - (String) Valid values include:
214
214
  standard
215
215
  io1
216
- :iops - (Integer)
217
- :no_device - (String) Specifies the device name to suppress during instance launch.
216
+ iops - (Integer)
217
+ no_device - (String) Specifies the device name to suppress during instance launch.
218
218
  HEREDOC
219
219
 
220
220
  block_device_help = block_device_help.lines.map { |line| indent + " #{line}" }
@@ -224,10 +224,10 @@ module AWSCarb
224
224
  option.on "--block-device-mappings=HASH", block_device_help do |mapping|
225
225
  begin
226
226
  data = eval(mapping)
227
- raise unless data.class == Hash
228
- cli_arguments.subcommand.ec2.block_device_mappings = data
227
+ raise "parsed value isn't a hash!" unless data.class == Hash
228
+ cli_arguments.subcommand.ec2.block_device_mappings = ActiveSupport::HashWithIndifferentAccess.new(data)
229
229
  rescue => e
230
- puts "# could not parse argument for --common-variables, is it a valid hash?"
230
+ puts "# could not parse argument for --block-device-mappings, is it a valid hash and are the values properly quoted?"
231
231
  die e
232
232
  end
233
233
  end
@@ -30,13 +30,13 @@ module AWSCarb
30
30
  # special condition: common command line arguments are shared between all instances first..
31
31
  if cli_arguments.subcommand.config_overrides.common_variables
32
32
  @config[:common] ||= {}
33
- @config[:common].merge! cli_arguments.subcommand.config_overrides.common_variables
33
+ @config[:common].update cli_arguments.subcommand.config_overrides.common_variables
34
34
  end
35
35
 
36
36
  # all sections share 'common' variables..
37
37
  config_sections.each do |section|
38
38
  @config[section] ||= {}
39
- @config[section].merge! @config[:common]
39
+ @config[section].update @config[:common]
40
40
  end
41
41
 
42
42
  # merge the config overrides hashes into config
@@ -49,20 +49,17 @@ module AWSCarb
49
49
  config_key = key.to_s.gsub('_variables', '').to_sym
50
50
 
51
51
  @config[config_key] ||= {}
52
- @config[config_key].merge! cli_arguments.subcommand.config_overrides.send(key)
52
+ @config[config_key].update cli_arguments.subcommand.config_overrides.send(key)
53
53
  end
54
54
  end
55
55
 
56
56
  # merge the convenience arguments..
57
57
  config_sections.each do |section|
58
58
  if cli_arguments.subcommand.send(section.to_s)
59
- @config[section].merge! cli_arguments.subcommand.send(section.to_s).marshal_dump
59
+ @config[section].update cli_arguments.subcommand.send(section.to_s).marshal_dump
60
60
  end
61
61
  end
62
62
 
63
- # merge the convenience argument parameters with config
64
- @config.deep_symbolize_keys!
65
-
66
63
  rescue => e
67
64
  puts "# failed to merge cli arguments with config"
68
65
  die e
@@ -77,8 +74,7 @@ module AWSCarb
77
74
  config_file = cli_argument_config_file
78
75
 
79
76
  begin
80
- # make keys symbols so we can more easily merge with cli arg structs..
81
- @config = YAML.load_file(config_file).deep_symbolize_keys
77
+ @config = ActiveSupport::HashWithIndifferentAccess.new(YAML.load_file(config_file))
82
78
  rescue => e
83
79
  puts "# failed to load config file: '#{config_file}'"
84
80
  die e
@@ -40,7 +40,6 @@ module AWSCarb
40
40
  @resolved_template = Erubis::Eruby.new(@user_data_template).result(config[:user_data_template_variables])
41
41
  rescue => e
42
42
  puts "# failed to resolve variables in user_data_template:"
43
- ap e.class
44
43
  die e
45
44
  end
46
45
  end
@@ -1,3 +1,3 @@
1
1
  module AWSCarb
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
data/lib/aws-carb.rb CHANGED
@@ -6,6 +6,10 @@ require 'erubis'
6
6
  require 'awesome_print'
7
7
  require 'securerandom'
8
8
  require 'shell-spinner'
9
+ require 'active_support'
10
+ require 'active_support/core_ext'
11
+ require 'active_support/core_ext/hash'
12
+ require 'active_support/hash_with_indifferent_access'
9
13
  require 'active_support/core_ext/string/strip'
10
14
  require 'active_support/core_ext/hash/keys'
11
15
  require 'ostruct'
@@ -14,6 +18,8 @@ require 'singleton'
14
18
  require 'andand'
15
19
  require 'colorize'
16
20
 
21
+ include ActiveSupport
22
+
17
23
  # module is broken up into:
18
24
  #
19
25
  # AWSCarb.* - main methods
@@ -80,7 +86,6 @@ module AWSCarb
80
86
  #
81
87
  # aws interaction
82
88
  #
83
-
84
89
  if @config[:route53].andand[:new_dns_records]
85
90
  @route53 = Services::Route53.instance
86
91
  @route53.client(@config)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-carb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Wilson
@@ -14,140 +14,140 @@ dependencies:
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.5'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.5'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: 10.0.0
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: 10.0.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: activesupport
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: 4.0.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: 4.0.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: andand
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: 1.3.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: 1.3.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: awesome_print
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - '>='
74
74
  - !ruby/object:Gem::Version
75
75
  version: 1.2.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: 1.2.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: aws-sdk
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - '>='
88
88
  - !ruby/object:Gem::Version
89
89
  version: 1.33.0
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - '>='
95
95
  - !ruby/object:Gem::Version
96
96
  version: 1.33.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: colorize
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - '>='
102
102
  - !ruby/object:Gem::Version
103
103
  version: 0.6.0
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ">="
108
+ - - '>='
109
109
  - !ruby/object:Gem::Version
110
110
  version: 0.6.0
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: erubis
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ">="
115
+ - - '>='
116
116
  - !ruby/object:Gem::Version
117
117
  version: 2.7.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
124
  version: 2.7.0
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: shell-spinner
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ">="
129
+ - - '>='
130
130
  - !ruby/object:Gem::Version
131
131
  version: 1.0.0
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ">="
136
+ - - '>='
137
137
  - !ruby/object:Gem::Version
138
138
  version: 1.0.0
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: subcommand
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ">="
143
+ - - '>='
144
144
  - !ruby/object:Gem::Version
145
145
  version: 1.0.0
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - ">="
150
+ - - '>='
151
151
  - !ruby/object:Gem::Version
152
152
  version: 1.0.0
153
153
  description: a tool for provisioning ec2 instances with a templated cloudinit configuration,
@@ -160,7 +160,7 @@ executables:
160
160
  extensions: []
161
161
  extra_rdoc_files: []
162
162
  files:
163
- - ".gitignore"
163
+ - .gitignore
164
164
  - Gemfile
165
165
  - README.md
166
166
  - Rakefile
@@ -187,17 +187,17 @@ require_paths:
187
187
  - lib
188
188
  required_ruby_version: !ruby/object:Gem::Requirement
189
189
  requirements:
190
- - - ">="
190
+ - - '>='
191
191
  - !ruby/object:Gem::Version
192
192
  version: '0'
193
193
  required_rubygems_version: !ruby/object:Gem::Requirement
194
194
  requirements:
195
- - - ">="
195
+ - - '>='
196
196
  - !ruby/object:Gem::Version
197
197
  version: '0'
198
198
  requirements: []
199
199
  rubyforge_project:
200
- rubygems_version: 2.2.0
200
+ rubygems_version: 2.0.2
201
201
  signing_key:
202
202
  specification_version: 4
203
203
  summary: aws - cloudinit and route53 bootstrap