mirror of
https://github.com/prometheus/alertmanager
synced 2025-02-07 22:21:52 +00:00
Add check for undefined name in a mute time interval
Signed-off-by: Ben Ridley <benridley29@gmail.com>
This commit is contained in:
parent
44e9aa9762
commit
ad385c275f
@ -226,6 +226,18 @@ type MuteTimeInterval struct {
|
||||
TimeIntervals []timeinterval.TimeInterval `yaml:"time_intervals"`
|
||||
}
|
||||
|
||||
// UnmarshalYAML implements the yaml.Unmarshaler interface for MuteTimeInterval
|
||||
func (mt *MuteTimeInterval) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||
type plain MuteTimeInterval
|
||||
if err := unmarshal((*plain)(mt)); err != nil {
|
||||
return err
|
||||
}
|
||||
if mt.Name == "" {
|
||||
return fmt.Errorf("missing name in mute time interval")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Config is the top-level configuration for Alertmanager's config files.
|
||||
type Config struct {
|
||||
Global *GlobalConfig `yaml:"global,omitempty" json:"global,omitempty"`
|
||||
|
Loading…
Reference in New Issue
Block a user