Skip to content

Commit

Permalink
Merge pull request #9727 from achilleasa/fix-1814638
Browse files Browse the repository at this point in the history
#9727

## Description of change

Make the error message when attempting to bootstrap without credentials a bit more helpful for the end-user

## QA steps

```console
$ juju bootstrap joyent
ERROR detecting credentials for "joyent" cloud provider: credentials not found
See `juju add-credential joyent --help` for instructions
```

## Bug reference
https://bugs.launchpad.net/juju/+bug/1814638
  • Loading branch information
jujubot committed Feb 8, 2019
2 parents ed563bd + fb35b6c commit c500fe5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions cmd/juju/commands/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,10 @@ func (c *bootstrapCommand) Run(ctx *cmd.Context) (resultErr error) {

credentials, regionName, err := c.credentialsAndRegionName(ctx, provider, cloud)
if err != nil {
if errors.IsNotFound(err) {
err = errors.NewNotFound(nil, fmt.Sprintf("%v\nSee `juju add-credential %s --help` for instructions", err, cloud.Name))
}

if err == cmd.ErrSilent {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/juju/commands/bootstrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1458,7 +1458,7 @@ func (s *BootstrapSuite) TestBootstrapCloudNoRegionsOneSpecified(c *gc.C) {
func (s *BootstrapSuite) TestBootstrapProviderNoCredentials(c *gc.C) {
s.patchVersionAndSeries(c, "raring")
_, err := cmdtesting.RunCommand(c, s.newBootstrapCommand(), "no-credentials", "ctrl")
c.Assert(err, gc.ErrorMatches, `detecting credentials for "no-credentials" cloud provider: credentials not found`)
c.Assert(err, gc.ErrorMatches, "detecting credentials for \"no-credentials\" cloud provider: credentials not found\nSee `juju add-credential no-credentials --help` for instructions")
}

func (s *BootstrapSuite) TestBootstrapProviderManyDetectedCredentials(c *gc.C) {
Expand Down

0 comments on commit c500fe5

Please sign in to comment.