-
Committer:
Tarmac
-
Author(s):
John Arbash Meinel
-
Date:
2013-08-26 11:48:40 UTC
-
mfrom:
(1705.2.8 cli-api-add-unit)
-
Revision ID:
tarmac-20130826114840-lb6v9wz755kiz6gz
[r=jameinel] cmd/juju/addunit.go: use the API for juju add-unit
Anyway, the change is actually quite simple, instead of
juju.NewConnFromName use juju.NewAPIConnFromName and use the
APIConn.Client() object to actually do the requests. And then since state/statecmd/addunit.go is only called by the apiserver/client.go code, we can just move the functionality over there.
Ultimately, we'll also want to pull out the Conn.AddUnit into that code, but that is a future step.
I've tested this integration with a 1.13.2 environment, and everything
works great. I also manually inspected 1.12 to ensure that the params
object already supported ToMachineSpec (it did).
With --debug I can see that it really is connecting to the API and not
to the MongoDB directly (it talks about connecting to wss://... rather
than ...:37017).
Also, it is actually *faster* to run than previously. I'm guessing it is
because we don't need the Presence code to trigger a sync of all the
existing nodes. When we start caching the API server addresses, this can
actually become quite fast (the current slowest part is still grabbing
the provider-state file and looking up the DNS name).
https://codereview.appspot.com/13212043/