builder/amazonebs: If cancelled, don't return artifact

This commit is contained in:
Mitchell Hashimoto 2013-06-04 10:59:12 -07:00
parent 5aa78cb4aa
commit f67fdecab6
1 changed files with 8 additions and 0 deletions

View File

@ -102,6 +102,14 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook) packer.Artifact {
b.runner = &multistep.BasicRunner{Steps: steps} b.runner = &multistep.BasicRunner{Steps: steps}
b.runner.Run(state) 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 // Build the artifact and return it
return &artifact{state["amis"].(map[string]string)} return &artifact{state["amis"].(map[string]string)}
} }