stackup 1.0.0 → 1.0.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 +6 -0
- data/lib/stackup/stack.rb +14 -7
- data/lib/stackup/version.rb +1 -1
- data/lib/stackup/yaml.rb +4 -0
- data/spec/stackup/yaml_spec.rb +76 -5
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cac6ceefeefc19f6eea4ed171ddf4d596c75c778
|
4
|
+
data.tar.gz: df26370ed8fbe55624757667df93914105c8f8ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f87618bdf6e7cd1869d5aaf9893a5e69d7605bfac22039c0e4ebfddb0d0dadf1c03f496071d771cf7819e289364401f5360d52ec52974799424914493252fa4
|
7
|
+
data.tar.gz: e9202e049b65f39bec6a51f8365fd1590e53a81464049404cb0f7a90c8477a19346c21036903c03a5fb8d4d550bb425ffee41693524c9025c40e9cd60d232b1f
|
data/CHANGES.md
CHANGED
data/lib/stackup/stack.rb
CHANGED
@@ -4,6 +4,7 @@ require "multi_json"
|
|
4
4
|
require "stackup/error_handling"
|
5
5
|
require "stackup/parameters"
|
6
6
|
require "stackup/stack_watcher"
|
7
|
+
require "stackup/yaml"
|
7
8
|
|
8
9
|
module Stackup
|
9
10
|
|
@@ -99,7 +100,7 @@ module Stackup
|
|
99
100
|
# @option options [Hash] :template
|
100
101
|
# stack template, as Ruby data
|
101
102
|
# @option options [String] :template_body
|
102
|
-
# stack template, as JSON
|
103
|
+
# stack template, as JSON or YAML
|
103
104
|
# @option options [String] :template_url
|
104
105
|
# location of stack template
|
105
106
|
# @option options [Integer] :timeout_in_minutes
|
@@ -139,8 +140,6 @@ module Stackup
|
|
139
140
|
|
140
141
|
# Delete the stack.
|
141
142
|
#
|
142
|
-
# @param [String] template template JSON
|
143
|
-
# @param [Array<Hash>] parameters template parameters
|
144
143
|
# @return [Symbol] +:deleted+ if successful
|
145
144
|
# @raise [Stackup::StackUpdateError] if operation fails
|
146
145
|
#
|
@@ -184,16 +183,24 @@ module Stackup
|
|
184
183
|
end
|
185
184
|
end
|
186
185
|
|
186
|
+
# Get the current template body.
|
187
|
+
#
|
188
|
+
# @return [String] current stack template, as JSON or YAML
|
189
|
+
# @raise [Stackup::NoSuchStack] if the stack doesn't exist
|
190
|
+
#
|
191
|
+
def template_body
|
192
|
+
handling_validation_error do
|
193
|
+
cf_client.get_template(:stack_name => name).template_body
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
187
197
|
# Get the current template.
|
188
198
|
#
|
189
199
|
# @return [Hash] current stack template, as Ruby data
|
190
200
|
# @raise [Stackup::NoSuchStack] if the stack doesn't exist
|
191
201
|
#
|
192
202
|
def template
|
193
|
-
|
194
|
-
template_json = cf_client.get_template(:stack_name => name).template_body
|
195
|
-
MultiJson.load(template_json)
|
196
|
-
end
|
203
|
+
Stackup::YAML.load(template_body)
|
197
204
|
end
|
198
205
|
|
199
206
|
# Get the current parameters.
|
data/lib/stackup/version.rb
CHANGED
data/lib/stackup/yaml.rb
CHANGED
data/spec/stackup/yaml_spec.rb
CHANGED
@@ -10,7 +10,7 @@ describe Stackup::YAML do
|
|
10
10
|
described_class.load(input)
|
11
11
|
end
|
12
12
|
|
13
|
-
|
13
|
+
describe "plain YAML" do
|
14
14
|
|
15
15
|
let(:input) do
|
16
16
|
<<-YAML
|
@@ -29,7 +29,7 @@ describe Stackup::YAML do
|
|
29
29
|
|
30
30
|
end
|
31
31
|
|
32
|
-
|
32
|
+
describe "!Ref" do
|
33
33
|
|
34
34
|
let(:input) do
|
35
35
|
<<-YAML
|
@@ -50,16 +50,16 @@ describe Stackup::YAML do
|
|
50
50
|
|
51
51
|
end
|
52
52
|
|
53
|
-
|
53
|
+
describe "!GetAtt" do
|
54
54
|
|
55
55
|
let(:input) do
|
56
56
|
<<-YAML
|
57
57
|
Outputs:
|
58
|
-
Foo: !GetAtt
|
58
|
+
Foo: !GetAtt Bar.Baz
|
59
59
|
YAML
|
60
60
|
end
|
61
61
|
|
62
|
-
it "expands to
|
62
|
+
it "expands to Fn::GetAtt" do
|
63
63
|
expect(data).to eql(
|
64
64
|
"Outputs" => {
|
65
65
|
"Foo" => {
|
@@ -74,6 +74,77 @@ describe Stackup::YAML do
|
|
74
74
|
|
75
75
|
end
|
76
76
|
|
77
|
+
describe "!GetAtt" do
|
78
|
+
|
79
|
+
context "with an argument" do
|
80
|
+
|
81
|
+
let(:input) do
|
82
|
+
<<-YAML
|
83
|
+
Foo:
|
84
|
+
!GetAZs xy-foobar-6
|
85
|
+
YAML
|
86
|
+
end
|
87
|
+
|
88
|
+
it "expands to Fn::GetAtt" do
|
89
|
+
expect(data).to eql(
|
90
|
+
"Foo" => {
|
91
|
+
"Fn::GetAZs" => "xy-foobar-6"
|
92
|
+
}
|
93
|
+
)
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
97
|
+
|
98
|
+
context "without an argument" do
|
99
|
+
|
100
|
+
let(:input) do
|
101
|
+
<<-YAML
|
102
|
+
Foo:
|
103
|
+
!GetAZs
|
104
|
+
YAML
|
105
|
+
end
|
106
|
+
|
107
|
+
it "infers a blank argument" do
|
108
|
+
expect(data).to eql(
|
109
|
+
"Foo" => {
|
110
|
+
"Fn::GetAZs" => ""
|
111
|
+
}
|
112
|
+
)
|
113
|
+
end
|
114
|
+
|
115
|
+
end
|
116
|
+
|
117
|
+
end
|
118
|
+
|
119
|
+
describe "!Whatever" do
|
120
|
+
|
121
|
+
let(:input) do
|
122
|
+
<<-YAML
|
123
|
+
Stuff:
|
124
|
+
- !FindInMap [RegionMap, !Ref "AWS::Region", AMI]
|
125
|
+
- !If [CreateProdResources, c1.xlarge, m1.small]
|
126
|
+
- !Join [ ":", [ "a", "b", "c" ] ]
|
127
|
+
YAML
|
128
|
+
end
|
129
|
+
|
130
|
+
it "expands to Fn::Whatever" do
|
131
|
+
expect(data).to eql(
|
132
|
+
"Stuff" => [
|
133
|
+
{
|
134
|
+
"Fn::FindInMap" => ["RegionMap", {"Ref"=>"AWS::Region"}, "AMI"]
|
135
|
+
},
|
136
|
+
{
|
137
|
+
"Fn::If" => ["CreateProdResources", "c1.xlarge", "m1.small"]
|
138
|
+
},
|
139
|
+
{
|
140
|
+
"Fn::Join" => [":", ["a", "b", "c"]]
|
141
|
+
}
|
142
|
+
]
|
143
|
+
)
|
144
|
+
end
|
145
|
+
|
146
|
+
end
|
147
|
+
|
77
148
|
end
|
78
149
|
|
79
150
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stackup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Williams
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-12-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aws-sdk-resources
|
@@ -131,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
131
131
|
version: '0'
|
132
132
|
requirements: []
|
133
133
|
rubyforge_project:
|
134
|
-
rubygems_version: 2.
|
134
|
+
rubygems_version: 2.6.8
|
135
135
|
signing_key:
|
136
136
|
specification_version: 4
|
137
137
|
summary: Manage CloudFormation stacks
|