Skip to content

Commit

Permalink
Merge pull request #379 from envato/viraptor/indent-error
Browse files Browse the repository at this point in the history
Report a more explicit error on indentation issues
  • Loading branch information
viraptor authored Mar 6, 2024
2 parents 5ad2eb3 + 8752fb4 commit bb19246
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/stack_master/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ def load_stacks(stacks)
stacks.each do |region, stacks_for_region|
region = Utils.underscore_to_hyphen(region)
stacks_for_region.each do |stack_name, attributes|
raise ConfigParseError.new("Entry for stack #{stack_name} has no attributes") if attributes.nil?

stack_name = Utils.underscore_to_hyphen(stack_name)
stack_attributes = build_stack_defaults(region).deeper_merge!(attributes).merge(
'region' => region,
Expand Down
4 changes: 4 additions & 0 deletions spec/fixtures/stack_master_wrong_indent.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
stacks:
us-east-1:
myapp_vpc:
template: myapp_vpc.json
7 changes: 7 additions & 0 deletions spec/stack_master/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@
end
end

it "gives explicit error on badly indented entries" do
Dir.chdir('./spec/fixtures/') do
expect { StackMaster::Config.load!('stack_master_wrong_indent.yml') }
.to raise_error StackMaster::Config::ConfigParseError
end
end

it "searches up the tree for stack master yaml" do
begin
orig_dir = Dir.pwd
Expand Down

0 comments on commit bb19246

Please sign in to comment.