config: validate type of default to string or mapping for var

This commit is contained in:
Mitchell Hashimoto 2014-07-22 08:34:24 -07:00
parent e59ff6e92c
commit 61938c070f
2 changed files with 7 additions and 6 deletions

View File

@ -108,8 +108,13 @@ func (c *Config) Validate() error {
varMap[v.Name] = v
}
// TODO(mitchellh): Validate that variable defaults are only a string
// or mapping of strings.
for _, v := range c.Variables {
if v.Type() == VariableTypeUnknown {
errs = append(errs, fmt.Errorf(
"Variable '%s': must be string or mapping",
v.Name))
}
}
// Check for references to user variables that do not actually
// exist and record those errors.

View File

@ -73,10 +73,6 @@ func TestConfigValidate_varDefault(t *testing.T) {
}
func TestConfigValidate_varDefaultBadType(t *testing.T) {
t.Skip()
// TODO(mitchellh): FIX
c := testConfig(t, "validate-var-default-bad-type")
if err := c.Validate(); err == nil {
t.Fatal("should not be valid")