From 8276face94207cbbb6a803a3be38a36f46e3a9f6 Mon Sep 17 00:00:00 2001 From: Michael Gregson Date: Mon, 30 Sep 2013 19:22:07 -0600 Subject: [PATCH] [digital_ocean] Don't die when the id parameter is missing It's okay for this to happen now, because we might move on to the name parameter if unique_name is enabled. --- library/cloud/digital_ocean | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/library/cloud/digital_ocean b/library/cloud/digital_ocean index cd485aedf91..e5d24608fa7 100644 --- a/library/cloud/digital_ocean +++ b/library/cloud/digital_ocean @@ -328,13 +328,15 @@ def core(module): elif state in ('absent', 'deleted'): # First, try to find a droplet by id. - droplet = Droplet.find(id=getkeyordie('id')) + droplet = None + if 'id' in module.params: + droplet = Droplet.find(id=module.params['id']) # If we couldn't find the droplet and the user is allowing unique # hostnames, then check to see if a droplet with the specified # hostname already exists. - if not droplet and module.params['unique_name']: - droplet = Droplet.find(name=getkeyordie('name')) + if not droplet and module.params['unique_name'] and 'name' in module.params: + droplet = Droplet.find(name=module.params['name']) if not droplet: module.exit_json(changed=False, msg='The droplet is not found.')