kumogata 0.2.19 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +2 -2
- data/lib/kumogata/argument_parser.rb +0 -11
- data/lib/kumogata/client.rb +11 -0
- data/lib/kumogata/version.rb +1 -1
- data/spec/kumogata_create_spec.rb +2 -2
- data/spec/kumogata_update_spec.rb +2 -2
- data/spec/spec_helper.rb +6 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MDJiY2RhMjljMGZiZDMzOGM3YTdlZjkxYmFkNTk3YjIwNDc3NmJmOQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YjU3NzFmM2I0MTIzMWQ3MjQ3N2E4YjcyODBmMTg5YzJhOGU4OWZlZg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NDllOGZhMzQ0ZjRlODVlMmI3MTVjZGU1NzhhMDkxNjJmM2EzNmRiZTk4Zjk4
|
10
|
+
ODQxZWU5Y2NmZTEyMmI2MzQzNjhiMGM1MGM4NGI3Y2Y1OGM2MTY2ZDc4Mzc4
|
11
|
+
NTg4MDNlNTQ5YjYxZmVjZGNlODVlYzJmYjliNjRhYWJkOTUyMTU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MjYyN2YzZjFmOGZjNzE5OGVhNWZlNmYzNTZlY2E0ODVlZWI0Zjk4Y2RmYjkz
|
14
|
+
MTE2OGExMWMzN2FiNjRmYWI3M2E5NTlhMDg4YzYwZTU2MTBkY2M3NWFiOWNj
|
15
|
+
NTRkN2FiMDI1N2Y5ZTliNzk0ZjQ4N2M5ZmRhM2Y2MGIzOWIxNjQ=
|
data/README.md
CHANGED
@@ -5,8 +5,8 @@
|
|
5
5
|
|
6
6
|
Kumogata is a tool for [AWS CloudFormation](https://aws.amazon.com/cloudformation/).
|
7
7
|
|
8
|
-
[![Gem Version](https://badge.fury.io/rb/kumogata.png?
|
9
|
-
[![Build Status](https://drone.io/github.com/winebarrel/kumogata/status.png?
|
8
|
+
[![Gem Version](https://badge.fury.io/rb/kumogata.png?201403080034)](http://badge.fury.io/rb/kumogata)
|
9
|
+
[![Build Status](https://drone.io/github.com/winebarrel/kumogata/status.png?201403080034)](https://drone.io/github.com/winebarrel/kumogata/latest)
|
10
10
|
|
11
11
|
It can define a template in Ruby DSL, such as:
|
12
12
|
|
@@ -185,24 +185,13 @@ class Kumogata::ArgumentParser
|
|
185
185
|
|
186
186
|
def update_parameters(options)
|
187
187
|
parameters = {}
|
188
|
-
passwd = options.encryption_password || Kumogata::Crypt.mkpasswd(16)
|
189
|
-
enc_params = options.encrypt_parameters
|
190
188
|
|
191
189
|
(options.parameters || []).each do |i|
|
192
190
|
key, value = i.split('=', 2)
|
193
|
-
|
194
|
-
if enc_params and (enc_params.include?('*') or enc_params.include?(key))
|
195
|
-
value = Kumogata::Crypt.encrypt(passwd, value)
|
196
|
-
end
|
197
|
-
|
198
191
|
parameters[key] = value
|
199
192
|
end
|
200
193
|
|
201
194
|
options.parameters = parameters
|
202
|
-
|
203
|
-
if options.encrypt_parameters? and not options.skip_send_password?
|
204
|
-
options.parameters[Kumogata::ENCRYPTION_PASSWORD] = passwd.encode64
|
205
|
-
end
|
206
195
|
end
|
207
196
|
|
208
197
|
def scan_args(str)
|
data/lib/kumogata/client.rb
CHANGED
@@ -355,10 +355,21 @@ class Kumogata::Client
|
|
355
355
|
if @options.parameters? and not @options.parameters.empty?
|
356
356
|
parameters = {}
|
357
357
|
|
358
|
+
enc_params = @options.encrypt_parameters
|
359
|
+
passwd = @options.encryption_password || Kumogata::Crypt.mkpasswd(16)
|
360
|
+
|
358
361
|
@options.parameters.each do |key, value|
|
362
|
+
if enc_params and (enc_params.include?('*') or enc_params.include?(key))
|
363
|
+
value = Kumogata::Crypt.encrypt(passwd, value)
|
364
|
+
end
|
365
|
+
|
359
366
|
parameters[key] = value
|
360
367
|
end
|
361
368
|
|
369
|
+
if @options.encrypt_parameters? and not @options.skip_send_password?
|
370
|
+
parameters[Kumogata::ENCRYPTION_PASSWORD] = passwd.encode64
|
371
|
+
end
|
372
|
+
|
362
373
|
hash[:parameters] = parameters
|
363
374
|
end
|
364
375
|
end
|
data/lib/kumogata/version.rb
CHANGED
@@ -233,7 +233,7 @@ Outputs do
|
|
233
233
|
end
|
234
234
|
EOS
|
235
235
|
|
236
|
-
run_client(:create, :template => template, :options => {:parameters => {'InstanceType'=>'m1.large'}, :encrypt_parameters =>
|
236
|
+
run_client(:create, :template => template, :options => {:parameters => {'InstanceType'=>'m1.large'}, :encrypt_parameters => ['Password']}) do |client, cf|
|
237
237
|
json = eval_template(template, :update_deletion_policy => true, :add_encryption_password => true).to_json
|
238
238
|
|
239
239
|
output = make_double('output') do |obj|
|
@@ -261,7 +261,7 @@ end
|
|
261
261
|
|
262
262
|
stacks = make_double('stacks') do |obj|
|
263
263
|
obj.should_receive(:create)
|
264
|
-
.with('kumogata-user-host-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', json, {:parameters=>{"InstanceType"=>"m1.large"}}) { stack }
|
264
|
+
.with('kumogata-user-host-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', json, {:parameters=>{"InstanceType"=>"m1.large", "EncryptionPassword"=>"KioqKioqKioqKioqKioqKg=="}}) { stack }
|
265
265
|
obj.should_receive(:[])
|
266
266
|
.with('kumogata-user-host-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX') { stack }
|
267
267
|
end
|
@@ -171,7 +171,7 @@ Outputs do
|
|
171
171
|
end
|
172
172
|
EOS
|
173
173
|
|
174
|
-
run_client(:update, :arguments => ['MyStack'], :template => template, :options => {:parameters => {'InstanceType'=>'m1.large'}, :encrypt_parameters =>
|
174
|
+
run_client(:update, :arguments => ['MyStack'], :template => template, :options => {:parameters => {'InstanceType'=>'m1.large'}, :encrypt_parameters => ['Password']}) do |client, cf|
|
175
175
|
json = eval_template(template, :add_encryption_password => true).to_json
|
176
176
|
|
177
177
|
output = make_double('output') do |obj|
|
@@ -189,7 +189,7 @@ end
|
|
189
189
|
end
|
190
190
|
|
191
191
|
stack = make_double('stack') do |obj|
|
192
|
-
obj.should_receive(:update).with(:template => json, :parameters=>{"InstanceType"=>"m1.large"})
|
192
|
+
obj.should_receive(:update).with(:template => json, :parameters=>{"InstanceType"=>"m1.large", "EncryptionPassword"=>"KioqKioqKioqKioqKioqKg=="})
|
193
193
|
obj.should_receive(:status).and_return(
|
194
194
|
'UPDATE_COMPLETE', 'UPDATE_COMPLETE', 'UPDATE_COMPLETE')
|
195
195
|
obj.should_receive(:outputs) { [output] }
|
data/spec/spec_helper.rb
CHANGED