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

Updated Readme for --server-connect-attribute option #388

Merged
merged 4 commits into from
Nov 20, 2015

Conversation

NimishaS
Copy link

w.r.t #379

@adamedx
Copy link

adamedx commented Nov 18, 2015

@btm, can you take a look?

@btm
Copy link
Contributor

btm commented Nov 18, 2015

We're losing the benefit of @ssh_connect_host being an instance variable as written, because we're still stepping through the entire conditional every time ssh_connect_host is called.

If it's not convenient to assign the variable from the output of the conditional like it previously did, you could wrap that in another conditional. I think this looks simpler:

unless @ssh_connect_host
  if config[:server_connect_attribute]
    connect_attribute = config[:server_connect_attribute]
  else
    if vpc_mode? && !(config[:associate_public_ip] || config[:associate_eip])
      connect_attribute = "private_ip_address"
    else
      connect_attribute = server.dns_name ? "dns_name" : "public_ip_address"
    end
  end

  @ssh_connect_host = server.send(connect_attribute)
end

puts "\nSSH Target Address: #{@ssh_connect_host}(#{connect_attribute})"
@ssh_connect_host

end
end
puts
puts "SSH Target Address: #{connect_attribute}(#{@ssh_connect_host})"
Copy link
Contributor

Choose a reason for hiding this comment

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

as in my example in my first comment, I'd combine these two lines, and instead put the thing we're connecting to first with the attribute we used to get that in the parentheses.

@NimishaS
Copy link
Author

@btm, fixed the review comments. Please check.


# Pass --server-connect-attribute if the machine is in VPC mode
# Possible values of --server-connect-attribute: private_dns_name, private_ip_address, public_dns_name, public_ip_address
# If --server-connect-attribute is not specified, then EIP is used as External IP
Copy link
Contributor

Choose a reason for hiding this comment

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

EIP means Elastic IP (which is a public IP). Not all instances have an Elastic IP assigned to them. So this isn't true.

I would say "If --server-connect-attribute is not specified, knife attempts to determine if connecting to the instance's public or private IP is most appropriate based on other settings."

@NimishaS
Copy link
Author

@btm , please verify again

@btm
Copy link
Contributor

btm commented Nov 20, 2015

👍

btm added a commit that referenced this pull request Nov 20, 2015
…ttribute-doc

Updated Readme for --server-connect-attribute option
@btm btm merged commit de3239a into chef:master Nov 20, 2015
@NimishaS NimishaS deleted the nim/server-connect-attribute-doc branch November 23, 2015 05:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants