~rogpeppe/juju-core/559-fix-err-deepequals

Viewing all changes in revision 2647.

[r=jameinel],[bug=1268470] cmd/juju/endpoint: return cached api-endpoints

We already do all the work of caching the information, just return it
rather than looking things up in the provider again. The main win here
is that "juju api-endpoints" no longer needs provider credentials.

There are 2 other bits changing which I'm happy to revert if we feel we
don't want to change it at this time.

 1. Our code for caching the first time *only* caches the value that we
 found by looking up the APIInfo in the provider. However, since we just
 connected to the API we can just use that information. I kept the old
 code for backwards compatibility with servers that didn't return
 HostPorts. Though that might not be 1.18, in which case we *could* rip
 out all that logic.

 2. 'juju api-endpoints' used to always lookup the information from the
 provider. Now it defaults to just spitting out what was cached, though
 you can supply --refresh to make it connect first.

 Time wise:
 3.396s juju-1.18.1 api-endpoints
 1.363s juju-proposed api-endpoints --refresh
 0.140s juju-proposed api-endpoints

I went ahead and left it with no refresh by default, because we honestly
don't think these things are going to be changing much. But I could live
with always connecting, and it would simplify the code slightly. (Takes
out approximately 1 if() clause and the commandline parameter.)

https://codereview.appspot.com/88410043/

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: