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

Excplicit error on empty stack defaults #380

Merged
merged 1 commit into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -50,6 +50,8 @@ def initialize(config, base_dir)
end
@region_defaults = normalise_region_defaults(config.fetch('region_defaults', {}))
@stacks = []

raise ConfigParseError.new("Stack defaults can't be undefined") if @stack_defaults.nil?
load_template_compilers(config)
load_config
end
Expand Down
5 changes: 5 additions & 0 deletions spec/fixtures/stack_master_empty_default.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
stack_defaults:
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 @@ -42,6 +42,13 @@
end
end

it "gives explicit error on empty defaults" do
Dir.chdir('./spec/fixtures/') do
expect { StackMaster::Config.load!('stack_master_empty_default.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