From 7d4a45fd40cc18f511a4188edd8a9285d0cfcfdb Mon Sep 17 00:00:00 2001
From: Faiyaz Ahmed <faiyaza@cs.princeton.edu>
Date: Tue, 4 Sep 2007 20:52:53 +0000
Subject: [PATCH] Move call to update i2 ip address into GetSlivers.  Move try
 catch out of main into GetSlivers().

---
 nm.py | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/nm.py b/nm.py
index f951765..a7f1f70 100644
--- a/nm.py
+++ b/nm.py
@@ -1,5 +1,7 @@
 #!/usr/bin/python
 
+# $Id: $
+
 """Node Manager"""
 
 import optparse
@@ -32,9 +34,15 @@ modules = []
 
 def GetSlivers(plc):
     data = plc.GetSlivers()
+    # Set i2 ip list for nodes in I2 nodegroup.
+    try: net.GetSlivers(plc, data)
+    except: logger.log_exc()
+    #  All other callback modules
     for module in modules:
-        callback = getattr(module, 'GetSlivers')
-        callback(data)
+        try:        
+            callback = getattr(module, 'GetSlivers')
+            callback(data)
+        except: logger.log_exc()
 
 def run():
     try:
@@ -70,12 +78,8 @@ def run():
         plc = PLCAPI(config.plc_api_uri, config.cacert, session, timeout=options.period/2)
 
         while True:
-			# Set i2 ip list for nodes in I2 nodegroup.
-            try: net.GetSlivers(plc, data)
-            except: logger.log_exc()
-			# Main NM Loop
-            try: GetSlivers(plc)
-            except: logger.log_exc()
+        # Main NM Loop
+            GetSlivers(plc)
             time.sleep(options.period + random.randrange(0,301))
     except: logger.log_exc()
 
-- 
2.47.0