From 427fb187401af20164e3d0917e55c6bfdc0d6bb6 Mon Sep 17 00:00:00 2001 From: draw3cards Date: Thu, 17 Mar 2011 13:11:52 +0000 Subject: [PATCH] fix internal ip --- backup/src/backup.py | 2 +- backup/src/utils.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) 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(".")