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.
@@ -53,11 +53,15 @@ func readHook(hookPath string) (HookParams, error) {
return hook, errors.Wrapf(err, "invalid cmd regular expression %q defined in hook config %q", cmd, 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
}
