forked from cloudfoundry/bosh-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prepare_configure_networks.go
58 lines (46 loc) · 1.37 KB
/
prepare_configure_networks.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
48
49
50
51
52
53
54
55
56
57
58
package action
import (
"errors"
boshplatform "github.com/cloudfoundry/bosh-agent/platform"
boshsettings "github.com/cloudfoundry/bosh-agent/settings"
bosherr "github.com/cloudfoundry/bosh-utils/errors"
)
type PrepareConfigureNetworksAction struct {
platform boshplatform.Platform
settingsService boshsettings.Service
}
func NewPrepareConfigureNetworks(
platform boshplatform.Platform,
settingsService boshsettings.Service,
) PrepareConfigureNetworksAction {
return PrepareConfigureNetworksAction{
platform: platform,
settingsService: settingsService,
}
}
func (a PrepareConfigureNetworksAction) IsAsynchronous(_ ProtocolVersion) bool {
return false
}
func (a PrepareConfigureNetworksAction) IsPersistent() bool {
return false
}
func (a PrepareConfigureNetworksAction) IsLoggable() bool {
return true
}
func (a PrepareConfigureNetworksAction) Run() (string, error) {
err := a.settingsService.InvalidateSettings()
if err != nil {
return "", bosherr.WrapError(err, "Invalidating settings")
}
err = a.platform.PrepareForNetworkingChange()
if err != nil {
return "", bosherr.WrapError(err, "Preparing for networking change")
}
return "ok", nil
}
func (a PrepareConfigureNetworksAction) Resume() (interface{}, error) {
return nil, errors.New("not supported")
}
func (a PrepareConfigureNetworksAction) Cancel() error {
return errors.New("not supported")
}