fixed multiple entries ovh update
This commit is contained in:
parent
bdcf586a6c
commit
7599ec2684
26
dyndomain
26
dyndomain
@ -153,23 +153,6 @@ def ovh_update_zone(domain, update_zone_list, delete_zone_list):
|
||||
|
||||
client = ovh.Client()
|
||||
|
||||
for host, fieldtype, target in update_zone_list:
|
||||
result = client.get('/domain/zone/%s/record' % domain,
|
||||
fieldType=fieldtype,
|
||||
subDomain=host)
|
||||
if len(result) == 0:
|
||||
#print("Create new entry for %s %s %s" % (host, fieldtype, target))
|
||||
client.post('/domain/zone/%s/record' % domain,
|
||||
fieldType=fieldtype,
|
||||
subDomain=host,
|
||||
target=target,
|
||||
ttl=60)
|
||||
else:
|
||||
id = result[0]
|
||||
#print("Update entry for %s %s %s" % (host, fieldtype, target))
|
||||
client.put('/domain/zone/%s/record/%ld' % (domain, id),
|
||||
target=target)
|
||||
|
||||
for host, fieldtype, target in delete_zone_list:
|
||||
result = client.get('/domain/zone/%s/record' % domain,
|
||||
fieldType=fieldtype,
|
||||
@ -179,6 +162,15 @@ def ovh_update_zone(domain, update_zone_list, delete_zone_list):
|
||||
id = result[0]
|
||||
#print("Delete entry for %s %s %s" % (host, fieldtype, target))
|
||||
client.delete('/domain/zone/%s/record/%d' % (domain, id))
|
||||
|
||||
for host, fieldtype, target in update_zone_list:
|
||||
#print("Create new entry for %s %s %s" % (host, fieldtype, target))
|
||||
client.post('/domain/zone/%s/record' % domain,
|
||||
fieldType=fieldtype,
|
||||
subDomain=host,
|
||||
target=target,
|
||||
ttl=60)
|
||||
|
||||
#print("Refresh zone %s" % domain)
|
||||
client.post('/domain/zone/%s/refresh' % domain)
|
||||
return True
|
||||
|
Loading…
Reference in New Issue
Block a user