Skip to content

Commit bb19246

Browse files
authored
Merge pull request #379 from envato/viraptor/indent-error
Report a more explicit error on indentation issues
2 parents 5ad2eb3 + 8752fb4 commit bb19246

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

lib/stack_master/config.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ def load_stacks(stacks)
112112
stacks.each do |region, stacks_for_region|
113113
region = Utils.underscore_to_hyphen(region)
114114
stacks_for_region.each do |stack_name, attributes|
115+
raise ConfigParseError.new("Entry for stack #{stack_name} has no attributes") if attributes.nil?
116+
115117
stack_name = Utils.underscore_to_hyphen(stack_name)
116118
stack_attributes = build_stack_defaults(region).deeper_merge!(attributes).merge(
117119
'region' => region,
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
stacks:
2+
us-east-1:
3+
myapp_vpc:
4+
template: myapp_vpc.json

spec/stack_master/config_spec.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@
3535
end
3636
end
3737

38+
it "gives explicit error on badly indented entries" do
39+
Dir.chdir('./spec/fixtures/') do
40+
expect { StackMaster::Config.load!('stack_master_wrong_indent.yml') }
41+
.to raise_error StackMaster::Config::ConfigParseError
42+
end
43+
end
44+
3845
it "searches up the tree for stack master yaml" do
3946
begin
4047
orig_dir = Dir.pwd

0 commit comments

Comments
 (0)