mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Bug: repeatable invocation with state=present leads to (#3052)
[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: create domain digital_ocean_domain: state=present name=DOMAIN_NAME ip=DROPLET_IP Problem: DigitalOcean API changed API (https://developers.digitalocean.com/documentation/v2/#list-all-domain-records)
This commit is contained in:
parent
544b044129
commit
436ff356e7
1 changed files with 3 additions and 3 deletions
|
@ -128,7 +128,7 @@ class Domain(JsonfyMixIn):
|
|||
self.manager.destroy_domain(self.name)
|
||||
|
||||
def records(self):
|
||||
json = self.manager.all_domain_records(self.id)
|
||||
json = self.manager.all_domain_records(self.name)
|
||||
return map(DomainRecord, json)
|
||||
|
||||
@classmethod
|
||||
|
@ -194,12 +194,12 @@ def core(module):
|
|||
records = domain.records()
|
||||
at_record = None
|
||||
for record in records:
|
||||
if record.name == "@" and record.record_type == 'A':
|
||||
if record.name == "@" and record.type == 'A':
|
||||
at_record = record
|
||||
|
||||
if not at_record.data == getkeyordie("ip"):
|
||||
record.update(data=getkeyordie("ip"), record_type='A')
|
||||
module.exit_json(changed=True, domain=Domain.find(id=record.domain_id).to_json())
|
||||
module.exit_json(changed=True, domain=Domain.find(id=record.id).to_json())
|
||||
|
||||
module.exit_json(changed=False, domain=domain.to_json())
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue