Logging into the API on Juju 2.0
Tim Penhey
tim.penhey at canonical.com
Tue Mar 1 00:24:03 UTC 2016
On 01/03/16 03:48, Adam Stokes wrote:
> Is there a way to list all models for a specific controller?
Yes.
> https://godoc.org/github.com/juju/juju/api/controller
> and https://godoc.org/github.com/juju/juju/api/modelmanager seem to do
> the same thing wrt listing models. This also only does it for whatever
> the current controller is set to before making the api call. I also
> don't see a way to list all active controllers, is there a way to do
> that as well?
There is a subtle difference.
> I also think the API is a bit confusing when it comes to distinguishing
> between a Controller and its Models. There are at least 2 places in the
> api that call out to listing models:
>
> https://github.com/juju/juju/blob/master/api/controller/controller.go#L35
> https://github.com/juju/juju/blob/master/api/modelmanager/modelmanager.go#L78
The ModelManager facade is accessible by all users, and any user can
list environments that they have access to in a controller.
The Controller facade is accessible only by controller admins, those
users that have access to the controller model. This allows admins to
list all models in the controller, not just those they have access to.
Admins are special, and there needs to be a way for them to manage the
controller that may host environments for other people. Also, they
should not be listed as having regular access to environments that
aren't shared with them.
> And there are other areas where you create a model via modelmanager but
> can only gather information about a model via the client, why not just
> put all model related api code under modelmanager?
This is just historical garbage that hasn't been cleaned up yet.
Originally all access to the api server from the CLI was through the
"Client" facade. This rapidly became unwieldy and aspects have been
moved off.
Tim
More information about the Juju
mailing list