From 1c71eaaa91cf43f24eac59d412907c0bcd58cc37 Mon Sep 17 00:00:00 2001 From: Chris Bednarski Date: Tue, 7 Jul 2015 17:12:21 -0600 Subject: [PATCH] Change panic to multierror --- builder/googlecompute/config.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/builder/googlecompute/config.go b/builder/googlecompute/config.go index dc049aa1c..317d64ace 100644 --- a/builder/googlecompute/config.go +++ b/builder/googlecompute/config.go @@ -59,6 +59,8 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { return nil, nil, err } + var errs *packer.MultiError + // Set defaults. if c.Network == "" { c.Network = "default" @@ -75,11 +77,10 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { if c.ImageName == "" { img, err := interpolate.Render("packer-{{timestamp}}", nil) if err != nil { - panic(err) + errs = packer.MultiErrorAppend(errs, + fmt.Errorf("Unable to parse image name: %s ", err)) + c.ImageName = img } - - // Default to packer-{{ unix timestamp (utc) }} - c.ImageName = img } if c.InstanceName == "" { @@ -102,7 +103,6 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { c.Comm.SSHUsername = "root" } - var errs *packer.MultiError if es := c.Comm.Prepare(&c.ctx); len(es) > 0 { errs = packer.MultiErrorAppend(errs, es...) }