comparison bitten/slave.py @ 66:df40a4eb7553

Use the standard {{{platform}}} module for reporting of system info by slaves. Closes #6.
author cmlenz
date Tue, 28 Jun 2005 23:15:55 +0000
parents 2332aedba328
children 234600bf0d49
comparison
equal deleted inserted replaced
65:5f9bcb4966b7 66:df40a4eb7553
18 # 18 #
19 # Author: Christopher Lenz <cmlenz@gmx.de> 19 # Author: Christopher Lenz <cmlenz@gmx.de>
20 20
21 import logging 21 import logging
22 import os 22 import os
23 import sys 23 import platform
24 import tempfile 24 import tempfile
25 import time 25 import time
26 26
27 from bitten.build import BuildError 27 from bitten.build import BuildError
28 from bitten.recipe import Recipe, InvalidRecipeError 28 from bitten.recipe import Recipe, InvalidRecipeError
62 raise beep.TerminateSession, '%s (%d)' \ 62 raise beep.TerminateSession, '%s (%d)' \
63 % (elem.gettext(), int(elem.attr['code'])) 63 % (elem.gettext(), int(elem.attr['code']))
64 raise beep.TerminateSession, 'Registration failed!' 64 raise beep.TerminateSession, 'Registration failed!'
65 logging.info('Registration successful') 65 logging.info('Registration successful')
66 66
67 sysname, nodename, release, version, machine = os.uname() 67
68 system, node, release, version, machine, processor = platform.uname()
69 system, release, version = platform.system_alias(system, release,
70 version)
68 if self.session.name is not None: 71 if self.session.name is not None:
69 nodename = self.session.name 72 node = self.session.name
70 logging.info('Registering with build master as %s', nodename) 73 logging.info('Registering with build master as %s', node)
71 xml = xmlio.Element('register', name=nodename)[ 74 xml = xmlio.Element('register', name=node)[
72 xmlio.Element('platform')[machine], 75 xmlio.Element('platform', processor=processor)[machine],
73 xmlio.Element('os', family=os.name, version=release)[sysname] 76 xmlio.Element('os', family=os.name, version=release)[system]
74 ] 77 ]
75 self.channel.send_msg(beep.MIMEMessage(xml), handle_reply) 78 self.channel.send_msg(beep.MIMEMessage(xml), handle_reply)
76 79
77 def handle_msg(self, msgno, msg): 80 def handle_msg(self, msgno, msg):
78 content_type = msg.get_content_type() 81 content_type = msg.get_content_type()
147 except (BuildError, InvalidRecipeError), e: 150 except (BuildError, InvalidRecipeError), e:
148 xml = xmlio.Element('step', id=step.id, result='failure', 151 xml = xmlio.Element('step', id=step.id, result='failure',
149 description=step.description)[e] 152 description=step.description)[e]
150 self.channel.send_ans(msgno, beep.MIMEMessage(xml)) 153 self.channel.send_ans(msgno, beep.MIMEMessage(xml))
151 154
155 logging.info('Build completed')
152 self.channel.send_nul(msgno) 156 self.channel.send_nul(msgno)
153 157
154 except InvalidRecipeError, e: 158 except InvalidRecipeError, e:
155 xml = xmlio.Element('error')[e] 159 xml = xmlio.Element('error')[e]
156 self.channel.send_ans(msgno, beep.MIMEMessage(xml)) 160 self.channel.send_ans(msgno, beep.MIMEMessage(xml))
Copyright (C) 2012-2017 Edgewall Software