fail silently if there is a problem adding a node to the rspec
authorTony Mack <tmack@paris.CS.Princeton.EDU>
Mon, 28 Mar 2011 20:54:20 +0000 (16:54 -0400)
committerTony Mack <tmack@paris.CS.Princeton.EDU>
Mon, 28 Mar 2011 20:54:20 +0000 (16:54 -0400)
sfa/plc/network.py

index d8f0c1d..9388e08 100644 (file)
@@ -347,6 +347,7 @@ class Network:
         try:
             val = self.sites[id]
         except:
+            self.api.logger.error("Invalid RSpec: site ID %s not found" % id )
             raise InvalidRSpec("site ID %s not found" % id)
         return val
     
@@ -566,8 +567,14 @@ class Network:
         """
         tmp = []
         for node in api.plshell.GetNodes(api.plauth, {'peer_id': None}):
-            t = node['node_id'], Node(self, node)
-            tmp.append(t)
+            try:
+                nodeObj = Node(self, node)
+                if nodeObj.site != None:
+                    t = node['node_id'], nodeObj
+                    tmp.append(t)
+            except:
+                self.api.logger.error("Failed to add node %s (%s) to RSpec" % (node['hostname'], node['node_id']))
+                 
         return dict(tmp)
 
     def get_ifaces(self, api):