diff --git a/cloudflare-lb.py b/cloudflare-lb.py index cd3e141..f47cc3b 100644 --- a/cloudflare-lb.py +++ b/cloudflare-lb.py @@ -73,7 +73,11 @@ def healthcheck(host): def get_rec_id(name, host): for y in RECS: - if y['display_name'] == name and y['content'] == host and (y['type'] == "A" or y['type'] == "AAAA"): + r = name + if name == '@': + r = DOMAIN + + if y['display_name'] == r and y['content'] == host and (y['type'] == "A" or y['type'] == "AAAA"): return y['rec_id'] return False @@ -87,7 +91,7 @@ def get_rec_id(name, host): if INTERVAL >= 0: lapse = int(time.time() - start_time) - print "DONE: sleeping for {0} seconds".format(str(INTERVAL-lapse)) - time.sleep(INTERVAL-lapse) #sleep for some set time seconds + print "DONE: sleeping for {0} seconds".format(str(abs(INTERVAL-lapse))) + time.sleep(abs(INTERVAL-lapse)) #sleep for some set time seconds else: exit()