fix lint errors
Some checks failed
Lint / golangci-lint (push) Failing after 9m47s
Declarative Tests / test (push) Successful in 1m19s

This commit is contained in:
Matthew Rich 2024-05-13 11:07:31 -07:00
parent 0bcea916a2
commit 6d816a17bc
3 changed files with 12 additions and 9 deletions

View File

@ -164,11 +164,12 @@ func (i *Iptable) Notify(m *machine.EventMessage) {
case machine.ENTERSTATEEVENT:
switch m.Dest {
case "start_create":
if e := i.Create(ctx); e != nil {
if triggerErr := i.stater.Trigger("created"); triggerErr != nil {
// transition error
if e := i.Create(ctx); e == nil {
if triggerErr := i.stater.Trigger("created"); triggerErr == nil {
return
}
}
i.State = "absent"
case "present":
i.State = "present"
}

View File

@ -153,11 +153,12 @@ func (n *NetworkRoute) Notify(m *machine.EventMessage) {
case machine.ENTERSTATEEVENT:
switch m.Dest {
case "start_create":
if e := n.Create(ctx); e != nil {
if triggerErr := n.stater.Trigger("created"); triggerErr != nil {
// transition error
if e := n.Create(ctx); e == nil {
if triggerErr := n.stater.Trigger("created"); triggerErr == nil {
return
}
}
n.State = "absent"
case "present":
n.State = "present"
}

View File

@ -109,11 +109,12 @@ func (p *Package) Notify(m *machine.EventMessage) {
case machine.ENTERSTATEEVENT:
switch m.Dest {
case "start_create":
if e := p.Create(ctx); e != nil {
if triggerErr := p.stater.Trigger("created"); triggerErr != nil {
// transition error
if e := p.Create(ctx); e == nil {
if triggerErr := p.stater.Trigger("created"); triggerErr == nil {
return
}
}
p.State = "absent"
case "present":
p.State = "present"
}