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

Fixing error where aws returns DNS name as empty string #124

Merged
merged 2 commits into from
May 21, 2015

Conversation

tyler-ball
Copy link
Contributor

@tyler-ball tyler-ball added the Bug label May 20, 2015
@tyler-ball tyler-ball mentioned this pull request May 20, 2015
@tyler-ball
Copy link
Contributor Author

It looks like I also broke backwards compatibility when I removed the interface config - adding back in this PR as well!

@@ -354,6 +361,8 @@ def hostname(server, interface_type = nil)
potential_hostname = nil
INTERFACE_TYPES.values.each do |type|
potential_hostname ||= server.send(type)
# AWS returns an empty string if the dns name isn't populated yet

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not default to private_ip unless specified?

It seems like it would be the most likely to be available, followed by public_ip and then DNS. Looks like there could be reduced complexity unless there is something I am missing.

What is the behavior of not defining the hostname? (returning nil)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

private_ip is the most likely to be available but not the most likely to be reachable by SSH. The logic here is currently

# if `interface_type` is provided:
  # query only that interface_type
# else
  # first, try dns
  # second, try public_ip
  # third, try private_ip
  # return the first value that is non-nil and non-empty

This brings the hostname logic in line with what is in the README. I don't want to break the backwards compatibility with logic that has been there for a while.

I also like the 'try from easiest to SSH into to hardest to SSH into' logic rather than 'try from what is most likely to be available to what is least likely to be available'. The goal is to get a hostname we can SSH into and then install Chef. If a user really wants to use private_ip they can specify interface: private in their .kitchen.yml.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 I was thinking of this soley from inside a VPC, good call. Little short-sighted on my part.

@tyler-ball tyler-ball self-assigned this May 21, 2015
@fnichol
Copy link
Contributor

fnichol commented May 21, 2015

LGTM, 👍

tyler-ball added a commit that referenced this pull request May 21, 2015
Fixing error where aws returns DNS name as empty string
@tyler-ball tyler-ball merged commit 012a934 into master May 21, 2015
@tyler-ball tyler-ball deleted the tball/errors branch May 21, 2015 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

hostname missing when waiting for ssh service in create action
4 participants