Merge pull request #6756 from hashicorp/fix_6738

update winrmcp vendor and update error message in file provisioner to…
This commit is contained in:
Adrien Delorme 2018-09-26 13:24:55 +02:00 committed by GitHub
commit 78c8e0f114
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 5 deletions

View File

@ -185,6 +185,11 @@ func (p *Provisioner) ProvisionUpload(ui packer.Ui, comm packer.Communicator) er
// Upload the file
if err = comm.Upload(dst, pf, &fi); err != nil {
if strings.Contains(err.Error(), "Error restoring file") {
ui.Error(fmt.Sprintf("Upload failed: %s; this can occur when "+
"your file destination is a folder without a trailing "+
"slash.", err))
}
ui.Error(fmt.Sprintf("Upload failed: %s", err))
return err
}

View File

@ -117,7 +117,11 @@ func restoreContent(client *winrm.Client, fromPath, toPath string) error {
$tmp_file_path = [System.IO.Path]::GetFullPath("%s")
$dest_file_path = [System.IO.Path]::GetFullPath("%s".Trim("'"))
if (Test-Path $dest_file_path) {
rm $dest_file_path
if (Test-Path -Path $dest_file_path -PathType container) {
Exit 1
} else {
rm $dest_file_path
}
}
else {
$dest_dir = ([System.IO.Path]::GetDirectoryName($dest_file_path))

6
vendor/vendor.json vendored
View File

@ -1321,10 +1321,10 @@
"versionExact": "v2.0.0"
},
{
"checksumSHA1": "/NoE6t3UkW4/iKAtbf59GGv6tF8=",
"checksumSHA1": "qDOL2Q0BzBA5WwQN06a5/MbEGFQ=",
"path": "github.com/packer-community/winrmcp/winrmcp",
"revision": "81144009af586de8e7729b829266f09dd0d59701",
"revisionTime": "2018-01-02T16:08:24Z"
"revision": "0fd363d6159ae26cd0be16262941301e69461641",
"revisionTime": "2018-09-21T17:45:48Z"
},
{
"checksumSHA1": "oaXvjFg802gS/wx1bx2gAQwa7XQ=",

View File

@ -44,7 +44,11 @@ The available configuration options are listed below.
- `destination` (string) - The path where the file will be uploaded to in
the machine. This value must be a writable location and any parent
directories must already exist.
directories must already exist. If the source is a file, it's a good idea to
make the destination a file as well, but if you set your destination as a
directory, at least make sure that the destination ends in a trailing slash
so that Packer knows to use the source's basename in the final upload path.
Failure to do so may cause Packer to fail on file uploads.
- `direction` (string) - The direction of the file transfer. This defaults to
"upload". If it is set to "download" then the file "source" in the machine