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

Fixup region label for GPC #93

Closed
wants to merge 1 commit into from
Closed

Conversation

paulajulve
Copy link
Contributor

GCP was returning a trailing -. Fixing up the trim to get the region from the zone depending on each provider.

Tried it locally with AWS and GCP on dev and seems to be returning the expected results now.

Comment on lines +294 to +299
switch p.Name() {
case providerAWS :
return z[:len(z)-1]
case providerGCP:
return z[:len(z)-2]
default:
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 warrants adding some tests to ensure a regression isn't introduced and some comments with maybe an example so its' clear.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nevermind, it's already legacy, jjo sneaked this one in yesterday 🤣 lemme give it another spin

@paulajulve paulajulve marked this pull request as draft April 11, 2024 13:53
Comment on lines +295 to +298
case providerAWS :
return z[:len(z)-1]
case providerGCP:
return z[:len(z)-2]
Copy link
Collaborator

Choose a reason for hiding this comment

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

In #93 @jjo introduced a change that allow the user to change the provider name. This would break this switch and the if in line 269. I'd recommend instead doing the following:

Suggested change
case providerAWS :
return z[:len(z)-1]
case providerGCP:
return z[:len(z)-2]
case aws.ProviderName:
return z[:len(z)-1]
case gcp.ProviderName:
return z[:len(z)-2]

Note that by doing this and changing the if in 269 accordingly, you can get rid of the new constants in line 15.

@inkel
Copy link
Collaborator

inkel commented Apr 11, 2024

@paulajulve I believe @jjo did the same in #94, you might want to coordinate with him.

@paulajulve
Copy link
Contributor Author

Yup, closing in favour of that one.

@paulajulve paulajulve closed this Apr 11, 2024
@paulajulve paulajulve deleted the paula/fixup-region-for-gpc branch April 11, 2024 15:39
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.

3 participants