Fix error where scriptDir is not defined
This commit is contained in:
@@ -29,7 +29,7 @@ def getZone(email, apiKey, host):
|
|||||||
print("Could not find a Zone ID for the specified domain.")
|
print("Could not find a Zone ID for the specified domain.")
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
def storeIP(ip):
|
def storeIP(ip, scriptDir):
|
||||||
# Store the given IP in the lastip file.
|
# Store the given IP in the lastip file.
|
||||||
file = open(scriptDir + 'updateCloudflare.lastip', 'w+')
|
file = open(scriptDir + 'updateCloudflare.lastip', 'w+')
|
||||||
file.write(ip)
|
file.write(ip)
|
||||||
@@ -134,10 +134,10 @@ def main():
|
|||||||
exit(0)
|
exit(0)
|
||||||
else:
|
else:
|
||||||
print("IP has changed since last run... Updating Cloudflare")
|
print("IP has changed since last run... Updating Cloudflare")
|
||||||
storeIP(ip)
|
storeIP(ip, scriptDir)
|
||||||
updateCloudflare(zoneID, authEmail, apiKey, hostToUpdate, ip)
|
updateCloudflare(zoneID, authEmail, apiKey, hostToUpdate, ip)
|
||||||
else:
|
else:
|
||||||
storeIP(ip)
|
storeIP(ip, scriptDir)
|
||||||
if ip == cloudflareIP:
|
if ip == cloudflareIP:
|
||||||
print("Cloudflare matches our current IP... Exiting")
|
print("Cloudflare matches our current IP... Exiting")
|
||||||
exit(0)
|
exit(0)
|
||||||
|
Reference in New Issue
Block a user