-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
provider/digitalocean: Fixing panic condition on FloatingIP droplet #4214
Conversation
LGTM. Thanks @stack72! |
provider/digitalocean: Fixing panic condition on FloatingIP droplet
if floatingIp.Droplet != nil { | ||
log.Printf("[INFO] The region of the Droplet is %s", floatingIp.Droplet.Region) | ||
d.Set("region", floatingIp.Droplet.Region.Slug) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, this skips setting the region at all if the floating IP exits but the droplet doesn't. It seems like we could fall back to the below else case, but not sure what the ramifications are.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 good point, we should probably check this explicitly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@franklinhu the current tests for this are for both region based floatingips and floatingips with droplets. A floatingIP must either be created for a region OR a droplet. So if we fall back to the region then that seems to be the correct course of action
I haven't been able to trigger the panic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@franklinhu ok, I just sent #4216. To be more explicit. I don't rely on the d.GetOk anymore. I use the API result directly and then check for a droplet and use the region that way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah awesome thanks!
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Fixes #4162
Fixing the digitalocean floatingip resource for a panic when droplet wasn't available