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: get private ip with retry #100

Merged

Conversation

alexyueer
Copy link
Contributor

Support to get private ip of instance with retry.

@alexyueer alexyueer requested a review from a team as a code owner December 29, 2022 14:12
@alexyueer
Copy link
Contributor Author

@azr @nywilken Could I trouble you to review this PR?

Copy link
Contributor

@lbajolet-hashicorp lbajolet-hashicorp left a comment

Choose a reason for hiding this comment

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

Hi @alexyueer,

Sorry for the delay, taking a look at your PR now.

The code overall looks fine, I've left two comments, one that is more a curiosity question than anything, and another that concerns state.

I'd like to hear your input on the state one especially, since this may change the behaviour for clients that define associate_public_ip_address, unless I'm mistaken in this case the ipaddress will not be set, and this may have some altering effects on the following steps.

Other than this, LGTM, thanks for the contribution!

@@ -13,7 +13,8 @@
"ssh_username":"root",
"instance_type":"ecs.n1.tiny",
"internet_charge_type":"PayByTraffic",
"io_optimized":"true"
"io_optimized":"true",
"associate_public_ip_address":"true"
Copy link
Contributor

Choose a reason for hiding this comment

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

Out of curiosity since the code modifies the private IP address path, why do we change this in the basic example?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Basic example not set associate_public_ip_address or ssh_private_ip, it not work since this PR:https://github.com/hashicorp/packer-plugin-alicloud/pull/52/commits

return WaitForExpectToRetry
}
ipaddress = ipAddresses[0]
state.Put("ipaddress", ipaddress)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should stay in its previous position, otherwise only the private IP will be set in state, and not the public one if that's what is chosen.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the comment, you are right.

Copy link
Contributor

@lbajolet-hashicorp lbajolet-hashicorp left a comment

Choose a reason for hiding this comment

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

With the latest reroll, the code looks good to me, thanks @alexyueer!

Merging this

@lbajolet-hashicorp lbajolet-hashicorp merged commit 78ab4cb into hashicorp:main Jan 13, 2023
@nywilken nywilken added the bug label Jan 19, 2023
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.

3 participants