diff --git a/lib/stack_master/config.rb b/lib/stack_master/config.rb index c29c2338..0c8b91e8 100644 --- a/lib/stack_master/config.rb +++ b/lib/stack_master/config.rb @@ -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, diff --git a/spec/fixtures/stack_master_wrong_indent.yml b/spec/fixtures/stack_master_wrong_indent.yml new file mode 100644 index 00000000..9033cd33 --- /dev/null +++ b/spec/fixtures/stack_master_wrong_indent.yml @@ -0,0 +1,4 @@ +stacks: + us-east-1: + myapp_vpc: + template: myapp_vpc.json diff --git a/spec/stack_master/config_spec.rb b/spec/stack_master/config_spec.rb index d16dd438..44acf35e 100644 --- a/spec/stack_master/config_spec.rb +++ b/spec/stack_master/config_spec.rb @@ -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