juju api and authenticated request

Adam Stokes adam.stokes at ubuntu.com
Fri Feb 7 03:12:51 UTC 2014


Also for reference I have this paste that shows the debugging
information from the connection attempt

http://paste.ubuntu.com/6889001/

On Thu, Feb 6, 2014 at 10:09 PM, Adam Stokes <adam.stokes at ubuntu.com> wrote:
> I read through the docs/api.txt to try and get an understanding of how
> to connect to juju's api server and what I've come up with so far is
> the following:
>
> #!/usr/bin/env perl
>
> use Mojo::UserAgent;
> use 5.14.0;
> use DDP;
>
> my $ua = Mojo::UserAgent->new;
>
> $ua->websocket('wss://192.168.122.16:17070' => json =>
> {
> 'RequestId' => 1,
> 'Type' => 'Admin',
> 'Request' => 'Login',
> 'Params' => {'Tag' => 'machine-0',
>     'Password' => 'f0d44f279b47cc8b5f7ea291f5e3b30a',
>     'Nonce' => 'fake_nonce'}
> } => sub {
> my ($ua, $tx) = @_;
> say "failed ".$tx->error;
> p $tx->req;
> p $tx->res;
>     }
> );
> Mojo::IOLoop->start unless Mojo::IOLoop->is_running;
>
> This is very early stages and the code doesn't work as it returns a
> 403. My question is am I on the right track for accessing the
> apiserver over a websocket connection? Should I be passing the params
> as json? The port, and params used are obtained through
> ~/.juju/environments/local.jenv after a `juju bootstrap`. Should I be
> passing the certs through as well? I went through some of the test
> cases and attempted to decipher how that worked but now I'm a bit
> stuck as to where to go next. The errors returned so far have just
> been 403 forbidden.
>
> Also, is this even the right place I should be for messing around with
> RPC and juju? :)
>
> Thanks!
>
>
> --
> [ Adam Stokes ]



-- 
[ Adam Stokes ]



More information about the Juju mailing list