[rhmessaging-commits] rhmessaging commits: r2641 - mgmt/trunk/cumin/python/cumin.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Wed Oct 15 09:21:18 EDT 2008


Author: eallen
Date: 2008-10-15 09:21:18 -0400 (Wed, 15 Oct 2008)
New Revision: 2641

Modified:
   mgmt/trunk/cumin/python/cumin/model.py
Log:
Better handling of error return on Fetch call

Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py	2008-10-14 21:16:14 UTC (rev 2640)
+++ mgmt/trunk/cumin/python/cumin/model.py	2008-10-15 13:21:18 UTC (rev 2641)
@@ -1982,6 +1982,7 @@
             file, start, end, tail = args
             self.job_output = None
             self.got_data = False
+            self.reason = None
             
             def completion(status, job_output):
                 if "Data" in job_output:
@@ -1992,7 +1993,10 @@
                     while ord(raw[-lindex:][0]) != ord_nl:
                         lindex = lindex + 1
                     self.job_output = raw[:-lindex]
-                    self.got_data = True
+                else:
+                    self.reason = status
+
+                self.got_data = True
                 
             def predicate():
                 return self.got_data
@@ -2003,9 +2007,12 @@
                 # wait for up to 20 seconds for completion to be called
                 wait(predicate, timeout=20)
                 if not self.got_data:
-                    self.job_output = "Unable to get file at %s. Reason: time out" % file
+                    self.reason = "time out"
             except Exception, e:
-                self.job_output = "Unable to get file at %s. Reason: %s" % (file, e)
+                self.reason = e 
+
+            if self.reason:
+                self.job_output = "Unable to get file at %s. Reason: %s" % (file, self.reason)
                     
             return self.job_output and "<fetch><output>%s</output><tail>%s</tail></fetch>" % (escape_entity(self.job_output), tail)
 




More information about the rhmessaging-commits mailing list