[Erp5-report] r34778 luke - /erp5/trunk/utils/erp5.timmy/src/erp5/timmy/timmy.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Mon Apr 26 14:30:40 CEST 2010
Author: luke
Date: Mon Apr 26 14:30:40 2010
New Revision: 34778
URL: http://svn.erp5.org?rev=34778&view=rev
Log:
- formatting
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=34778&r1=34777&r2=34778&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] Mon Apr 26 14:30:40 2010
@@ -166,7 +166,8 @@
out.write(template.substitute(replacement_dict))
out.close()
-def updateInstanceProfiles(template_directory, output_directory, instance_dict_list):
+def updateInstanceProfiles(template_directory, output_directory,
+ instance_dict_list):
for instance in instance_dict_list:
template_name = '%s-template.cfg' % instance['TYPE'].lower()\
.replace(' ','-')
@@ -342,7 +343,8 @@
except socket.error:
logging.warning('Cannot connect to %s, ignoring for now' %
self.connection_string)
- return 'reportUnknown', 'Cannot connect to Business Configuration, ignored for now'
+ return 'reportUnknown', 'Cannot connect to Business Configuration, ign'\
+ 'ored for now'
except Exception, e:
logging.error('Uncaught error %s for %s' % (e, self.connection_string))
return 'reportError', 'Uncaught error %s' % e
@@ -429,7 +431,8 @@
return 'reportStopping', 'supervised'
if 'STOPPED' in result_std:
return 'reportStopped', 'supervised'
- return 'reportError', 'supervised: [std: %s] [err: %s]' % (result_std, result_err)
+ return 'reportError', 'supervised: [std: %s] [err: %s]' % (result_std,
+ result_err)
def getPartitionState_ConversionServer(self):
return self.getPartitionState_Supervised('oood')
@@ -547,7 +550,8 @@
raise
try:
try:
- server = XMLRPCServer(options.server_url, getServerKey(options.key_file))
+ server = XMLRPCServer(options.server_url,
+ getServerKey(options.key_file))
partition_dict_list = server.call('getComputerConfigurationDictList')
except socket.error, e:
logging.error('Unable to connect to remote server, verify if the URL is'
@@ -567,29 +571,34 @@
# prepare - run supervisor
try:
- supervisord_popen = subprocess.Popen([SUPERVISORD], stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
+ supervisord_popen = subprocess.Popen([SUPERVISORD],
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(result_std, result_err) = supervisord_popen.communicate()
except:
- server.call('updatePartitionState', supervisor_id, 'reportError', 'Unsupported issue while trying to start supervisord: %s:%s' % (str(sys.exc_info()[0]), str(sys.exc_info()[1])))
+ server.call('updatePartitionState', supervisor_id, 'reportError',
+ 'Unsupported issue while trying to start supervisord: %s:%s' % (
+ str(sys.exc_info()[0]), str(sys.exc_info()[1])))
raise
if supervisord_popen.returncode == 0:
log_message = 'Supervisord started with: stdout = %r stderr = %r' % (
result_std, result_err)
- server.call('updatePartitionState', supervisor_id, 'reportStarted', log_message)
+ server.call('updatePartitionState', supervisor_id, 'reportStarted',
+ log_message)
logging.info(log_message)
else:
if "Another program is already listening" in result_err:
# XXX-Luke: It might be better to try to connect
- log_message = 'Supervisord already running: stdout = %r stderr = %r' % (
- result_std, result_err)
- server.call('updatePartitionState', supervisor_id, 'reportStarted', log_message)
+ log_message = 'Supervisord already running: stdout = %r stderr = %r' \
+ % (result_std, result_err)
+ server.call('updatePartitionState', supervisor_id, 'reportStarted',
+ log_message)
logging.info(log_message)
else:
- log_message = 'Supervisord unknown problem: stdout = %r stderr = %r' % (
- result_std, result_err)
- server.call('updatePartitionState', supervisor_id, 'reportError', log_message)
+ log_message = 'Supervisord unknown problem: stdout = %r stderr = %r' \
+ % (result_std, result_err)
+ server.call('updatePartitionState', supervisor_id, 'reportError',
+ log_message)
logging.info(log_message)
# 1a pass - instance profiles
@@ -597,33 +606,45 @@
updateInstanceProfiles(options.template_directory,
options.instances_directory, partition_dict_list)
except:
- server.call('updatePartitionState', computer_id, 'reportError', 'Unexpected issue while updating instance profiles: %s:%s' % (str(sys.exc_info()[0]), str(sys.exc_info()[1])))
+ server.call('updatePartitionState', computer_id, 'reportError',
+ 'Unexpected issue while updating instance profiles: %s:%s' % (
+ str(sys.exc_info()[0]), str(sys.exc_info()[1])))
raise
# 1b pass - main profile
try:
updateBaseProfile(options.template_directory, options.main_output,
- options.base_profile, options.instances_directory, partition_dict_list)
+ options.base_profile, options.instances_directory,
+ partition_dict_list)
except:
- server.call('updatePartitionState', computer_id, 'reportError', 'Unexpected issue while updating base profile: %s:%s' % (str(sys.exc_info()[0]), str(sys.exc_info()[1])))
+ server.call('updatePartitionState', computer_id, 'reportError',
+ 'Unexpected issue while updating base profile: %s:%s' % (
+ str(sys.exc_info()[0]), str(sys.exc_info()[1])))
raise
# 2 pass - run buildout
try:
runBuildout(options.buildout_binary, options.main_output,
options.buildout_offline)
except:
- server.call('updatePartitionState', computer_id, 'reportError', 'Unexpected issue while running buildout: %s:%s' % (str(sys.exc_info()[0]), str(sys.exc_info()[1])))
+ server.call('updatePartitionState', computer_id, 'reportError',
+ 'Unexpected issue while running buildout: %s:%s' % (
+ str(sys.exc_info()[0]), str(sys.exc_info()[1])))
raise
# force supervisor to reload its configuration
- supervisorctl_popen = subprocess.Popen([SUPERVISORCTL, 'update'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ supervisorctl_popen = subprocess.Popen([SUPERVISORCTL, 'update'],
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(result_std, result_err) = supervisorctl_popen.communicate()
if supervisorctl_popen.returncode == 0:
- log_message = 'Supervisorctl updated with: stdout = %r stderr = %r' % (result_std, result_err)
- server.call('updatePartitionState', supervisor_id, 'reportStarted', log_message)
+ log_message = 'Supervisorctl updated with: stdout = %r stderr = %r' % (
+ result_std, result_err)
+ server.call('updatePartitionState', supervisor_id, 'reportStarted',
+ log_message)
logging.info(log_message)
else:
- log_message = 'Supervisorctl issue during update: stdout = %r stderr = %r' % (result_std, result_err)
- server.call('updatePartitionState', supervisor_id, 'reportError', log_message)
+ log_message = 'Supervisorctl issue during update: stdout = %r stderr ='\
+ ' %r' % (result_std, result_err)
+ server.call('updatePartitionState', supervisor_id, 'reportError',
+ log_message)
logging.error(log_message)
# 3 pass - manage instances
More information about the Erp5-report
mailing list