|
|
|
|
@ -11,6 +11,11 @@ import (
|
|
|
|
|
func smcUserVariables(c *config.Config, vs map[string]string) []error {
|
|
|
|
|
var errs []error
|
|
|
|
|
|
|
|
|
|
cvs := make(map[string]*config.Variable)
|
|
|
|
|
for _, v := range c.Variables {
|
|
|
|
|
cvs[v.Name] = v
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Check that all required variables are present
|
|
|
|
|
required := make(map[string]struct{})
|
|
|
|
|
for _, v := range c.Variables {
|
|
|
|
|
@ -28,6 +33,20 @@ func smcUserVariables(c *config.Config, vs map[string]string) []error {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Check that types match up
|
|
|
|
|
for k, _ := range vs {
|
|
|
|
|
v, ok := cvs[k]
|
|
|
|
|
if !ok {
|
|
|
|
|
continue
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if v.Type() != config.VariableTypeString {
|
|
|
|
|
errs = append(errs, fmt.Errorf(
|
|
|
|
|
"%s: cannot assign string value to map type",
|
|
|
|
|
k))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO(mitchellh): variables that are unknown
|
|
|
|
|
|
|
|
|
|
return errs
|
|
|
|
|
|