-
Notifications
You must be signed in to change notification settings - Fork 115
/
prepare.go
47 lines (36 loc) · 992 Bytes
/
prepare.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package action
import (
"errors"
boshappl "github.com/cloudfoundry/bosh-agent/agent/applier"
boshas "github.com/cloudfoundry/bosh-agent/agent/applier/applyspec"
bosherr "github.com/cloudfoundry/bosh-utils/errors"
)
type PrepareAction struct {
applier boshappl.Applier
}
func NewPrepare(applier boshappl.Applier) (action PrepareAction) {
action.applier = applier
return action
}
func (a PrepareAction) IsAsynchronous(_ ProtocolVersion) bool {
return true
}
func (a PrepareAction) IsPersistent() bool {
return false
}
func (a PrepareAction) IsLoggable() bool {
return true
}
func (a PrepareAction) Run(desiredSpec boshas.V1ApplySpec) (string, error) {
err := a.applier.Prepare(desiredSpec)
if err != nil {
return "", bosherr.WrapError(err, "Preparing apply spec")
}
return "prepared", nil
}
func (a PrepareAction) Resume() (interface{}, error) {
return nil, errors.New("not supported")
}
func (a PrepareAction) Cancel() error {
return errors.New("not supported")
}