1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

cloudflare_dns: Fix solo SRV record creation

This commit is contained in:
Michael Gruener 2016-03-25 18:23:52 +01:00 committed by Matt Clay
parent 85d41db922
commit 41ed47d66e

View file

@ -371,19 +371,21 @@ class CloudflareAPI(object):
params[param] = getattr(self,param)
records = []
search_value = params['value']
content = params['value']
search_record = params['record']
if params['type'] == 'SRV':
search_value = str(params['weight']) + '\t' + str(params['port']) + '\t' + params['value']
content = str(params['weight']) + '\t' + str(params['port']) + '\t' + params['value']
search_record = params['service'] + '.' + params['proto'] + '.' + params['record']
if params['solo']:
search_value = None
else:
search_value = content
records = self.get_dns_records(params['zone'],params['type'],search_record,search_value)
for rr in records:
if params['solo']:
if not ((rr['type'] == params['type']) and (rr['name'] == params['record']) and (rr['content'] == params['value'])):
if not ((rr['type'] == params['type']) and (rr['name'] == search_record) and (rr['content'] == content)):
self.changed = True
if not self.module.check_mode:
result, info = self._cf_api_call('/zones/{0}/dns_records/{1}'.format(rr['zone_id'],rr['id']),'DELETE')