From f67fdecab6c184e0ea04c2f6cdd24591a69b692d Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 4 Jun 2013 10:59:12 -0700 Subject: [PATCH] builder/amazonebs: If cancelled, don't return artifact --- builder/amazonebs/builder.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/builder/amazonebs/builder.go b/builder/amazonebs/builder.go index 6b1ac9edb..577506c83 100644 --- a/builder/amazonebs/builder.go +++ b/builder/amazonebs/builder.go @@ -102,6 +102,14 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook) packer.Artifact { b.runner = &multistep.BasicRunner{Steps: steps} b.runner.Run(state) + // If we were cancelled, then return no artifacts + if raw, ok := state["cancelled"]; ok { + cancelled := raw.(bool) + if cancelled { + return nil + } + } + // Build the artifact and return it return &artifact{state["amis"].(map[string]string)} }