stackup 1.1.0 → 1.1.1
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 +4 -4
- data/CHANGES.md +1 -1
- data/bin/stackup +3 -7
- data/lib/stackup/source.rb +10 -1
- data/lib/stackup/version.rb +1 -1
- data/spec/stackup/source_spec.rb +57 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c9c28add918e16fcf983d251ccc71266f985fee
|
4
|
+
data.tar.gz: 9d2254d1f66e6c89b112b1c9c8af9d70c0450aa7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 277e194f8345b2cde8bbc8649309ef3c9487982e69a79b9ff290a4d0d1b595fa91866c446b302deac95ebf24e43d53d86cd35063d9b31746d7d9eca8a74207f2
|
7
|
+
data.tar.gz: f0189757457cd35688b220f6ee22240a4224740321b856821d3d8df162f527afc289451e61d4a1f1a3816c3e5db9cbf94e8031024ec378fbf11643a9d07bb990
|
data/CHANGES.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
## 1.1.
|
1
|
+
## 1.1.1 (2017-02-23)
|
2
2
|
|
3
3
|
* The `stackup` CLI now allows stack template and policy documents to be specified as URLs.
|
4
4
|
* Template URL must point to a template stored in an Amazon S3 bucket, e.g. `https://s3-ap-southeast-2.amazonaws.com/bucket/template.json`.
|
data/bin/stackup
CHANGED
@@ -132,7 +132,7 @@ Clamp do
|
|
132
132
|
def parameters_from_files
|
133
133
|
parameter_sources.map { |src|
|
134
134
|
Stackup::Parameters.new(src.data).to_hash
|
135
|
-
}.inject(:merge)
|
135
|
+
}.inject({}, :merge)
|
136
136
|
end
|
137
137
|
|
138
138
|
subcommand "status", "Print stack status." do
|
@@ -179,7 +179,7 @@ Clamp do
|
|
179
179
|
end
|
180
180
|
options = {}
|
181
181
|
if template_source
|
182
|
-
if
|
182
|
+
if template_source.s3?
|
183
183
|
options[:template_url] = template_source.location
|
184
184
|
else
|
185
185
|
options[:template] = template_source.data
|
@@ -189,7 +189,7 @@ Clamp do
|
|
189
189
|
options[:parameters] = parameters
|
190
190
|
options[:tags] = tag_source.data if tag_source
|
191
191
|
if policy_source
|
192
|
-
if
|
192
|
+
if policy_source.s3?
|
193
193
|
options[:stack_policy_url] = policy_source.location
|
194
194
|
else
|
195
195
|
options[:stack_policy] = policy_source.data
|
@@ -216,10 +216,6 @@ Clamp do
|
|
216
216
|
end
|
217
217
|
end
|
218
218
|
|
219
|
-
def is_s3_url?(location)
|
220
|
-
location =~ %r{^https://s3\w*.amazonaws.com}
|
221
|
-
end
|
222
|
-
|
223
219
|
end
|
224
220
|
|
225
221
|
subcommand "diff", "Compare template/params to current stack." do
|
data/lib/stackup/source.rb
CHANGED
@@ -14,6 +14,11 @@ module Stackup
|
|
14
14
|
|
15
15
|
attr_reader :location
|
16
16
|
|
17
|
+
def s3?
|
18
|
+
uri.scheme == "https" &&
|
19
|
+
uri.host =~ %r{(^|\.)s3(-\w+-\w+-\d)?\.amazonaws\.com$}
|
20
|
+
end
|
21
|
+
|
17
22
|
def body
|
18
23
|
@body ||= read
|
19
24
|
end
|
@@ -38,8 +43,12 @@ module Stackup
|
|
38
43
|
end
|
39
44
|
rescue Errno::ENOENT
|
40
45
|
raise ReadError, "no such file: #{location.inspect}"
|
46
|
+
rescue Errno::ECONNREFUSED => e
|
47
|
+
raise ReadError, "cannot read #{location.inspect} - #{e.message}"
|
41
48
|
rescue OpenURI::HTTPError => e
|
42
|
-
raise ReadError, "#{
|
49
|
+
raise ReadError, "cannot read #{location.inspect} - #{e.message}"
|
50
|
+
rescue SocketError => e
|
51
|
+
raise ReadError, "cannot read #{location.inspect} - #{e.message}"
|
43
52
|
end
|
44
53
|
|
45
54
|
def parse_body
|
data/lib/stackup/version.rb
CHANGED
data/spec/stackup/source_spec.rb
CHANGED
@@ -12,7 +12,7 @@ describe Stackup::Source do
|
|
12
12
|
|
13
13
|
let(:json_file) { File.join(example_dir, "template.json") }
|
14
14
|
|
15
|
-
subject(:
|
15
|
+
subject(:src) { described_class.new(json_file) }
|
16
16
|
|
17
17
|
describe "#body" do
|
18
18
|
|
@@ -30,13 +30,17 @@ describe Stackup::Source do
|
|
30
30
|
|
31
31
|
end
|
32
32
|
|
33
|
+
it "is not S3" do
|
34
|
+
expect(subject).not_to be_s3
|
35
|
+
end
|
36
|
+
|
33
37
|
end
|
34
38
|
|
35
39
|
context "from a YAML file" do
|
36
40
|
|
37
41
|
let(:yaml_file) { File.join(example_dir, "template.yml") }
|
38
42
|
|
39
|
-
subject(:
|
43
|
+
subject(:src) { described_class.new(yaml_file) }
|
40
44
|
|
41
45
|
describe "#body" do
|
42
46
|
|
@@ -60,7 +64,7 @@ describe Stackup::Source do
|
|
60
64
|
|
61
65
|
let(:bogus_file) { "notreallythere.json" }
|
62
66
|
|
63
|
-
subject(:
|
67
|
+
subject(:src) { described_class.new(bogus_file) }
|
64
68
|
|
65
69
|
describe "#body" do
|
66
70
|
|
@@ -72,4 +76,54 @@ describe Stackup::Source do
|
|
72
76
|
|
73
77
|
end
|
74
78
|
|
79
|
+
context "with an HTTP URL" do
|
80
|
+
|
81
|
+
let(:url) { "https://example.com/template.json" }
|
82
|
+
|
83
|
+
subject(:src) { described_class.new(url) }
|
84
|
+
|
85
|
+
it "is not S3" do
|
86
|
+
expect(subject).not_to be_s3
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
|
91
|
+
context "with an S3 URL" do
|
92
|
+
|
93
|
+
let(:s3_url) { "https://s3.amazonaws.com/bucket/template.json" }
|
94
|
+
|
95
|
+
subject(:src) { described_class.new(s3_url) }
|
96
|
+
|
97
|
+
context "with bucket in path" do
|
98
|
+
|
99
|
+
let(:s3_url) { "https://s3.amazonaws.com/bucket/template.json" }
|
100
|
+
|
101
|
+
it "is S3" do
|
102
|
+
expect(subject).to be_s3
|
103
|
+
end
|
104
|
+
|
105
|
+
end
|
106
|
+
|
107
|
+
context "with bucket in host" do
|
108
|
+
|
109
|
+
let(:s3_url) { "https://bucket.s3.amazonaws.com/template.json" }
|
110
|
+
|
111
|
+
it "is S3" do
|
112
|
+
expect(subject).to be_s3
|
113
|
+
end
|
114
|
+
|
115
|
+
end
|
116
|
+
|
117
|
+
context "with bucket region" do
|
118
|
+
|
119
|
+
let(:s3_url) { "https://bucket.s3-ap-northeast-3.amazonaws.com/template.json" }
|
120
|
+
|
121
|
+
it "is S3" do
|
122
|
+
expect(subject).to be_s3
|
123
|
+
end
|
124
|
+
|
125
|
+
end
|
126
|
+
|
127
|
+
end
|
128
|
+
|
75
129
|
end
|