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(allmodels): JIMM does not need to support AllModels #1496

Open
wants to merge 16 commits into
base: v3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions internal/jujuapi/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,11 @@ func (r *controllerRoot) WatchAllModelSummaries(ctx context.Context) (jujuparams
}, nil
}

// AllModels implments the AllModels command on the Controller facade.
// AllModels is used for list-controllers, show-controller, kill-controller and destroy-controller,
// we currently do not support this via JIMM. If in the future we do, this method will need implementing.
func (r *controllerRoot) AllModels(ctx context.Context) (jujuparams.UserModelList, error) {
return r.allModels(ctx)
const op = errors.Op("jujuapi.AllModels")
return jujuparams.UserModelList{}, errors.E(op, errors.CodeNotSupported)
}

// allModels returns all the models the logged in user has access to.
Expand Down
21 changes: 4 additions & 17 deletions internal/jujuapi/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,25 +76,12 @@ func (s *controllerSuite) TestMongoVersion(c *gc.C) {
}

func (s *controllerSuite) TestAllModels(c *gc.C) {
conn := s.open(c, nil, "bob")
conn := s.open(c, nil, "alice")
defer conn.Close()
client := controllerapi.NewClient(conn)

models, err := client.AllModels()
c.Assert(err, gc.Equals, nil)
c.Assert(models, jc.SameContents, []base.UserModel{{
Name: "model-1",
UUID: s.Model.UUID.String,
Owner: "[email protected]",
LastConnection: nil,
Type: "iaas",
}, {
Name: "model-3",
UUID: s.Model3.UUID.String,
Owner: "[email protected]",
LastConnection: nil,
Type: "iaas",
}})
_, err := client.AllModels()
c.Assert(err, gc.ErrorMatches, `not supported \(not supported\)`)
c.Assert(jujuparams.IsCodeNotSupported(err), gc.Equals, true)
}

func (s *controllerSuite) TestModelStatus(c *gc.C) {
Expand Down
Loading