hashicorp / hashicorp/packer

File provisioner silently fails to upload file unless -debug flag is used

Open
#12,481 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
15.8k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

#### Community Note

* Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request
* Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
* If you are interested in working on this issue or have submitted a pull request, please leave a comment

When filing a bug, please include the following headings if possible. Any
example text in this template can be deleted.

#### Overview of the Issue

[This is my packerfile and cloud-config](https://gist.github.com/v1nsai/b454894fc4d443e369248f94ed8e4056)
Running this without debug results in silent failure of the file provisioner to upload the files correctly. This also prevents the `write_files` module of `cloudinit` from running.

Changing nothing other than adding the `-debug` flag causes file provisioner and cloudinit files to be written correctly.

#### Reproduction Steps
Running the above files using `packer build .` results in files either not being written to the disk image or blank files get written. Running `packer -debug build .` on the same directory and code results in both the file provisioner file and cloud-init file being written correctly.

### Packer version

From Packer v1.9.1

### Simplified Packer Template

[Link to gist containing packerfile + cloud-config files](https://gist.github.com/v1nsai/b454894fc4d443e369248f94ed8e4056)

### Operating system and Environment details

MacOS 13.3.1 MacBook Air 2020 Apple M1 CPU, 8GB RAM

### Log Fragments and crash.log files

No obvious errors, but this line looks strange. There's a nonzero stderr reported by SCP but no error info and build finishes successfully. Possibly relevant?

`2023/06/24 19:19:22 packer-plugin-qemu_v1.0.9_x5.0_darwin_arm64 plugin: 2023/06/24 19:19:22 [DEBUG] scp stderr (length 79): Sink: C0644 3829 provisioner-install.sh`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.