mirror of
https://github.com/prometheus/prometheus
synced 2024-12-24 15:32:48 +00:00
Validate required fields in sd configuration (#3911)
This commit is contained in:
parent
5bda3a8ded
commit
86011047ca
@ -86,6 +86,9 @@ func (c *SDConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if c.SubscriptionID == "" {
|
||||
return fmt.Errorf("Azure SD configuration requires a subscription_id")
|
||||
}
|
||||
|
||||
return yaml_util.CheckOverflow(c.XXX, "azure_sd_config")
|
||||
}
|
||||
|
@ -103,6 +103,9 @@ func (c *SDConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||
if c.Role == "" {
|
||||
return fmt.Errorf("role missing (one of: instance, hypervisor)")
|
||||
}
|
||||
if c.Region == "" {
|
||||
return fmt.Errorf("Openstack SD configuration requires a region")
|
||||
}
|
||||
return yaml_util.CheckOverflow(c.XXX, "openstack_sd_config")
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user