[Erp5-report] r34807 luke - /erp5/trunk/utils/erp5.timmy/src/erp5/timmy/timmy.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Apr 27 11:31:33 CEST 2010


Author: luke
Date: Tue Apr 27 11:31:30 2010
New Revision: 34807

URL: http://svn.erp5.org?rev=34807&view=rev
Log:
 - return buildout errors to computer (only in case of buildout not being able to run properly)
 - report that computer is in good shape in the early beginning...
 - ...but later use it to report higher level issues while running timmy
 - as computer is used to inform about issues disable all in plugin

Modified:
    erp5/trunk/utils/erp5.timmy/src/erp5/timmy/timmy.py

Modified: erp5/trunk/utils/erp5.timmy/src/erp5/timmy/timmy.py
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.timmy/src/erp5/timmy/timmy.py?rev=34807&r1=34806&r2=34807&view=diff
==============================================================================
--- erp5/trunk/utils/erp5.timmy/src/erp5/timmy/timmy.py [utf8] (original)
+++ erp5/trunk/utils/erp5.timmy/src/erp5/timmy/timmy.py [utf8] Tue Apr 27 11:31:30 2010
@@ -202,10 +202,15 @@
 
   # TODO: parse result_std and result_err
 
-  logging.info('Standard output:')
-  logging.info(result_std)
-  logging.info('Error output:')
-  logging.info(result_err)
+  if popen.returncode == 0:
+    log_method = logging.info
+  else:
+    log_method = logging.error
+    log_method('Buildout finished with bad status code (%s)' % \
+        popen.returncode)
+  log_method('Standard output:\n%s' % result_std)
+  log_method('Error output:\n%s' % result_err)
+  return popen.returncode, result_std, result_err
 
 class Partition(object):
   # generic
@@ -359,16 +364,16 @@
     pass
 
   def install_Computer(self):
-    return self.getPartitionState_Computer()
+    pass
 
   def start_Computer(self):
-    return self.getPartitionState_Computer()
+    pass
 
   def stop_Computer(self):
-    return self.getPartitionState_Computer()
+    pass
 
   def getPartitionState_Computer(self):
-    return 'reportStarted', 'timmy was able to operate on running computer'
+    pass
 
   # Mysql Database
   def MysqlDatabase(self):
@@ -568,6 +573,8 @@
       sys.exit(1)
 
     computer_id = getServerKey(options.key_file)
+    server.call('updatePartitionState', computer_id, 'reportStarted',
+        'timmy is running on computer')
     supervisor_id = computer_id
     supervisor_list = [q for q in partition_dict_list if q['TYPE'] == \
         'Supervisor Server']
@@ -627,8 +634,13 @@
       raise
     # 2 pass - run buildout
     try:
-      runBuildout(options.buildout_binary, options.main_output,
-        options.buildout_offline)
+      return_code, result_std, result_err = runBuildout(
+          options.buildout_binary, options.main_output,
+          options.buildout_offline)
+      if return_code != 0:
+        server.call('updatePartitionState', computer_id, 'reportError',
+            'Buildout finished with bad status code (%s). Stdout = "%s", stde'
+            'rr = "%s"' % (return_code, result_std, result_err))
     except:
       server.call('updatePartitionState', computer_id, 'reportError',
           'Unexpected issue while running buildout: %s:%s' % (




More information about the Erp5-report mailing list