action.Parent
This commit is contained in:
parent
f91cd6e28e
commit
130d4fedc7
3
main.go
3
main.go
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user