Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report a more explicit error on indentation issues #379

Merged
merged 2 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
10 changes: 10 additions & 0 deletions spec/stack_master/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@
end
end

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

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