X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fplc%2Fplshell.py;h=eea33c0df6cd2040eba6ef6f3176a6440ce4de27;hb=02a4a59a4a49183ec8c631cc03243b97f4602d50;hp=eaa772a9fc926d60a404afa932e8c4a9fd702fd5;hpb=037578a7bee4db0bacb84f728db6bf2735bf9e33;p=sfa.git diff --git a/sfa/plc/plshell.py b/sfa/plc/plshell.py index eaa772a9..eea33c0d 100644 --- a/sfa/plc/plshell.py +++ b/sfa/plc/plshell.py @@ -37,10 +37,16 @@ class PlShell: hostname=urlparse(url).hostname is_local=False if hostname == 'localhost': is_local=True - # otherwise compare IP addresses - url_ip=socket.gethostbyname(hostname) - local_ip=socket.gethostbyname(socket.gethostname()) - if url_ip==local_ip: is_local=True + # otherwise compare IP addresses; + # this might fail for any number of reasons, so let's harden that + try: + # xxx todo this seems to result in a DNS request for each incoming request to the AM + # should be cached or improved + url_ip=socket.gethostbyname(hostname) + local_ip=socket.gethostbyname(socket.gethostname()) + if url_ip==local_ip: is_local=True + except: + pass if is_local: try: @@ -65,7 +71,7 @@ class PlShell: 'Username': config.SFA_PLC_USER, 'AuthString': config.SFA_PLC_PASSWORD, } - self.proxy = xmlrpclib.Server(url, verbose = 0, allow_none = True) + self.proxy = xmlrpclib.Server(url, verbose = False, allow_none = True) def __getattr__(self, name): def func(*args, **kwds):