bug fix for file-provisioner download file, including unit-test code.
This commit is contained in:
开恒 2016-09-19 10:36:18 +08:00
parent 5919f8d552
commit 96a637684b
2 changed files with 5 additions and 1 deletions

View File

@ -109,7 +109,7 @@ func (p *Provisioner) ProvisionDownload(ui packer.Ui, comm packer.Communicator)
}
}
// if the config.Destination was a dir, download the dir
if !strings.HasSuffix(p.config.Destination, "/") {
if strings.HasSuffix(p.config.Destination, "/") {
return comm.DownloadDir(src, p.config.Destination, nil)
}

View File

@ -192,5 +192,9 @@ func TestProvisionDownloadMkdirAll(t *testing.T) {
if _, err := os.Stat(path); err != nil {
t.Fatalf("stat of download dir should not error: %s", err)
}
if _, err := os.Stat(config["destination"].(string)); err != nil {
t.Fatalf("stat of destination file should not error: %s", err)
}
}
}