OpenStack driver enhancements

* Log machine creation.
* Typo in an error message 💅
* Shelve docker install output in /var/log.
* Improve the docker installation error message. Also, keep it from interrupting the host creation, so that you can actually run `machine ssh` or `machine rm` on the host afterward.

Signed-off-by: Ash Wilson <ash.wilson@rackspace.com>
This commit is contained in:
Ash Wilson 2015-01-05 11:15:45 -05:00 committed by Guillaume Giamarchi
parent bb5cf85a7e
commit e44b840e3a
2 changed files with 16 additions and 5 deletions

View File

@ -59,6 +59,11 @@ func (c *GenericClient) CreateInstance(d *Driver) (string, error) {
},
}
}
log.WithFields(log.Fields{
"Name": d.MachineName,
}).Info("Creating server...")
server, err := servers.Create(c.Compute, keypairs.CreateOptsExt{
serverOpts,
d.KeyPairName,

View File

@ -703,18 +703,24 @@ func (d *Driver) installDocker() error {
if err := d.sshExec([]string{
`apt-get install -y curl`,
`curl -sSL https://get.docker.com | /bin/sh`,
`curl -sSL https://get.docker.com | /bin/sh >/var/log/docker-install.log 2>&1`,
`service docker stop`,
`curl -sSL https://ehazlett.s3.amazonaws.com/public/docker/linux/docker-1.4.1-136b351e-identity -o /usr/bin/docker`,
`echo "export DOCKER_OPTS=\"--auth=identity --host=tcp://0.0.0.0:2376\"" >> /etc/default/docker`,
`service docker start`,
}); err != nil {
log.Error("Docker installation failed")
log.Error("The docker installation failed.")
log.Error(
"The driver assume your instance is running Ubuntu. If this is no the case, you should use the ",
"option --openstack-docker-install=false when creating the machine and then install manually",
"The driver assumes that your instance is running Ubuntu. If this is not the case, you should ",
"use the option --openstack-docker-install=false (or --{provider}-docker-install=false) when ",
"creating a machine, and then install and configure docker manually.",
)
return err
log.Error(
`Also, you can use "machine ssh" to manually configure docker on this host.`,
)
// Don't return this ssh error so that host creation succeeds and "machine ssh" and "machine rm"
// are usable.
}
return nil
}