Waiting for a job to complete is split into a dedicated function,
outside of `waitForVM()`. Functions only waiting for the job to complete
will use this new function instead. The "job is done" testing logic is
also casted into a separate function.
The original `waitForVM()` function is now waiting for the job to
complete, then retrieve the VM. This introduces an extra API call which
could be avoided by having a `waitForJob()` return the last response but
this makes the code simpler for other users and adding a special variant
just for that seems to be overkill.
Signed-off-by: Vincent Bernat <Vincent.Bernat@exoscale.ch>
Instead of using a custom loop, use the newly introduced
`utils.WaitForSpecificOrError` function. Beware that on success, we use
the successful response to get the VM object (outside the loop).
Signed-off-by: Vincent Bernat <Vincent.Bernat@exoscale.ch>
Otherwise, the timeout is reached far too soon: instead of waiting for
the VM for two minutes, we wait only for a couple of seconds.
Signed-off-by: Vincent Bernat <Vincent.Bernat@exoscale.ch>
Otherwise, when recreating a machine with the same name, we would get an
error about this SSH keypair already existing.
To avoid any confusion, let's say that machine will handle all keypairs
and the user cannot provide its own. Therefore, move the keypairs into
their own "namespace" and remove the option to specify a keypair.
Signed-off-by: Vincent Bernat <Vincent.Bernat@exoscale.ch>
Add support for exoscale, a Swiss cloud provider. This pull "egoscale",
a Go binding for exoscale, in godeps.
Signed-off-by: Vincent Bernat <Vincent.Bernat@exoscale.ch>