updated ovh state and modules
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
473f8c63d0
commit
2c28b44206
@ -154,11 +154,10 @@ def domain_put_record(zone="",
|
||||
target=target,
|
||||
ttl=ttl)
|
||||
return req
|
||||
return "Error updating record"
|
||||
except APIError:
|
||||
return "Query failed in OVH API"
|
||||
|
||||
return None
|
||||
return "Error updating record"
|
||||
|
||||
|
||||
def domain_delete_record(zone="", fieldType="", subDomain=""):
|
||||
|
@ -32,15 +32,15 @@ def domain_record_present(name="",
|
||||
'comment': 'Config is up to date'
|
||||
}
|
||||
|
||||
if name is None:
|
||||
if not name:
|
||||
return _error(ret, 'Must provide name to ovhapi.domain_record_present')
|
||||
if zone is None:
|
||||
if not zone:
|
||||
return _error(ret, 'Must provide dns zone to ovhapi.domain_record_present')
|
||||
if recordname is None:
|
||||
if not recordname:
|
||||
return _error(ret, 'Must provide record name to ovhapi.domain_record_present')
|
||||
if recordtype is None:
|
||||
if not recordtype:
|
||||
return _error(ret, 'Must provide record type to ovhapi.domain_record_present')
|
||||
if target is None:
|
||||
if not target:
|
||||
return _error(ret, 'Must provide target to ovhapi.domain_record_present')
|
||||
|
||||
cur_zone_state = __salt__['ovhapi.domain_get_zone'](zone=zone)
|
||||
@ -50,8 +50,8 @@ def domain_record_present(name="",
|
||||
fieldType=recordtype,
|
||||
subDomain=recordname,
|
||||
target=target)
|
||||
if cur_record is not None:
|
||||
res = __salt__['ovhapi.domain_put_record'](zone=zone,
|
||||
if cur_record:
|
||||
__salt__['ovhapi.domain_put_record'](zone=zone,
|
||||
fieldType=recordtype,
|
||||
subDomain=recordname,
|
||||
target=target)
|
||||
@ -63,7 +63,7 @@ def domain_record_present(name="",
|
||||
}
|
||||
res_output = f"Updated record {recordname}"
|
||||
else:
|
||||
res = __salt__['ovhapi.domain_post_record'](zone=zone,
|
||||
__salt__['ovhapi.domain_post_record'](zone=zone,
|
||||
subDomain=recordname,
|
||||
fieldType=recordtype,
|
||||
target=target,
|
||||
@ -76,7 +76,21 @@ def domain_record_present(name="",
|
||||
}
|
||||
res_output = f"Created record {recordname}"
|
||||
|
||||
cur_zone_refresh = __salt__['ovhapi.domain_refresh_zone'](zone=zone)
|
||||
ret['comment'] = f'Result is {res_output}'
|
||||
|
||||
return ret
|
||||
|
||||
|
||||
def domain_zone_refresh(name="", zone=""):
|
||||
res_output = ""
|
||||
ret = {
|
||||
'name': name,
|
||||
'changes': {},
|
||||
'result': True,
|
||||
'comment': 'Zone is refreshed'
|
||||
}
|
||||
|
||||
res_output = __salt__['ovhapi.domain_refresh_zone'](zone=zone)
|
||||
|
||||
ret['comment'] = f'Result is {res_output}'
|
||||
|
||||
|
@ -12,3 +12,10 @@ ovh-domain-{{ domain }}-{{ "{}-{}-{}".format(record.name, record.type, record.ta
|
||||
- ttl: {{ record.ttl|default(0) }}
|
||||
{%- endfor %}
|
||||
{%- endfor %}
|
||||
|
||||
{%- for domain in ovh.domain.zones.keys() %}
|
||||
ovh-domain-refresh-{{ domain }}:
|
||||
ovhapi.domain_zone_refresh:
|
||||
- name: ovh-domain-refresh-{{ domain }}
|
||||
- zone: {{ domain }}
|
||||
{%- endfor %}
|
||||
|
Loading…
Reference in New Issue
Block a user