diff --git a/internal/resource/user.go b/internal/resource/user.go index 7c45fbd..ee1dc7d 100644 --- a/internal/resource/user.go +++ b/internal/resource/user.go @@ -97,11 +97,12 @@ func (u *User) Notify(m *machine.EventMessage) { case machine.ENTERSTATEEVENT: switch m.Dest { case "start_create": - if e := u.Create(ctx); e != nil { - if triggerErr := u.stater.Trigger("created"); triggerErr != nil { - // transition error + if e := u.Create(ctx); e == nil { + if triggerErr := u.stater.Trigger("created"); triggerErr == nil { + return } } + u.State = "absent" case "present": u.State = "present" } diff --git a/internal/target/decl.go b/internal/target/decl.go index 2c0fadc..c674c2f 100644 --- a/internal/target/decl.go +++ b/internal/target/decl.go @@ -46,7 +46,7 @@ func NewFileDocTarget(u *url.URL, format string, gzip bool, fileUri bool) DocTar t.Path = filepath.Join(u.Hostname(), u.Path) } if e := t.Open(); e != nil { - // open target + return nil } return t } @@ -71,7 +71,7 @@ func init() { } } if e := t.Open(); e != nil { - // open target + return nil } return t })