Remove `req` param from validateDirectoryConfig

This commit is contained in:
Dan Fuchs 2017-04-05 09:14:30 -05:00
parent 50637a68bf
commit 39a9eac44f
1 changed files with 2 additions and 7 deletions

View File

@ -125,7 +125,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
} }
if len(p.config.InventoryDirectory) > 0 { if len(p.config.InventoryDirectory) > 0 {
err = validateDirectoryConfig(p.config.InventoryDirectory, "inventory_directory", true) err = validateDirectoryConfig(p.config.InventoryDirectory, "inventory_directory")
if err != nil { if err != nil {
log.Println(p.config.InventoryDirectory, "does not exist") log.Println(p.config.InventoryDirectory, "does not exist")
errs = packer.MultiErrorAppend(errs, err) errs = packer.MultiErrorAppend(errs, err)
@ -391,12 +391,7 @@ func validateFileConfig(name string, config string, req bool) error {
return nil return nil
} }
func validateDirectoryConfig(name string, config string, req bool) error { func validateDirectoryConfig(name string, config string) error {
if req {
if name == "" {
return fmt.Errorf("%s must be specified.", config)
}
}
info, err := os.Stat(name) info, err := os.Stat(name)
if err != nil { if err != nil {
return fmt.Errorf("%s: %s is invalid: %s", config, name, err) return fmt.Errorf("%s: %s is invalid: %s", config, name, err)