updated modules
This commit is contained in:
parent
4560f9d1fe
commit
8170ebddd1
@ -145,7 +145,7 @@ def domain_put_record(zone="",
|
|||||||
subDomain=subDomain)
|
subDomain=subDomain)
|
||||||
if len(records) > 0:
|
if len(records) > 0:
|
||||||
record = client.get(f'/domain/zone/{zone}/record/{records[0]}')
|
record = client.get(f'/domain/zone/{zone}/record/{records[0]}')
|
||||||
req = client.put(f'/domain/zone/{zone}/record/{records[0]["id"]}',
|
req = client.put(f'/domain/zone/{zone}/record/{record["id"]}',
|
||||||
subDomain=subDomain,
|
subDomain=subDomain,
|
||||||
target=target,
|
target=target,
|
||||||
ttl=ttl)
|
ttl=ttl)
|
||||||
|
@ -53,24 +53,29 @@ def domain_record_present(name,
|
|||||||
res = __salt__['ovhapi.domain_put_record'](zone=zone,
|
res = __salt__['ovhapi.domain_put_record'](zone=zone,
|
||||||
fieldType=recordtype,
|
fieldType=recordtype,
|
||||||
subDomain=recordname)
|
subDomain=recordname)
|
||||||
res_output = f"Updated record {recordname}, output: {res_output}"
|
new_zone_state = __salt__['ovhapi.domain_get_zone'](zone=zone)
|
||||||
|
|
||||||
|
ret['changes'] = {
|
||||||
|
"diff": salt.utils.stringutils.get_diff(_str_split(cur_zone_state),
|
||||||
|
_str_split(new_zone_state))
|
||||||
|
}
|
||||||
|
res_output = f"Updated record {recordname}"
|
||||||
else:
|
else:
|
||||||
res = __salt__['ovhapi.domain_post_record'](zone=zone,
|
res = __salt__['ovhapi.domain_post_record'](zone=zone,
|
||||||
subDomain=recordname,
|
subDomain=recordname,
|
||||||
fieldType=recordtype,
|
fieldType=recordtype,
|
||||||
target=target,
|
target=target,
|
||||||
ttl=ttl)
|
ttl=ttl)
|
||||||
res_output = f"Updated record {recordname}, output: {res_output}"
|
new_zone_state = __salt__['ovhapi.domain_get_zone'](zone=zone)
|
||||||
|
|
||||||
new_zone_state = __salt__['ovhapi.domain_get_zone'](zone=zone)
|
ret['changes'] = {
|
||||||
|
"diff": salt.utils.stringutils.get_diff(_str_split(cur_zone_state),
|
||||||
|
_str_split(new_zone_state))
|
||||||
|
}
|
||||||
|
res_output = f"Created record {recordname}"
|
||||||
|
|
||||||
cur_zone_refresh = __salt__['ovhapi.domain_refresh_zone'](zone=zone)
|
cur_zone_refresh = __salt__['ovhapi.domain_refresh_zone'](zone=zone)
|
||||||
|
|
||||||
ret['changes'] = {
|
ret['comment'] = f'Result is {res_output}'
|
||||||
"diff": salt.utils.stringutils.get_diff(_str_split(cur_zone_state),
|
|
||||||
_str_split(new_zone_state))
|
|
||||||
}
|
|
||||||
ret['comment'] = f'Result is {res_output}, refresh {cur_zone_refresh}'
|
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
Loading…
Reference in New Issue
Block a user