Skip to content

Commit dc874a4

Browse files
authored
Merge pull request #380 from envato/viraptor/nil_defaults
Excplicit error on empty stack defaults
2 parents bb19246 + 01f84c3 commit dc874a4

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

lib/stack_master/config.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ def initialize(config, base_dir)
5050
end
5151
@region_defaults = normalise_region_defaults(config.fetch('region_defaults', {}))
5252
@stacks = []
53+
54+
raise ConfigParseError.new("Stack defaults can't be undefined") if @stack_defaults.nil?
5355
load_template_compilers(config)
5456
load_config
5557
end
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
stack_defaults:
2+
stacks:
3+
us-east-1:
4+
myapp_vpc:
5+
template: myapp_vpc.json

spec/stack_master/config_spec.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@
4242
end
4343
end
4444

45+
it "gives explicit error on empty defaults" do
46+
Dir.chdir('./spec/fixtures/') do
47+
expect { StackMaster::Config.load!('stack_master_empty_default.yml') }
48+
.to raise_error StackMaster::Config::ConfigParseError
49+
end
50+
end
51+
4552
it "searches up the tree for stack master yaml" do
4653
begin
4754
orig_dir = Dir.pwd

0 commit comments

Comments
 (0)