Report an warning when no stages are defined for a hook
We accidently defined hooks using stages rather then stage, which causes all of the hooks not to work, but we saw no complaints in the log files about this. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
parent
a34038350c
commit
4c5d16a5eb
1 changed files with 7 additions and 3 deletions
10
lib/hooks.go
10
lib/hooks.go
|
@ -53,9 +53,13 @@ func readHook(hookPath string) (HookParams, error) {
|
|||
return hook, errors.Wrapf(err, "invalid cmd regular expression %q defined in hook config %q", cmd, hookPath)
|
||||
}
|
||||
}
|
||||
for _, stage := range hook.Stage {
|
||||
if !validStage[stage] {
|
||||
return hook, errors.Wrapf(err, "unknown stage %q defined in hook config %q", stage, hookPath)
|
||||
if len(hook.Stage) == 0 {
|
||||
logrus.Warnf("No stage defined in hook config %q, hook will never run", hookPath)
|
||||
} else {
|
||||
for _, stage := range hook.Stage {
|
||||
if !validStage[stage] {
|
||||
return hook, errors.Wrapf(err, "unknown stage %q defined in hook config %q", stage, hookPath)
|
||||
}
|
||||
}
|
||||
}
|
||||
return hook, nil
|
||||
|
|
Loading…
Reference in a new issue