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

Fixes lp#1840205: show default region from client store. #10533

Merged
merged 2 commits into from Aug 20, 2019

Conversation

anastasiamac
Copy link
Contributor

Description of change

By default, Juju will pick the first region for the clouds that have more than one region. Users can change that to suit their needs and preferences using 'juju default-region' command. This will be the region used by all commands - bootstrap, add-model, credential validations, etc - that care about region if the user does not explicitly specify a region using a --region option at CLI.

Whilst Juju was mostly correctly using the default region when user set it, Juju was not correctly reporting it in 'juju clouds', 'juju show-cloud', etc.

This PR fixes this.

As a drive-by some renamed some variables in tests that were colliding with imported packages names.

QA steps

  1. set default region
  2. make sure it is shown correctly where needed

Bug reference

https://bugs.launchpad.net/juju/+bug/1840205

@anastasiamac
Copy link
Contributor Author

@anastasiamac
Copy link
Contributor Author

!!build!!

@@ -595,6 +595,10 @@ func (c *AddCAASCommand) validateCloudRegion(ctx *cmd.Context, cloudRegion strin
}
return details.CloudType, nil
}
if region == "" && details.DefaultRegion != "" {
Copy link
Member

Choose a reason for hiding this comment

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

For safety we should still check that details.DefaultRegion is in the details.RegionsMap
ie if region is "", set it to default region can continue as before

@anastasiamac
Copy link
Contributor Author

$$merge$$

@jujubot jujubot merged commit 6d5e31a into juju:develop Aug 20, 2019
@anastasiamac anastasiamac deleted the default-region-lp1840205 branch August 20, 2019 01:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants