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

RFC: add -connection-info flag to build command #5107

Open
rickard-von-essen opened this issue Jul 7, 2017 · 18 comments
Open

RFC: add -connection-info flag to build command #5107

rickard-von-essen opened this issue Jul 7, 2017 · 18 comments
Labels
core Core components of Packer enhancement pr/needs-review stage/thinking Flagged for internal discussions about possible enhancements

Comments

@rickard-von-essen
Copy link
Collaborator

We could add a new flag to the build command, say -connection-info
which prints out connection details, passwords, and private keys, etc in the same way as debug does but without the confirmation of each step and disabling of parallelism. -debug would implicitly enable this.

The code changes would be very easy.

Closes #3885

@rickard-von-essen rickard-von-essen added core Core components of Packer enhancement pr/needs-review stage/thinking Flagged for internal discussions about possible enhancements labels Jul 7, 2017
@mooperd
Copy link

mooperd commented Jul 11, 2017

+1

@pmkane
Copy link

pmkane commented Aug 25, 2017

+1. This would compliment -on-error=abort/ask nicely, since without the ephemeral ssh key used for remote builds, you're stuck trying to debug without other workarounds.

@lmayorga1980
Copy link
Contributor

👍

@rickard-von-essen
Copy link
Collaborator Author

Going to start working on this now..

@justinmetz
Copy link

Hi, are there any updates on this feature? Sorry if I sound impatient, but I'm really looking forward to it.. :)

@rickard-von-essen
Copy link
Collaborator Author

Got a bit derailed, but I'm on it again. Hopefully I can publish a initial version that can be tested on some builders tomorrow.

@rickard-von-essen
Copy link
Collaborator Author

@justinmetz I dumped a initial WIP version which works with the amazon-ebs builder, if you want to test it out and give me feedback it would be awesome. If you want support for another builder I can hopefully fix that really quickly.

@suntong
Copy link

suntong commented Apr 30, 2020

I saw that "WIP: Basic support for -connection-info flag #6863" has been closed. So is the -connection-info flag feature merged yet?

Not yet in Packer v1.5.5, right?

@SwampDragons
Copy link
Contributor

I closed it because it had been an open WIP PR for a year with no further work. It's not merged, but much of the connection info can now be printed using the build template engine.

@testworksau
Copy link
Contributor

I think there's still a need to be able to show the connection details (eg. password) prior to getting to the point of being able to use the build template engine.

Let's consider the scenario when we need to debug winrm communicator failures in the amazon-ebs builder. We need access to the password in order to be able to connect to the machine, but as I understand the password is only output using the -debug flag.

The -debug flag cannot be used in an automated build / ci system as it will pause before it attempts to run the user_data_file.

I thought PACKER_LOG=1 would display the password, but it doesn't.

@kmaehashi
Copy link

Are there any updates on this? Currently, I'm using packer build -debug -machine-readable as a workaround to get connection info without pause at each step but would love to have human readable outputs.

@Glyphack
Copy link

The following page might be helpful to get connection info.
https://developer.hashicorp.com/packer/docs/templates/hcl_templates/contextual-variables

@suntong
Copy link

suntong commented Mar 14, 2023

Anything specific?

I took a quick look and only found this:

Build variables will allow you to access connection information and basic instance state information for a builder.

while the OP asked for "prints out connection details, passwords, and private keys, etc"

@Glyphack
Copy link

Yeah I'm not proposing this as a solution but as a work around to echo the SSHPrivateKey as part of provisioning.

@takeda
Copy link

takeda commented May 10, 2023

I'm reading these tickets, and I see huge discussions about this, but all people were asking is to have same exact behavior as -debug, without unnecessary pauses, that means:

  • save the SSH key in current directory
  • don't ask to press enter on every little thing packer is doing
  • when an error is encountered remind the user the instance's IP and location of the key and wait for pressing enter
  • at this time user can ssh and inspect what happened
  • after enter is pressed the cleanup begins without asking to confirm every little thing

That's it.

All the -on-error and -connection-info are unnecessary. This could all be implemented in extending -debug parameter to provide extra options:

-debug=sane - do what people really want
-debug=please-waste-my-time - do the original behavior

@suntong
Copy link

suntong commented May 10, 2023

all people were asking is to have same exact behavior as -debug, without unnecessary pauses

right on!!

@testworksau
Copy link
Contributor

-debug=sane - do what people really want
-debug=please-waste-my-time - do the original behavior

😂

@JrInfra
Copy link

JrInfra commented Aug 16, 2023

Hello, is there any update on this? Was thinking this would be nice to have whilst debugging builds without having to constantly press enter.

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 pr/needs-review stage/thinking Flagged for internal discussions about possible enhancements
Projects
None yet
Development

Successfully merging a pull request may close this issue.