Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provisioner log message display method is confusing because it seems like an error message #7947

Closed
ghost opened this issue Aug 5, 2019 · 2 comments
Labels
core Core components of Packer enhancement question

Comments

@ghost
Copy link

ghost commented Aug 5, 2019

Packer version: 1.4.2

Although it's a small, minor problem, I often feel uncomfortable because I use Packer frequently so I register an issue here as a feature request.

As shown in the attached screenshot, the output of the scripts registered in Provision step is displayed in red. It is difficult to distinguish it from real errors, because all the text is displayed in red like an error message, even if it is not an error.

image

Is it possible to make appropriate improvements?

@SwampDragons
Copy link
Contributor

I believe it's shown in red because it's coming through the stderr pipe, but I'll have to take a closer look to be sure.

@SwampDragons SwampDragons added core Core components of Packer enhancement question labels Aug 12, 2019
@SwampDragons
Copy link
Contributor

Yep, verified that this is happening because calling set -x inside your bash script streams the executed commands to stderr, not stdout. Packer makes red all the output received through the stderr pipe. You can redirect your script's stderr to stdout to fix this using the execute_command option in the shell-local provisioner:

"execute_command": ["/bin/sh", "-c", "{{.Vars}} {{.Script}} 2>&1"],

But be warned that'll pipe "real" errors to stdout as well, so you won't get red even when you're expecting it.

Or, you could remove the set -x from the script you're running.

I don't consider the current behavior a bug, so I'm going to close, but I hope the provided workaround makes you less anxious :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core components of Packer enhancement question
Projects
None yet
Development

No branches or pull requests

1 participant