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"`
|
OnError []ActionConfig `yaml:"onError"`
|
||||||
|
|
||||||
_dirConf *DirectoryConfig
|
_dirConf *DirectoryConfig
|
||||||
|
Parent *ActionConfig `yaml:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type DirectoryConfig struct {
|
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)
|
log.Printf("path: %s; action: %s; error %s", eventInfo.Path(), action.Id, err)
|
||||||
for _, aE := range action.OnError {
|
for _, aE := range action.OnError {
|
||||||
aE._dirConf = action._dirConf
|
aE._dirConf = action._dirConf
|
||||||
|
aE.Parent = action
|
||||||
_c, _ := runAction(&aE, eventInfo, ctx)
|
_c, _ := runAction(&aE, eventInfo, ctx)
|
||||||
contin = contin && _c
|
contin = contin && _c
|
||||||
if !contin {
|
if !contin {
|
||||||
@ -253,6 +255,7 @@ func runAction(action *ActionConfig, eventInfo notify.EventInfo, ctx actionCtx)
|
|||||||
} else {
|
} else {
|
||||||
for _, aS := range action.OnSuccess {
|
for _, aS := range action.OnSuccess {
|
||||||
aS._dirConf = action._dirConf
|
aS._dirConf = action._dirConf
|
||||||
|
aS.Parent = action
|
||||||
_c, errS := runAction(&aS, eventInfo, ctx)
|
_c, errS := runAction(&aS, eventInfo, ctx)
|
||||||
contin = contin && _c
|
contin = contin && _c
|
||||||
if errS != nil {
|
if errS != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user