Logging into the API on Juju 2.0
Adam Stokes
adam.stokes at canonical.com
Tue Mar 1 13:48:36 UTC 2016
Went ahead and filed a bug here:
https://bugs.launchpad.net/juju-core/+bug/1551743
On Tue, Mar 1, 2016 at 8:40 AM, Rick Harding <rick.harding at canonical.com>
wrote:
> Thank Adam. That's good feedback. With tabular output the default now we
> should be more verbose on the yaml output and display the uuids and other
> data.
>
> On Tue, Mar 1, 2016, 8:37 AM Adam Stokes <adam.stokes at canonical.com>
> wrote:
>
>> One of the problems using `juju list-controllers --format yaml` versus
>> reading the controllers.yaml file directly is the information is
>> different. Specifically I need the UUID in order to build the URL used
>> when accessing Juju's API.
>>
>> 😀 adam at deadpool:conjure 🌴 juju list-controllers --format yaml
>> controllers:
>> local.conjure:
>> model: conjure
>> user: admin at local
>> server: 10.0.3.130:17070
>> local.conjure-maas:
>> model: conjure-maas
>> user: admin at local
>> server: 172.16.0.152:17070
>> current-controller: local.conjure-maas
>>
>>
>> 😀 adam at deadpool:conjure 🌴 cat ~/.local/share/juju/controllers.yaml
>> controllers:
>> local.conjure:
>> servers: ['10.0.3.130:17070', '127.0.0.1:17070', '[::1]:17070',
>> '[fe80::216:3eff:fe22:c849]:17070']
>> uuid: 0551fce8-0e0d-4fbc-8d53-b67f7a7657c4
>> api-endpoints: ['10.0.3.130:17070', '127.0.0.1:17070',
>> '[::1]:17070', '[fe80::216:3eff:fe22:c849]:17070']
>> ca-cert: |
>> -----BEGIN CERTIFICATE-----
>> -----END CERTIFICATE-----
>> local.conjure-maas:
>> servers: ['172.16.0.152:17070']
>> uuid: ad6f65af-6b45-4293-8891-482635653807
>> api-endpoints: ['172.16.0.152:17070']
>> ca-cert: |
>> -----BEGIN CERTIFICATE-----
>>
>>
>> On Mon, Feb 29, 2016 at 11:56 PM, Ian Booth <ian.booth at canonical.com>
>> wrote:
>>
>>> No, you are right.
>>>
>>> $ juju list-controllers --format yaml
>>>
>>> is better.
>>>
>>> On 01/03/16 14:49, John Meinel wrote:
>>> > Is there a reason to tell people to look at "controllers.yaml" rather
>>> than
>>> > having the official mechanism be something like "juju list-controllers
>>> > --format=yaml" ? I'd really like to avoid tying 3rd party scripts to
>>> our
>>> > on-disk configuration. We can keep CLI compatibility, but on-disk
>>> > structures aren't something we really want to commit to forever.
>>> >
>>> > John
>>> > =:->
>>> >
>>> > On Tue, Mar 1, 2016 at 8:22 AM, Ian Booth <ian.booth at canonical.com>
>>> wrote:
>>> >
>>> >> Just to be clear, the remote APi for listing models for a given
>>> controller
>>> >> exists. But you do need to look at controllers.yaml to see what
>>> >> controllers you
>>> >> have bootstrapped or have access to in order to make the remote list
>>> >> models api
>>> >> call.
>>> >>
>>> >> On 01/03/16 13:14, Adam Stokes wrote:
>>> >>> Got it squared away, being able to replicate `juju list-controllers`
>>> >> didn't
>>> >>> have a remote api. So I will continue to read from
>>> >>> ~/.local/share/juju/controllers.yaml. My intention was to basically
>>> see
>>> >>> what controllers were already bootstrapped and gather the models for
>>> >> those
>>> >>> controllers using the remote juju api. But that doesn't exist so I
>>> will
>>> >>> mimic what `juju list-controllers` does and read from the yaml file
>>> for
>>> >>> controllers that are local to my admin and users.
>>> >>>
>>> >>> On Mon, Feb 29, 2016 at 9:40 PM, Tim Penhey <
>>> tim.penhey at canonical.com>
>>> >>> wrote:
>>> >>>
>>> >>>> It is the controller that you have logged into for the API.
>>> >>>>
>>> >>>> What are you wanting?
>>> >>>>
>>> >>>> You need a different API connection for each controller.
>>> >>>>
>>> >>>> Tim
>>> >>>>
>>> >>>> On 01/03/16 15:05, Adam Stokes wrote:
>>> >>>>> Right, but how do you specify which controller you want to list the
>>> >>>>> models for? The only way I can see is to manually `juju switch
>>> >>>>> <controller>` then re-login to the API and run the AllModels
>>> method. Is
>>> >>>>> there a way (as an administrator) to specify which controller you
>>> want
>>> >>>>> to list the models for?
>>> >>>>>
>>> >>>>> On Mon, Feb 29, 2016 at 8:46 PM, Ian Booth <
>>> ian.booth at canonical.com
>>> >>>>> <mailto:ian.booth at canonical.com>> wrote:
>>> >>>>>
>>> >>>>>
>>> >>>>>
>>> >>>>> On 01/03/16 11:25, Adam Stokes wrote:
>>> >>>>> > On Mon, Feb 29, 2016 at 7:24 PM, Tim Penhey
>>> >>>>> <tim.penhey at canonical.com <mailto:tim.penhey at canonical.com>>
>>> >>>>> > wrote:
>>> >>>>> >
>>> >>>>> >> On 01/03/16 03:48, Adam Stokes wrote:
>>> >>>>> >>> Is there a way to list all models for a specific
>>> controller?
>>> >>>>> >>
>>> >>>>> >> Yes.
>>> >>>>> >
>>> >>>>> >
>>> >>>>> > Mind pointing me to the api docs that has that capability?
>>> >>>>> >
>>> >>>>>
>>> >>>>>
>>> >>>>
>>> https://godoc.org/github.com/juju/juju/api/controller#Client.AllModels
>>> >>>>>
>>> >>>>>
>>> >>>>
>>> >>>>
>>> >>>
>>> >>
>>> >> --
>>> >> Juju mailing list
>>> >> Juju at lists.ubuntu.com
>>> >> Modify settings or unsubscribe at:
>>> >> https://lists.ubuntu.com/mailman/listinfo/juju
>>> >>
>>> >
>>>
>>
>> --
>> Juju mailing list
>> Juju at lists.ubuntu.com
>> Modify settings or unsubscribe at:
>> https://lists.ubuntu.com/mailman/listinfo/juju
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/juju/attachments/20160301/47b6cba3/attachment.html>
More information about the Juju
mailing list