Logging into the API on Juju 2.0

Adam Stokes adam.stokes at canonical.com
Mon Feb 29 14:48:52 UTC 2016


Is there a way to list all models for a specific controller?

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?

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

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?


On Fri, Feb 26, 2016 at 9:02 PM, Adam Stokes <adam.stokes at canonical.com>
wrote:

> Ok perfect, i'll try these tags out with the api. Thanks again
>
> On Fri, Feb 26, 2016 at 9:01 PM, Ian Booth <ian.booth at canonical.com>
> wrote:
>
>> The admin user tag for aws is the same as described below. The @local
>> suffix
>> pertains to the controller not the cloud - think of it as users for a
>> controller
>> you bootstrap yourself are local to that controller.
>>
>> On 27/02/16 11:29, Adam Stokes wrote:
>> > Thanks that makes sense now. I don't have aws or anything but what would
>> > the admin user tag for those clouds look like?
>> >
>> > On Fri, Feb 26, 2016 at 7:07 PM, Andrew Wilkins <
>> > andrew.wilkins at canonical.com> wrote:
>> >
>> >> On Sat, Feb 27, 2016 at 1:10 AM Adam Stokes <adam.stokes at canonical.com
>> >
>> >> wrote:
>> >>
>> >>> Also, will the API support non admin users to login and query the
>> various
>> >>> modelmanager methods they have access to? If so, will this be
>> available by
>> >>> GA release?
>> >>>
>> >>> On Fri, Feb 26, 2016 at 11:45 AM, Adam Stokes <
>> adam.stokes at canonical.com>
>> >>> wrote:
>> >>>
>> >>>> Currently, the only way to login to the Juju 2.0 api is to use the
>> Tag
>> >>>> of 'user-admin'.
>> >>>>
>> >>>
>> >> You can log in with additional users. With the CLI, you can do:
>> >>   - juju add-user bob
>> >>   - juju change-user-password bob
>> >>   - juju switch-user bob
>> >> (or you could use the "register" command to add another controller
>> entry;
>> >> you'll still end up with the "bob" user)
>> >>
>> >> However, all the files created by juju during bootstrap (accounts.yaml,
>> >>>> models.yaml, controllers.yaml) only mention the admin user as
>> 'admin at local'
>> >>>> for the controller.
>> >>>>
>> >>>
>> >> "admin" is equivalent to "admin at local"; the latter form is canonical.
>> >> What you're passing over the API is a different form altogether: it is
>> a
>> >> "tag". The tag form of a user is: user-<username>[@domain].
>> >>
>> >> So for the "admin at local" user, the tag form is "user-admin at local". You
>> >> can also supply just "user-admin", and the "local" is implied.
>> >>
>> >> When will the API login support logging in as the admin user for the
>> >>>> specified controller?
>> >>>>
>> >>>> An example of the request being passed to the api server:
>> >>>>
>> >>>> {'Type': 'Admin',
>> >>>>  'Version': 3,
>> >>>>  'Request': 'Login',
>> >>>>  'RequestId': 1,
>> >>>>  'Params': {'auth-tag': user,
>> >>>>        'credentials': password}}
>> >>>>
>> >>>> user = 'user-admin' and not 'admin at local' as seen in the yaml
>> configs.
>> >>>>
>> >>>
>> >> That should be working. Please file a bug if it's not, with steps to
>> >> reproduce.
>> >>
>> >> Cheers,
>> >> Andrew
>> >>
>> >
>> >
>> >
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/juju/attachments/20160229/b19fd0ae/attachment.html>


More information about the Juju mailing list