fix ssh retcode evaluation when no script is used
iaas: do not output API result when creating a VM in the background

`gandi vm create --background ...` pretty-prints the result of the
`hosting.vm.create_from` API call, which is a list of operations.
This is confusing to the user (it looks like the CLI is just spitting
a bunch of debugging output). I propose to display an informative
message instead. This makes the CLI nicer to use in automation
scripts.
add output grabbing execute

This is usefull here to rewrite the keyscan method
refactor keyscan and ssh, add retry on failures

Try to workaround ssh restarting during vm creation.
This should help the initscript upload/keyscan fail less often.

Improve this part until --script is uploaded to Gandi for a swapdisk
bootstrap.
Merge pull request #58 from jpetazzo/do-not-print-api-result-in-background-mode

iaas: do not output API result when creating a VM in the background
replace check_call with Popen().communicate()

This avoid breaking CLI compat with python < 2.7
iaas: remove possible duplicates when passing multiples resources

this will avoid raising errors when an operation has already been sent
for a resource

Signed-off-by: William Dauchy <william@gandi.net>
iaas: fix hostname-to-id mapping when there are more than 100 VMs
Merge pull request #59 from kalou/ssh-fixes

Various ssh fixes
disk: remove unexisting local variable 'resource'

this fixes a bug introduced in commit:
fb62cdc iaas: remove possible duplicates when passing multiples resources

Signed-off-by: William Dauchy <william@gandi.net>
base: fix error message for step unknown

when getting error unknown, it's not necessary a creation operation
this patch proposes to improve the output

Signed-off-by: William Dauchy <william@gandi.net>
disk: fixing typo while attaching a disk

Signed-off-by: William Dauchy <william@gandi.net>
Try to interpret domain as a numeric id first

If the supplied id is a number, do not make a costly remote API call
to list all domains; use the number as is.
Use filter option when resolving domain id from FQDN

When we look for a specific FQDN, specify it as a search filter,
instead of getting all the domains in the account and iterating
over them. This makes a huge difference for accounts with many
domains.
disk: use disk_type argument when creating a disk

this does not seem to be necessary for creating a regular disk
but will be used for snapshot creation

Signed-off-by: William Dauchy <william@gandi.net>
disk: enhance help for disk creation

name is autogenerated if not provided
this make the help more accurate compared to vm creation

Signed-off-by: William Dauchy <william@gandi.net>
disk: add snapshot command

this permits to create snapshots on the fly

Signed-off-by: William Dauchy <william@gandi.net>
Merge pull request #57 from jpetazzo/fix-hostname-to-id-vm-mapping

iaas: fix hostname-to-id mapping when there are more than 100 VMs
Merge pull request #60 from jpetazzo/try-domain-numeric-id-first

Improve domain-to-id lookup code
Fixes vm post creation bug

Introduced with pull request c8532d8020d9fc57a8bf30431a10b199f1d7fe9b
We must cast api parameter to string otherwise it fails and exit process.