From e45223a86757573070ded161dca08a7e56ad5539 Mon Sep 17 00:00:00 2001 From: Vijaya Bhaskar Reddy Kondreddi Date: Thu, 31 Aug 2017 23:13:00 +0530 Subject: [PATCH] Fix -on-error issue not working. When we supply -on-error flag for Packer with Hyper-v builder, it does not do anything. --- builder/cloudstack/builder.go | 13 ++----------- builder/hyperv/iso/builder.go | 12 +----------- builder/oneandone/builder.go | 10 +--------- builder/profitbricks/builder.go | 10 +--------- .../googlecompute-export/post-processor.go | 9 +-------- post-processor/vagrant-cloud/post-processor.go | 10 +--------- 6 files changed, 7 insertions(+), 57 deletions(-) diff --git a/builder/cloudstack/builder.go b/builder/cloudstack/builder.go index c4ad8a5b2..8bd6dfed2 100644 --- a/builder/cloudstack/builder.go +++ b/builder/cloudstack/builder.go @@ -89,17 +89,8 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe &stepCreateTemplate{}, } - // Configure the runner. - if b.config.PackerDebug { - b.runner = &multistep.DebugRunner{ - Steps: steps, - PauseFn: common.MultistepDebugFn(ui), - } - } else { - b.runner = &multistep.BasicRunner{Steps: steps} - } - - // Run the steps. + // Configure the runner and run the steps. + b.runner = common.NewRunner(steps, b.config.PackerConfig, ui) b.runner.Run(state) // If there was an error, return that diff --git a/builder/hyperv/iso/builder.go b/builder/hyperv/iso/builder.go index 657c07886..9b4065d8c 100644 --- a/builder/hyperv/iso/builder.go +++ b/builder/hyperv/iso/builder.go @@ -405,17 +405,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe } // Run the steps. - if b.config.PackerDebug { - pauseFn := common.MultistepDebugFn(ui) - state.Put("pauseFn", pauseFn) - b.runner = &multistep.DebugRunner{ - Steps: steps, - PauseFn: pauseFn, - } - } else { - b.runner = &multistep.BasicRunner{Steps: steps} - } - + b.runner = common.NewRunner(steps, b.config.PackerConfig, ui) b.runner.Run(state) // Report any errors. diff --git a/builder/oneandone/builder.go b/builder/oneandone/builder.go index f4f8e1dc3..ad470c152 100644 --- a/builder/oneandone/builder.go +++ b/builder/oneandone/builder.go @@ -50,15 +50,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe new(stepTakeSnapshot), } - if b.config.PackerDebug { - b.runner = &multistep.DebugRunner{ - Steps: steps, - PauseFn: common.MultistepDebugFn(ui), - } - } else { - b.runner = &multistep.BasicRunner{Steps: steps} - } - + b.runner = common.NewRunner(steps, b.config.PackerConfig, ui) b.runner.Run(state) if rawErr, ok := state.GetOk("error"); ok { diff --git a/builder/profitbricks/builder.go b/builder/profitbricks/builder.go index 95a2b1b2d..750b843c0 100644 --- a/builder/profitbricks/builder.go +++ b/builder/profitbricks/builder.go @@ -49,15 +49,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe config := state.Get("config").(*Config) - if b.config.PackerDebug { - b.runner = &multistep.DebugRunner{ - Steps: steps, - PauseFn: common.MultistepDebugFn(ui), - } - } else { - b.runner = &multistep.BasicRunner{Steps: steps} - } - + b.runner = common.NewRunner(steps, b.config.PackerConfig, ui) b.runner.Run(state) if rawErr, ok := state.GetOk("error"); ok { diff --git a/post-processor/googlecompute-export/post-processor.go b/post-processor/googlecompute-export/post-processor.go index 9fd39aa46..8a5befbc8 100644 --- a/post-processor/googlecompute-export/post-processor.go +++ b/post-processor/googlecompute-export/post-processor.go @@ -120,14 +120,7 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac } // Run the steps. - if p.config.PackerDebug { - p.runner = &multistep.DebugRunner{ - Steps: steps, - PauseFn: common.MultistepDebugFn(ui), - } - } else { - p.runner = &multistep.BasicRunner{Steps: steps} - } + p.runner = common.NewRunner(steps, p.config.PackerConfig, ui) p.runner.Run(state) } diff --git a/post-processor/vagrant-cloud/post-processor.go b/post-processor/vagrant-cloud/post-processor.go index 01575def7..b8eeb7105 100644 --- a/post-processor/vagrant-cloud/post-processor.go +++ b/post-processor/vagrant-cloud/post-processor.go @@ -164,15 +164,7 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac } // Run the steps - if p.config.PackerDebug { - p.runner = &multistep.DebugRunner{ - Steps: steps, - PauseFn: common.MultistepDebugFn(ui), - } - } else { - p.runner = &multistep.BasicRunner{Steps: steps} - } - + p.runner = common.NewRunner(steps, p.config.PackerConfig, ui) p.runner.Run(state) // If there was an error, return that