fmt step_wait, interruptible_wait
This commit is contained in:
parent
cadf3a5d6a
commit
efbc365b6d
@ -6,24 +6,26 @@ import (
|
||||
)
|
||||
|
||||
type InterruptibleWait struct {
|
||||
Predicate func () (result bool, err error)
|
||||
Predicate func() (result bool, err error)
|
||||
PredicateInterval time.Duration
|
||||
Timeout time.Duration
|
||||
Timeout time.Duration
|
||||
}
|
||||
|
||||
type TimeoutError struct { }
|
||||
type TimeoutError struct{}
|
||||
|
||||
func (err TimeoutError) Error() string {
|
||||
return "Timed out"
|
||||
}
|
||||
|
||||
type InterruptedError struct { }
|
||||
type InterruptedError struct{}
|
||||
|
||||
func (err InterruptedError) Error() string {
|
||||
return "Interrupted"
|
||||
}
|
||||
|
||||
type PredicateResult struct {
|
||||
complete bool
|
||||
err error
|
||||
err error
|
||||
}
|
||||
|
||||
func (wait InterruptibleWait) Wait(state multistep.StateBag) error {
|
||||
|
@ -20,12 +20,12 @@ func (self *stepWait) Run(state multistep.StateBag) multistep.StepAction {
|
||||
|
||||
//Expect install to be configured to shutdown on completion
|
||||
err := InterruptibleWait{
|
||||
Predicate: func () (bool, error) {
|
||||
Predicate: func() (bool, error) {
|
||||
power_state, err := instance.GetPowerState()
|
||||
return power_state == "Halted", err
|
||||
},
|
||||
PredicateInterval: 30 * time.Second,
|
||||
Timeout: config.InstallTimeout,
|
||||
Timeout: config.InstallTimeout,
|
||||
}.Wait(state)
|
||||
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user