From 0bcea916a2e9dfe97d2574868a0aa7303cf6e534 Mon Sep 17 00:00:00 2001 From: Matthew Rich Date: Mon, 13 May 2024 10:13:20 -0700 Subject: [PATCH] fix lint errors --- internal/resource/container_network.go | 10 ++++++---- internal/resource/file.go | 7 ++++--- internal/resource/http.go | 7 ++++--- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/internal/resource/container_network.go b/internal/resource/container_network.go index f755a17..fd5bc1c 100644 --- a/internal/resource/container_network.go +++ b/internal/resource/container_network.go @@ -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 { diff --git a/internal/resource/file.go b/internal/resource/file.go index 9b09ef4..9391e53 100644 --- a/internal/resource/file.go +++ b/internal/resource/file.go @@ -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" } diff --git a/internal/resource/http.go b/internal/resource/http.go index cc1a95f..3562746 100644 --- a/internal/resource/http.go +++ b/internal/resource/http.go @@ -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" }