From ff223ee14cdf9ec59f33beadbaf24ca88b421762 Mon Sep 17 00:00:00 2001 From: Andrei Lukovenko Date: Mon, 11 Jul 2016 01:26:31 +0200 Subject: [PATCH] Bug: invocation with state=absent always leads to (#3051) [localhost]: FAILED! => {"changed": false, "failed": true, "msg": "'Domain' object has no attribute 'id'"} How to reproduce: - name: create domain digital_ocean_domain: state=present name=DOMAIN_NAME ip=DROPLET_IP - name: destroy domain digital_ocean_domain: state=absent name=DOMAIN_NAME Problem: DigitalOcean API accepts domain name, not record ID (https://developers.digitalocean.com/documentation/v2/#delete-a-domain) --- cloud/digital_ocean/digital_ocean_domain.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cloud/digital_ocean/digital_ocean_domain.py b/cloud/digital_ocean/digital_ocean_domain.py index 81de784af87..cf05a7f91c1 100644 --- a/cloud/digital_ocean/digital_ocean_domain.py +++ b/cloud/digital_ocean/digital_ocean_domain.py @@ -125,7 +125,7 @@ class Domain(JsonfyMixIn): self.__dict__.update(domain_json) def destroy(self): - self.manager.destroy_domain(self.id) + self.manager.destroy_domain(self.name) def records(self): json = self.manager.all_domain_records(self.id) @@ -177,7 +177,6 @@ def core(module): except KeyError as e: module.fail_json(msg='Unable to load %s' % e.message) - changed = True state = module.params['state'] Domain.setup(api_token)