Commit ce275969 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

builder/docker: don't attempt to read artifact if cancelled

parent 6570b53c
...@@ -77,8 +77,13 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe ...@@ -77,8 +77,13 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
return nil, rawErr.(error) return nil, rawErr.(error)
} }
var artifact packer.Artifact // If it was cancelled, then just return
if _, ok := state.GetOk(multistep.StateCancelled); ok {
return nil, nil
}
// No errors, must've worked // No errors, must've worked
var artifact packer.Artifact
if b.config.Commit { if b.config.Commit {
artifact = &ImportArtifact{ artifact = &ImportArtifact{
IdValue: state.Get("image_id").(string), IdValue: state.Get("image_id").(string),
...@@ -88,6 +93,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe ...@@ -88,6 +93,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
} else { } else {
artifact = &ExportArtifact{path: b.config.ExportPath} artifact = &ExportArtifact{path: b.config.ExportPath}
} }
return artifact, nil return artifact, nil
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment