def getpcu(nodename):
api = xmlrpclib.Server(auth.server, verbose=False, allow_none=True)
anon = {'AuthMethod': "anonymous"}
- nodeinfo = api.GetNodes(auth.auth, {"hostname": nodename}, ["pcu_ids", "ports"])[0]
+ try:
+ nodeinfo = api.GetNodes(auth.auth, {"hostname": nodename}, ["pcu_ids", "ports"])[0]
+ except IndexError:
+ logger.info("Can not find node: %s" % nodename)
+ return False
if nodeinfo['pcu_ids']:
print nodeinfo
sitepcu = api.GetPCUs(auth.auth, nodeinfo['pcu_ids'])[0]
try:
site = api.GetSites(auth.auth, loginbase)[0]
except Exception, exc:
- login.info("ERROR: No site %s" % loginbase)
+ logger.info("ERROR: No site %s" % loginbase)
return False
if not site['enabled'] and site['ext_consortium_id'] == PENDING_CONSORTIUM_ID: