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

This commit is contained in:
Matthew Rich 2024-05-13 10:13:20 -07:00
parent cf61b1504c
commit 0bcea916a2
3 changed files with 14 additions and 10 deletions

View File

@ -84,16 +84,18 @@ func (n *ContainerNetwork) 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"
}
case machine.EXITSTATEEVENT:
}
}
func (n *ContainerNetwork) URI() string {

View File

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

View File

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