Packer: comm/ssh: Deduplicate `ssh.go`

Created on 28 May 2017  ·  7Comments  ·  Source: hashicorp/packer

Currently every builder have their own ssh.go implementation that setups the configuration.

They have been organically morphed into different shapes but should really do the same thing except for minor configuration setup that are platform (builder) dependent.

Currently there is a bit of a mess of which builders care about:

  • ssh_agent_auth
  • ssh_password
  • ssh_private_key_file
  • etc

By moving this code into shared code all builders will behave in the same way. This will require some way for the builder to pass builder specific config such as set the SSH private key, IP address, etc.

bug communicatossh thinking

All 7 comments

Oh this would be great, and I'd be happy to help, but not sure where to start actually :)

@beddari extract one ssh.go from say amazon and use it there and say with virtualbox. The tricky part is to decide on the interface to pass customisations such as how to find the IP etc and to verify that it works.

it's unfortunate that we rely on the state bag so much for this, it makes creating an interface a little difficult. It's also somewhat complex because we need to delay computation of the step parameters until after we've processed the prior steps (hence why we pass functions around).

I would love to see this tidied up a bit so we don't have to duplicate everything for every builder, but it'll take a little bit of thought to decide on the interface, as rickard says.

Currently every builder have their own ssh.go implementation that setups the configuration

👍 And it leads to error, that DigitalOcean doesn't support ssh_private_key_file, although in the docs stated "In addition to the options listed here, a communicator can be configured for this builder.".

@develar exactly! Feel free to open a feature request for that specifically.

Hello there, I'm working on this a bit 🙂

I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mushon4 picture mushon4  ·  3Comments

DanielBo picture DanielBo  ·  3Comments

znerd picture znerd  ·  3Comments

Tensho picture Tensho  ·  3Comments

wduncanfraser picture wduncanfraser  ·  3Comments