From 82735652552d7c7c7f98056143ca410007349c91 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 22 May 2013 14:36:21 -0700 Subject: [PATCH] better comments for TODO --- builder/amazonebs/builder.go | 10 +++++++++- packer/template.go | 8 +++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/builder/amazonebs/builder.go b/builder/amazonebs/builder.go index 0af6a84ad..a3d2793ed 100644 --- a/builder/amazonebs/builder.go +++ b/builder/amazonebs/builder.go @@ -44,7 +44,15 @@ func (b *Builder) Prepare(raw interface{}) (err error) { log.Printf("Config: %+v", b.config) - // TODO: Validate the configuration + // TODO: config validation and asking for fields: + // * access key + // * secret key + // * region + // * source ami + // * instance type + // * SSH username + // * SSH port? (or default to 22?) + return } diff --git a/packer/template.go b/packer/template.go index 4b9d1f71c..6e5195628 100644 --- a/packer/template.go +++ b/packer/template.go @@ -35,7 +35,10 @@ type rawBuilderConfig struct { } // ParseTemplate takes a byte slice and parses a Template from it, returning -// the template and possibly errors while loading the template. +// the template and possibly errors while loading the template. The error +// could potentially be a MultiError, representing multiple errors. Knowing +// and checking for this can be useful, if you wish to format it in a certain +// way. func ParseTemplate(data []byte) (t *Template, err error) { var rawTpl rawTemplate err = json.Unmarshal(data, &rawTpl) @@ -49,6 +52,8 @@ func ParseTemplate(data []byte) (t *Template, err error) { t.Hooks = rawTpl.Hooks errors := make([]error, 0) + + // Gather all the builders for i, v := range rawTpl.Builders { rawType, ok := v["type"] if !ok { @@ -86,6 +91,7 @@ func ParseTemplate(data []byte) (t *Template, err error) { t.Builders[name] = rawBuilderConfig{typeName, v} } + // If there were errors, we put it into a MultiError and return if len(errors) > 0 { err = &MultiError{errors} return