Validate required fields in sd configuration (#3911)

This commit is contained in:
Marek Siarkowicz 2018-03-05 20:27:54 +01:00 committed by Brian Brazil
parent 5bda3a8ded
commit 86011047ca
2 changed files with 6 additions and 0 deletions

View File

@ -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")
}

View File

@ -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")
}