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)
This commit is contained in:
Andrei Lukovenko 2016-07-11 01:26:31 +02:00 committed by Matt Clay
parent 28716f565c
commit 85bd975238

View file

@ -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)