lucid-cumulus 0.11.2 → 0.11.3
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 +8 -8
- data/Gemfile +1 -0
- data/Gemfile.lock +19 -4
- data/README.md +2 -0
- data/bin/cumulus +22 -546
- data/lib/autoscaling/Commands.rb +20 -0
- data/lib/aws_extensions/s3/BucketPolicy.rb +22 -4
- data/lib/cloudfront/Commands.rb +51 -0
- data/lib/common/BaseLoader.rb +6 -4
- data/lib/common/Commands.rb +131 -0
- data/lib/conf/Configuration.rb +23 -6
- data/lib/ec2/Commands.rb +51 -0
- data/lib/ec2/models/InstanceConfig.rb +1 -1
- data/lib/elb/Commands.rb +40 -0
- data/lib/iam/Commands.rb +49 -0
- data/lib/iam/models/ResourceWithPolicy.rb +10 -3
- data/lib/iam/models/StatementConfig.rb +2 -2
- data/lib/kinesis/Commands.rb +20 -0
- data/lib/route53/Commands.rb +20 -0
- data/lib/s3/Commands.rb +20 -0
- data/lib/s3/loader/Loader.rb +2 -1
- data/lib/security/Commands.rb +24 -0
- data/lib/sqs/Commands.rb +34 -0
- data/lib/sqs/SQS.rb +6 -0
- data/lib/sqs/loader/Loader.rb +9 -4
- data/lib/sqs/manager/Manager.rb +6 -7
- data/lib/vpc/Commands.rb +43 -0
- data/lucid-cumulus.gemspec +2 -1
- data/rakefile.rb +7 -2
- data/spec/mocks/ClientSpy.rb +43 -0
- data/spec/mocks/MockedConfiguration.rb +61 -0
- data/spec/mocks/MockedLoader.rb +37 -0
- data/spec/mocks/MockedStatusCodes.rb +17 -0
- data/spec/rspec_config.rb +5 -0
- data/spec/sqs/SQSUtil.rb +231 -0
- data/spec/sqs/SingleChangeTest.rb +101 -0
- data/spec/sqs/diff_spec.rb +152 -0
- data/spec/sqs/sync_spec.rb +137 -0
- data/spec/util/DeepMerge.rb +25 -0
- data/spec/util/ManagerUtil.rb +12 -0
- metadata +39 -3
- data/cumulus +0 -2
@@ -0,0 +1,137 @@
|
|
1
|
+
require "sqs/SQSUtil"
|
2
|
+
require "sqs/SingleChangeTest"
|
3
|
+
|
4
|
+
module Cumulus
|
5
|
+
module Test
|
6
|
+
module SQS
|
7
|
+
describe Cumulus::SQS::Manager do
|
8
|
+
context "The SQS module's syncing functionality" do
|
9
|
+
it "should correctly create a new queue that's defined locally" do
|
10
|
+
queue_name = "not-in-aws"
|
11
|
+
SQS::client_spy
|
12
|
+
SQS::do_sync({
|
13
|
+
local: {queues: [{name: queue_name, value: {}}]},
|
14
|
+
aws: {list_queues: nil},
|
15
|
+
}) do |client|
|
16
|
+
create = client.spied_method(:create_queue)
|
17
|
+
expect(create.num_calls).to eq 1
|
18
|
+
expect(create.arguments[0]).to eq ({
|
19
|
+
:queue_name => "not-in-aws",
|
20
|
+
:attributes => {
|
21
|
+
"DelaySeconds" => "",
|
22
|
+
"MaximumMessageSize" => "",
|
23
|
+
"MessageRetentionPeriod" => "",
|
24
|
+
"ReceiveMessageWaitTimeSeconds" => "",
|
25
|
+
"VisibilityTimeout" => ""
|
26
|
+
}
|
27
|
+
})
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should not delete queues added in AWS" do
|
32
|
+
queue_name = "only-in-aws"
|
33
|
+
SQS::client_spy
|
34
|
+
SQS::do_sync({
|
35
|
+
local: {queues: []},
|
36
|
+
aws: {
|
37
|
+
list_queues: {queue_urls: [SQS::queue_url(queue_name)]},
|
38
|
+
get_queue_attributes: {},
|
39
|
+
}
|
40
|
+
}) do |client|
|
41
|
+
# no calls were made to change anything
|
42
|
+
expect(client.method_calls.size).to eq 3
|
43
|
+
expect(client.spied_method(:stub_responses).nil?).to eq false
|
44
|
+
expect(client.spied_method(:list_queues).nil?).to eq false
|
45
|
+
expect(client.spied_method(:get_queue_attributes).nil?).to eq false
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should update delay" do
|
50
|
+
SingleChangeTest.execute_sync do
|
51
|
+
@path = "delay"
|
52
|
+
@new_value = SQS::DEFAULT_QUEUE_DELAY - 1
|
53
|
+
@previous_value = SQS::DEFAULT_QUEUE_DELAY
|
54
|
+
@test_value = @new_value.to_s
|
55
|
+
@attribute_name = "DelaySeconds"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should update max-message-size" do
|
60
|
+
SingleChangeTest.execute_sync do
|
61
|
+
@path = "max-message-size"
|
62
|
+
@new_value = SQS::DEFAULT_QUEUE_MESSAGE_SIZE - 1
|
63
|
+
@previous_value = SQS::DEFAULT_QUEUE_MESSAGE_SIZE
|
64
|
+
@attribute_name = "MaximumMessageSize"
|
65
|
+
@test_value = @new_value.to_s
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
it "should update message-retention" do
|
70
|
+
SingleChangeTest.execute_sync do
|
71
|
+
@path = "message-retention"
|
72
|
+
@new_value = SQS::DEFAULT_QUEUE_MESSAGE_RETENTION - 1
|
73
|
+
@previous_value = SQS::DEFAULT_QUEUE_MESSAGE_RETENTION
|
74
|
+
@attribute_name = "MessageRetentionPeriod"
|
75
|
+
@test_value = @new_value.to_s
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
it "should update receive-wait-time" do
|
80
|
+
SingleChangeTest.execute_sync do
|
81
|
+
@path = "receive-wait-time"
|
82
|
+
@new_value = SQS::DEFAULT_QUEUE_WAIT_TIME - 1
|
83
|
+
@previous_value = SQS::DEFAULT_QUEUE_WAIT_TIME
|
84
|
+
@attribute_name = "ReceiveMessageWaitTimeSeconds"
|
85
|
+
@test_value = @new_value.to_s
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
it "should update the policy" do
|
90
|
+
new_value = "example-policy-2"
|
91
|
+
new_contents = "{\"a\":\"b\"}"
|
92
|
+
SingleChangeTest.execute_sync do
|
93
|
+
@path = "policy"
|
94
|
+
@policy = {
|
95
|
+
name: new_value,
|
96
|
+
value: new_contents,
|
97
|
+
}
|
98
|
+
@new_value = new_value
|
99
|
+
@previous_value = JSON.parse(SQS::DEFAULT_QUEUE_POLICY)
|
100
|
+
@attribute_name = "Policy"
|
101
|
+
@test_value = JSON.generate(JSON.parse(new_contents))
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
it "should update the dead-letter target" do
|
106
|
+
SingleChangeTest.execute_sync do
|
107
|
+
@path = "dead-letter.target"
|
108
|
+
@new_value = SQS::DEFAULT_DEAD_LETTER_TARGET + "a"
|
109
|
+
@previous_value = SQS::DEFAULT_DEAD_LETTER_TARGET
|
110
|
+
@full_test_value = {
|
111
|
+
"RedrivePolicy" => JSON.generate({
|
112
|
+
"deadLetterTargetArn" => @new_value,
|
113
|
+
"maxReceiveCount" => SQS::DEFAULT_DEAD_LETTER_RECEIVES
|
114
|
+
})
|
115
|
+
}
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
it "should update dead-letter max-receives" do
|
120
|
+
SingleChangeTest.execute_sync do
|
121
|
+
@path = "dead-letter.max-receives"
|
122
|
+
@new_value = SQS::DEFAULT_DEAD_LETTER_RECEIVES + 1
|
123
|
+
@previous_value = SQS::DEFAULT_DEAD_LETTER_RECEIVES
|
124
|
+
@full_test_value = {
|
125
|
+
"RedrivePolicy" => JSON.generate({
|
126
|
+
"deadLetterTargetArn" => SQS::DEFAULT_DEAD_LETTER_TARGET,
|
127
|
+
"maxReceiveCount" => @new_value
|
128
|
+
})
|
129
|
+
}
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Cumulus
|
2
|
+
module Test
|
3
|
+
module Util
|
4
|
+
module DeepMerge
|
5
|
+
# Public: Do a deep merge of two hashes, overriding the values in `first`
|
6
|
+
# with the values in `second`.
|
7
|
+
#
|
8
|
+
# first - the first Hash
|
9
|
+
# seconds - the second Hash
|
10
|
+
#
|
11
|
+
# Returns a Hash that contains the values in `first` merged with `second`
|
12
|
+
def self.deep_merge(first, second)
|
13
|
+
if first.nil?
|
14
|
+
second
|
15
|
+
elsif second.nil?
|
16
|
+
first
|
17
|
+
else
|
18
|
+
merger = Proc.new { |key, v1, v2| Hash === v1 && Hash === v2 ? v1.merge(v2, &merger) : v2 }
|
19
|
+
first.merge(second, &merger)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lucid-cumulus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keilan Jackson
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-08-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aws-sdk
|
@@ -39,6 +39,20 @@ dependencies:
|
|
39
39
|
- - ~>
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: 0.1.4
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: deepsort
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ~>
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0.1'
|
49
|
+
type: :runtime
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ~>
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0.1'
|
42
56
|
description: Cumulus allows you to manage your AWS infrastructure by creating JSON
|
43
57
|
configuration files that describe your AWS resources.
|
44
58
|
email: cumulus@lucidchart.com
|
@@ -55,8 +69,8 @@ files:
|
|
55
69
|
- README.md
|
56
70
|
- autocomplete
|
57
71
|
- bin/cumulus
|
58
|
-
- cumulus
|
59
72
|
- lib/autoscaling/AutoScaling.rb
|
73
|
+
- lib/autoscaling/Commands.rb
|
60
74
|
- lib/autoscaling/loader/Loader.rb
|
61
75
|
- lib/autoscaling/manager/Manager.rb
|
62
76
|
- lib/autoscaling/models/AlarmConfig.rb
|
@@ -94,6 +108,7 @@ files:
|
|
94
108
|
- lib/aws_extensions/s3/CORSRule.rb
|
95
109
|
- lib/aws_extensions/s3/ReplicationConfiguration.rb
|
96
110
|
- lib/cloudfront/CloudFront.rb
|
111
|
+
- lib/cloudfront/Commands.rb
|
97
112
|
- lib/cloudfront/loader/Loader.rb
|
98
113
|
- lib/cloudfront/manager/Manager.rb
|
99
114
|
- lib/cloudfront/models/CacheBehaviorConfig.rb
|
@@ -108,12 +123,14 @@ files:
|
|
108
123
|
- lib/cloudfront/models/OriginSslProtocols.rb
|
109
124
|
- lib/cloudfront/models/OriginSslProtocolsDiff.rb
|
110
125
|
- lib/common/BaseLoader.rb
|
126
|
+
- lib/common/Commands.rb
|
111
127
|
- lib/common/manager/Manager.rb
|
112
128
|
- lib/common/models/Diff.rb
|
113
129
|
- lib/common/models/ListChange.rb
|
114
130
|
- lib/common/models/TagsDiff.rb
|
115
131
|
- lib/common/models/UTCTimeSource.rb
|
116
132
|
- lib/conf/Configuration.rb
|
133
|
+
- lib/ec2/Commands.rb
|
117
134
|
- lib/ec2/EC2.rb
|
118
135
|
- lib/ec2/IPProtocolMapping.rb
|
119
136
|
- lib/ec2/loaders/EbsLoader.rb
|
@@ -124,6 +141,7 @@ files:
|
|
124
141
|
- lib/ec2/models/EbsGroupDiff.rb
|
125
142
|
- lib/ec2/models/InstanceConfig.rb
|
126
143
|
- lib/ec2/models/InstanceDiff.rb
|
144
|
+
- lib/elb/Commands.rb
|
127
145
|
- lib/elb/ELB.rb
|
128
146
|
- lib/elb/loader/Loader.rb
|
129
147
|
- lib/elb/manager/Manager.rb
|
@@ -135,6 +153,7 @@ files:
|
|
135
153
|
- lib/elb/models/ListenerDiff.rb
|
136
154
|
- lib/elb/models/LoadBalancerConfig.rb
|
137
155
|
- lib/elb/models/LoadBalancerDiff.rb
|
156
|
+
- lib/iam/Commands.rb
|
138
157
|
- lib/iam/IAM.rb
|
139
158
|
- lib/iam/loader/Loader.rb
|
140
159
|
- lib/iam/manager/IamGroups.rb
|
@@ -151,12 +170,14 @@ files:
|
|
151
170
|
- lib/iam/models/RoleConfig.rb
|
152
171
|
- lib/iam/models/StatementConfig.rb
|
153
172
|
- lib/iam/models/UserConfig.rb
|
173
|
+
- lib/kinesis/Commands.rb
|
154
174
|
- lib/kinesis/Kinesis.rb
|
155
175
|
- lib/kinesis/loader/Loader.rb
|
156
176
|
- lib/kinesis/manager/Manager.rb
|
157
177
|
- lib/kinesis/models/StreamConfig.rb
|
158
178
|
- lib/kinesis/models/StreamDiff.rb
|
159
179
|
- lib/lambda/Lambda.rb
|
180
|
+
- lib/route53/Commands.rb
|
160
181
|
- lib/route53/loader/Loader.rb
|
161
182
|
- lib/route53/manager/Manager.rb
|
162
183
|
- lib/route53/models/AliasTarget.rb
|
@@ -165,6 +186,7 @@ files:
|
|
165
186
|
- lib/route53/models/Vpc.rb
|
166
187
|
- lib/route53/models/ZoneConfig.rb
|
167
188
|
- lib/route53/models/ZoneDiff.rb
|
189
|
+
- lib/s3/Commands.rb
|
168
190
|
- lib/s3/S3.rb
|
169
191
|
- lib/s3/loader/Loader.rb
|
170
192
|
- lib/s3/manager/Manager.rb
|
@@ -180,6 +202,7 @@ files:
|
|
180
202
|
- lib/s3/models/ReplicationConfig.rb
|
181
203
|
- lib/s3/models/ReplicationDiff.rb
|
182
204
|
- lib/s3/models/WebsiteConfig.rb
|
205
|
+
- lib/security/Commands.rb
|
183
206
|
- lib/security/SecurityGroups.rb
|
184
207
|
- lib/security/loader/Loader.rb
|
185
208
|
- lib/security/manager/Manager.rb
|
@@ -189,6 +212,7 @@ files:
|
|
189
212
|
- lib/security/models/SecurityGroupConfig.rb
|
190
213
|
- lib/security/models/SecurityGroupDiff.rb
|
191
214
|
- lib/sns/SNS.rb
|
215
|
+
- lib/sqs/Commands.rb
|
192
216
|
- lib/sqs/SQS.rb
|
193
217
|
- lib/sqs/loader/Loader.rb
|
194
218
|
- lib/sqs/manager/Manager.rb
|
@@ -198,6 +222,7 @@ files:
|
|
198
222
|
- lib/sqs/models/QueueDiff.rb
|
199
223
|
- lib/util/Colors.rb
|
200
224
|
- lib/util/StatusCodes.rb
|
225
|
+
- lib/vpc/Commands.rb
|
201
226
|
- lib/vpc/loader/Loader.rb
|
202
227
|
- lib/vpc/manager/Manager.rb
|
203
228
|
- lib/vpc/models/AclEntryConfig.rb
|
@@ -218,6 +243,17 @@ files:
|
|
218
243
|
- lib/vpc/models/VpcDiff.rb
|
219
244
|
- lucid-cumulus.gemspec
|
220
245
|
- rakefile.rb
|
246
|
+
- spec/mocks/ClientSpy.rb
|
247
|
+
- spec/mocks/MockedConfiguration.rb
|
248
|
+
- spec/mocks/MockedLoader.rb
|
249
|
+
- spec/mocks/MockedStatusCodes.rb
|
250
|
+
- spec/rspec_config.rb
|
251
|
+
- spec/sqs/SQSUtil.rb
|
252
|
+
- spec/sqs/SingleChangeTest.rb
|
253
|
+
- spec/sqs/diff_spec.rb
|
254
|
+
- spec/sqs/sync_spec.rb
|
255
|
+
- spec/util/DeepMerge.rb
|
256
|
+
- spec/util/ManagerUtil.rb
|
221
257
|
homepage: http://lucidsoftware.github.io/cumulus/
|
222
258
|
licenses:
|
223
259
|
- Apache-2.0
|
data/cumulus
DELETED