Skip to content

Commit

Permalink
Excplicit error on empty stack defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
viraptor committed Mar 7, 2024
1 parent bb19246 commit 01f84c3
Show file tree
Hide file tree
Showing 3 changed files with 14 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 @@ -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

0 comments on commit 01f84c3

Please sign in to comment.