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

Fix for server-connect-attribute #657

Conversation

kapilchouhan99
Copy link

Signed-off-by: Kapil Chouhan kapil.chouhan@msystechnologies.com

Description

  • Fix for server-connect-attribute
  • Added test cases
  • Ensured chef-style on the code changes made

Related Issue

Fixes: #652

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (non-breaking change that does not add functionality or fix an issue)

Checklist:

  • I have read the CONTRIBUTING document.
  • I have run the pre-merge tests locally and they pass.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • All commits have been signed-off for the Developer Certificate of Origin.

end

context "when server is created" do
it "return connection_host" do
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be "returns the public host name"

end
end

context "when server is created" do
Copy link
Contributor

Choose a reason for hiding this comment

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

when public DNS name is present

@tas50
Copy link
Contributor

tas50 commented Sep 29, 2020

This looks like it breaks some existing functionality. The method should return nil, the private IP, or the public DNS name. We need to ensure that all 3 of those scenarios continue to function and it looks like they don't with this change. If you check the git blame on this method you should be able to track down the PRs that made this change and why they did so.

@kapilchouhan99 kapilchouhan99 force-pushed the Kapil/Github-652_server-connect-attribute_private_ip_address_no_longer_works branch 2 times, most recently from 4ca199c to 4c5c93f Compare October 8, 2020 08:34
Signed-off-by: Kapil Chouhan <kapil.chouhan@msystechnologies.com>
@kapilchouhan99 kapilchouhan99 force-pushed the Kapil/Github-652_server-connect-attribute_private_ip_address_no_longer_works branch from 4c5c93f to 158c114 Compare October 8, 2020 08:54
@kapilchouhan99
Copy link
Author

This looks like it breaks some existing functionality. The method should return nil, the private IP, or the public DNS name. We need to ensure that all 3 of those scenarios continue to function and it looks like they don't with this change. If you check the git blame on this method you should be able to track down the PRs that made this change and why they did so.

Hi @tas50
Earlier this server_name method returns nil, private IP, or the public DNS name, so at that time we are setting the ssh target address according to this https://github.com/chef/knife-ec2/blob/master/lib/chef/knife/ec2_server_create.rb#L1135-L1145

so in this condition, if we set server-connect-attribute private_ip_address or vpc_mode?, then the connection_host method sets SSH target as a private IP address, and the server_name method return the Public DNS name.

So I think, this will fix all 3 of those scenarios. In this fix, we will Connect the same address as SSH Target sets.
Please give me your thoughts on this.

@tas50 tas50 merged commit 149c3fd into master Oct 13, 2020
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.

--server-connect-attribute private_ip_address no longer works
2 participants