From d8902f7273a996b5806a6d04c9db1fc397c0342f Mon Sep 17 00:00:00 2001
From: Tony Mack <tmack@paris.CS.Princeton.EDU>
Date: Mon, 28 Mar 2011 16:54:20 -0400
Subject: [PATCH] fail silently if there is a problem adding a node to the
 rspec

---
 sfa/plc/network.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/sfa/plc/network.py b/sfa/plc/network.py
index d8f0c1dd..9388e082 100644
--- a/sfa/plc/network.py
+++ b/sfa/plc/network.py
@@ -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):
-- 
2.47.0