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)
reviewable/pr18780/r1
Andrei Lukovenko 8 years ago committed by René Moser
parent 74285d6a53
commit ff223ee14c

@ -125,7 +125,7 @@ class Domain(JsonfyMixIn):
self.__dict__.update(domain_json) self.__dict__.update(domain_json)
def destroy(self): def destroy(self):
self.manager.destroy_domain(self.id) self.manager.destroy_domain(self.name)
def records(self): def records(self):
json = self.manager.all_domain_records(self.id) json = self.manager.all_domain_records(self.id)
@ -177,7 +177,6 @@ def core(module):
except KeyError as e: except KeyError as e:
module.fail_json(msg='Unable to load %s' % e.message) module.fail_json(msg='Unable to load %s' % e.message)
changed = True
state = module.params['state'] state = module.params['state']
Domain.setup(api_token) Domain.setup(api_token)

Loading…
Cancel
Save