hashicorp / hashicorp/packer-plugin-amazon
SCP session completes before file transfer completes?
- Dominant language
- Go
- Stars
- 91
- Forks
- 141
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 3
Description
_This issue was originally opened by @DayneD89 as hashicorp/packer#8326. It was migrated here as a result of the [Packer plugin split](https://github.com/hashicorp/packer/issues/8610#issuecomment-770034737). The original body of the issue is below._
I couldn't find anything anywhere, but sorry if this has been raised before.
I'm trying to use SSH instead of WinRM as my communicator for a windows amazon-ebs build to improve the speed of the file provisioner. I've got ssh connecting, but it fails when I transfer the file. This is the relevant provisioner (It runs fine is I take this section out):
`{
"type":"file",
"source":"files/installs/7z1900-x64.msi",
"destination":"C:\\7zip.msi"
}`
And this is from my logs:
2019/11/05 12:45:45 ui: ^[[1;32m==> amazon-ebs: Connected to SSH!^[[0m
2019/11/05 12:45:45 packer: 2019/11/05 12:45:45 Running the provision hook
2019/11/05 12:45:45 [INFO] (telemetry) Starting provisioner file
2019/11/05 12:45:45 ui: ^[[1;32m==> amazon-ebs: Uploading files/installs/7z1900-x64.msi => C:\7zip.msi^[[0m
2019/11/05 12:45:45 packer: 2019/11/05 12:45:45 [DEBUG] Opening new ssh session
2019/11/05 12:45:46 packer: 2019/11/05 12:45:46 [DEBUG] Starting remote scp process: scp -vt .
2019/11/05 12:45:46 packer: 2019/11/05 12:45:46 [DEBUG] Started SCP session, beginning transfers...
2019/11/05 12:45:46 packer: 2019/11/05 12:45:46 [DEBUG] scp: Uploading C:\7zip.msi: perms=C0777 size=1748480
2019/11/05 12:45:47 packer: 2019/11/05 12:45:47 [DEBUG] SCP session complete, closing stdin pipe.
2019/11/05 12:45:47 packer: 2019/11/05 12:45:47 [DEBUG] Waiting for SSH session to complete.
2019/11/05 12:45:47 packer: 2019/11/05 12:45:47 [DEBUG] non-zero exit status: 1
2019/11/05 12:45:47 packer: 2019/11/05 12:45:47 [DEBUG] scp output: ^Ascp: ./C:\7zip.msi: Protocol not available
2019/11/05 12:45:47 packer: ^Ascp: protocol error: expected control record
2019/11/05 12:45:47 ui error: ^[[1;31m==> amazon-ebs: Upload failed: Process exited with status 1^[[0m
2019/11/05 12:45:47 packer: 2019/11/05 12:45:47 closing
2019/11/05 12:45:47 closing
2019/11/05 12:45:47 packer: 2019/11/05 12:45:47 closing
2019/11/05 12:45:47 packer: 2019/11/05 12:45:47 Error in ProgressTrackingClient.Read RPC call: reading body EOF
2019/11/05 12:45:47 packer: 2019/11/05 12:45:47 Error in ProgressTrackingClient.Read RPC call: connection is shut down
2019/11/05 12:45:47 packer: 2019/11/05 12:45:47 [INFO] 884736 bytes written for 'uploadData'
2019/11/05 12:45:47 packer: 2019/11/05 12:45:47 [ERR] 'uploadData' copy error: read files/installs/7z1900-x64.msi: file already closed
2019/11/05 12:45:47 [INFO] (telemetry) ending file
Contributor guide
Assessment
This issue has not been assessed yet.