builder/digitalocean: only execute the snapshotname template if parsed

This commit is contained in:
Jack Pearkes 2013-06-18 00:06:59 +02:00
parent b75daf62ff
commit 4236ffc8eb
1 changed files with 3 additions and 2 deletions

View File

@ -137,9 +137,10 @@ func (b *Builder) Prepare(raws ...interface{}) error {
t, err := template.New("snapshot").Parse(b.config.RawSnapshotName)
if err != nil {
errs = append(errs, fmt.Errorf("Failed parsing snapshot_name: %s", err))
}
} else {
t.Execute(snapNameBuf, tData)
b.config.SnapshotName = snapNameBuf.String()
}
if len(errs) > 0 {
return &packer.MultiError{errs}