Files
Packer-Cn/builder/amazon/chroot/step_early_unflock.go
T

32 lines
782 B
Go
Raw Normal View History

package chroot
import (
2018-01-22 15:32:33 -08:00
"context"
"fmt"
2018-01-22 15:32:33 -08:00
"log"
2019-10-24 04:21:08 +00:00
"github.com/hashicorp/packer/common/chroot"
2018-01-19 16:18:44 -08:00
"github.com/hashicorp/packer/helper/multistep"
2017-04-04 13:39:01 -07:00
"github.com/hashicorp/packer/packer"
)
// StepEarlyUnflock unlocks the flock.
type StepEarlyUnflock struct{}
func (s *StepEarlyUnflock) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
2019-10-24 04:21:08 +00:00
cleanup := state.Get("flock_cleanup").(chroot.Cleanup)
2013-08-31 12:58:55 -07:00
ui := state.Get("ui").(packer.Ui)
log.Println("Unlocking file lock...")
if err := cleanup.CleanupFunc(state); err != nil {
err := fmt.Errorf("Error unlocking file lock: %s", err)
2013-08-31 12:58:55 -07:00
state.Put("error", err)
ui.Error(err.Error())
return multistep.ActionHalt
}
return multistep.ActionContinue
}
2013-08-31 12:58:55 -07:00
func (s *StepEarlyUnflock) Cleanup(state multistep.StateBag) {}