Preventing unbound local error with TTL to allow subdomain creation
This commit is contained in:
parent
5ff266689e
commit
0fc975a429
1 changed files with 4 additions and 1 deletions
|
|
@ -68,6 +68,8 @@ def retrieve_dns_ip(api_url, headers):
|
||||||
response = requests.get(api_url, headers=headers)
|
response = requests.get(api_url, headers=headers)
|
||||||
|
|
||||||
response_json = response.json() # IPs are stored in a list as string
|
response_json = response.json() # IPs are stored in a list as string
|
||||||
|
retrieved_dns_ip = None
|
||||||
|
retrieved_ttl = None
|
||||||
try:
|
try:
|
||||||
retrieved_dns_ip = response_json['rrset_values'][0]
|
retrieved_dns_ip = response_json['rrset_values'][0]
|
||||||
retrieved_ttl = response_json['rrset_ttl']
|
retrieved_ttl = response_json['rrset_ttl']
|
||||||
|
|
@ -91,6 +93,7 @@ def update_dns_ip(api_url, headers):
|
||||||
print(f"DNS IP is : {dns_ip}")
|
print(f"DNS IP is : {dns_ip}")
|
||||||
else:
|
else:
|
||||||
print("The subdomain doesn't exist, no DNS IP associated")
|
print("The subdomain doesn't exist, no DNS IP associated")
|
||||||
|
if dns_ttl:
|
||||||
print(f"DNS TTL is {dns_ttl}")
|
print(f"DNS TTL is {dns_ttl}")
|
||||||
if public_ip != dns_ip or dns_ttl != ttl:
|
if public_ip != dns_ip or dns_ttl != ttl:
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue