diff --git a/backup/src/backup.py b/backup/src/backup.py index 46d4be6..6ef5d68 100644 --- a/backup/src/backup.py +++ b/backup/src/backup.py @@ -33,7 +33,7 @@ def find_target(target, reservations) : print "Skipping reservation " + reservation continue instance = instances[0] - instanceIp = resolveIp(instance.dns_name) + instanceIp = instance.ip_address print "IP for {} resolved as {}".format(instance.dns_name, instanceIp) if instanceIp == ip: return instance diff --git a/backup/src/utils.py b/backup/src/utils.py index d73f584..a0660c8 100644 --- a/backup/src/utils.py +++ b/backup/src/utils.py @@ -1,6 +1,8 @@ import socket import datetime import time +from urllib import urlopen + def single_or_none(list): if len(list) != 1: @@ -16,6 +18,10 @@ def single(list): return result +def get_my_ip(): + return urlopen('http://whatismyip.com/automation/n09230945.asp').read() + + def get_time(dt_str): # http://stackoverflow.com/questions/127803/how-to-parse-iso-formatted-date-in-python/127825#127825 dt, _, us= dt_str.partition(".")