bfirsh/docker — pull request #10 by smashwilson (2014-10-24 14:39:38+00:00)
Title: [wip] Rackspace host management

This implements a Rackspace driver for the `docker hosts` command. Here's a usage example:

```
smash@winter ~/code/docker (rackspace-host-management=) $ ./bundles/1.3.0-dev/binary/docker-1.3.0-dev hosts create \
> --driver="rackspace" \
> --rackspace-username="${RS_USERNAME}" \
> --rackspace-api-key="${RS_APIKEY}" \
> --rackspace-region="IAD" \
> --rackspace-image="749dc22a-9563-4628-b0d1-f84ced8c7b7a" \
> --rackspace-flavor="performance1-1" \
> updog
[2014-10-24T10:28:12.209877898-04:00] [info] Creating Rackspace server...
Generating public/private rsa key pair.
Your identification has been saved in /home/smash/.docker/hosts/updog/id_rsa.
Your public key has been saved in /home/smash/.docker/hosts/updog/id_rsa.pub.
The key fingerprint is:
91:0d:7b:79:ab:22:81:c5:7a:da:78:9d:cd:6b:bf:71 smash@winter
The key's randomart image is:
+--[ RSA 2048]----+
| . |
| . = . |
| o + + . |
| + o . . |
| o o S . |
| = o + . |
| o + + + . E |
| . . ... o |
| ...o. |
+-----------------+
[2014-10-24T10:29:02.503796214-04:00] [info] "updog" has been created and is now the active host. Docker commands will now run against that host.
smash@winter ~/code/docker (rackspace-host-management=) $
```

This gets the job done, but there are a few UX issues that I'd like to iron out if we have time. Specifically:

- [ ] Search images and flavors by name, not just ID. When invalid, list the possibilities.
- [ ] Allow customization of the server name.
- [ ] Support images that aren't CoreOS. Maybe do some heuristics with the image name to see if it's Debian-based, Redhat-based, or what have you and dispatch to a different set of shell commands for setup. The admin username varies based on image too: CoreOS uses "core", but most of the others use "root".
- [ ] Vendor our proper, tagged Gophercloud launch, with fixes for a few issues that I found while testing this.
- [ ] Show *all* missing required flags at once when multiple flags are missing.

Also, Gophercloud is a pretty huge thing to vendor, which makes this PR a bit awkward. If you'd prefer I could separate the vendoring to its own PR and re-submit one that only includes the hosts-driver work to be more legible.

/cc @nelsnelson, @jnoller