provisioner(converge): add validate for source and destination

This commit is contained in:
Brian Hicks 2016-12-27 11:41:52 -06:00
parent 4f0034e574
commit 73d5593242
No known key found for this signature in database
GPG Key ID: FF1F407C0D3C2430
1 changed files with 13 additions and 0 deletions

View File

@ -53,6 +53,19 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
},
raws...,
)
if err != nil {
return err
}
// validate sources and destinations
for i, dir := range p.config.ModuleDirs {
if dir.Source == "" {
return fmt.Errorf("Source (\"source\" key) is required in Converge module dir #%d", i)
}
if dir.Destination == "" {
return fmt.Errorf("Destination (\"destination\" key) is required in Converge module dir #%d", i)
}
}
return err
}