action.Parent

This commit is contained in:
Sebastian Frank 2021-08-12 16:55:37 +02:00
parent f91cd6e28e
commit 130d4fedc7
Signed by: apairon
GPG Key ID: A0E05A8199CE3F57

View File

@ -47,6 +47,7 @@ type ActionConfig struct {
OnError []ActionConfig `yaml:"onError"`
_dirConf *DirectoryConfig
Parent *ActionConfig `yaml:"-"`
}
type DirectoryConfig struct {
@ -244,6 +245,7 @@ func runAction(action *ActionConfig, eventInfo notify.EventInfo, ctx actionCtx)
log.Printf("path: %s; action: %s; error %s", eventInfo.Path(), action.Id, err)
for _, aE := range action.OnError {
aE._dirConf = action._dirConf
aE.Parent = action
_c, _ := runAction(&aE, eventInfo, ctx)
contin = contin && _c
if !contin {
@ -253,6 +255,7 @@ func runAction(action *ActionConfig, eventInfo notify.EventInfo, ctx actionCtx)
} else {
for _, aS := range action.OnSuccess {
aS._dirConf = action._dirConf
aS.Parent = action
_c, errS := runAction(&aS, eventInfo, ctx)
contin = contin && _c
if errS != nil {