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

Setting multiple non-default transport usernames per platform will soon be broken #153

Closed
gmiranda23 opened this issue Jun 5, 2015 · 2 comments

Comments

@gmiranda23
Copy link

In resolving #136, I noticed that transport.username is now the preferred method for setting ssh transport usernames. Setting platform.driver.username appears to be deprecated, but that's currently the only way to set per platform exceptions that don't conform to bundled definitions in amis.json.

Example -- If in .kitchen.yml I set the following values

transport:
  ssh_key: /path/to/.ssh/private-key
  connection_timeout: 10
  connection_retries: 5
  username: ubuntu

platforms:
  - name: ubuntu-15.04
    driver:
      image_id: ami-83211eb3
  - name: centos-7
    driver:
      image_id: ami-c7d092f7
      username: ec2-user
  - name: fedora-22
    driver:
      image_id: ami-c16557f1
      username: fedora

And I run kitchen setup, I get the following errors:

$$$$$$ WARN: The driver[Kitchen::Driver::Ec2] config key `username` is deprecated, please use `transport.username`
$$$$$$ WARN: The driver[Kitchen::Driver::Ec2] config key `username` is deprecated, please use `transport.username`
$$$$$$ WARN: The driver[Kitchen::Driver::Ec2] config key `username` is deprecated, please use `transport.username`

But if platform.driver.username gets deprecated, there is no way to set the fedora username exception since it is 1) not in amis.json, 2) does not match the transport.username, and 3) is not 'root'.

Am I just missing how this is supposed to be correctly handled?

@tyler-ball
Copy link
Contributor

You should be able to specify the following .kitchen.yml:

transport:
  ssh_key: /path/to/.ssh/private-key
  connection_timeout: 10
  connection_retries: 5
  username: ubuntu

platforms:
  - name: ubuntu-15.04
    driver:
      image_id: ami-83211eb3
  - name: centos-7
    driver:
      image_id: ami-c7d092f7
    transport:
      username: ec2-user
  - name: fedora-22
    driver:
      image_id: ami-c16557f1
    transport:
      username: fedora

Can you try that and see if it both gets rid of your warnings and uses the correct username?

@gmiranda23
Copy link
Author

Verified to work. Feedback incorporated into #136

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants