stacker_bee 2.1.0.pre232 → 2.1.0.pre236
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZGMwMTczNmU3MjVmMjM2ZGM2OGI1MzU1M2NhNDI1MTE0NDdiYjhiYQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZDZkZWJjMDkyNWNjMTc2YmUxYmFkYzYxOTgzZTlkMDNlMjEzY2NmMQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NDhhNmFjNWJlY2FjMTQzNDk1MzFjOGU5NGFhZDA3ODMwYzU1YjBlNzJkNmFl
|
10
|
+
ZWUyNTY5YmVjM2VkZWE3Y2VmYjk1YTdhODczOGFhMWM2ZGYzNmRjZWQyN2Q0
|
11
|
+
ZmYxNzE5OTJiZDVlZWJkZTZjYzA2ZGI1ZDI3YWUxMGNmNGIwN2M=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZjUxZTg3YmE0ZmVlYTBmNjUwNmE1ZWNkYjg3MWM4ODYwOGFkOTc3ZmQ1Mjdl
|
14
|
+
MGE0NzkzNTJhZTYzYjZjOTI2ZWIwNWY2ZTc3ZmZkODY0MGY2ZGYzMjNlY2I1
|
15
|
+
YzA0MDdmYTBlZGE4MzJiMTAzNjkyOGQyYmY1NDEwNzU3N2UwODI=
|
@@ -25,7 +25,7 @@ module StackerBee
|
|
25
25
|
|
26
26
|
def flatten_map_values(params, hashes)
|
27
27
|
hashes.each do |hash_name, hash|
|
28
|
-
|
28
|
+
remove_falseish(hash).each_with_index do |(key, value), index|
|
29
29
|
hash_url_key = self.class.tokenize("#{hash_name}[#{index}]")
|
30
30
|
|
31
31
|
params["#{hash_url_key}.key"] = key
|
@@ -37,8 +37,8 @@ module StackerBee
|
|
37
37
|
end
|
38
38
|
|
39
39
|
# TODO: isn't this done with the RemoveEmptyStrings middleware?
|
40
|
-
def
|
41
|
-
hash.reject { |_, v| v
|
40
|
+
def remove_falseish(hash)
|
41
|
+
hash.reject { |_, v| v == "" || v =~ /false/i || !v }
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
@@ -19,31 +19,43 @@ describe StackerBee::Middleware::DictionaryFlattener do
|
|
19
19
|
describe ".new" do
|
20
20
|
subject { described_class.new.params(params) }
|
21
21
|
|
22
|
-
def
|
22
|
+
def param(number)
|
23
23
|
described_class.tokenize "rebels[#{number}]"
|
24
24
|
end
|
25
25
|
|
26
26
|
let(:params) do
|
27
27
|
{ "time" => "long ago",
|
28
|
-
"rebels" => {
|
28
|
+
"rebels" => {
|
29
|
+
"r2" => "d2",
|
30
|
+
"blank" => "",
|
31
|
+
"falsey" => "false",
|
32
|
+
"false" => false,
|
33
|
+
"droid" => true } }
|
29
34
|
end
|
30
35
|
|
31
36
|
it "flattens objects in the manner that cloudstack expects" do
|
32
|
-
subject["#{
|
33
|
-
subject["#{
|
34
|
-
subject["#{
|
37
|
+
subject["#{param(0)}.name"].should eq "r2"
|
38
|
+
subject["#{param(0)}.key"].should eq "r2"
|
39
|
+
subject["#{param(0)}.value"].should eq "d2"
|
35
40
|
end
|
36
41
|
|
37
42
|
it "does not flatten empty hashes" do
|
38
|
-
subject.should_not have_key "#{
|
43
|
+
subject.should_not have_key "#{param(2)}.name"
|
39
44
|
end
|
40
45
|
|
41
|
-
it "handles booleans" do
|
42
|
-
subject["#{
|
46
|
+
it "handles true booleans" do
|
47
|
+
subject["#{param(1)}.name"].should eq "droid"
|
48
|
+
subject["#{param(1)}.value"].should be_true
|
43
49
|
end
|
44
50
|
|
45
51
|
it "removes original map params" do
|
46
52
|
subject.should_not have_key "rebels"
|
47
53
|
end
|
54
|
+
|
55
|
+
it "doesnt send false to CloudStack" do
|
56
|
+
# This assumption is based on CloudStack UI behavior
|
57
|
+
subject.values.should_not include false
|
58
|
+
subject.values.should_not include "false"
|
59
|
+
end
|
48
60
|
end
|
49
61
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stacker_bee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.0.
|
4
|
+
version: 2.1.0.pre236
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Greg Sterndale
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-06-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|