Try to make mumo compatible to python 2.5 and Ice 3.2 as found on debian lenny

This commit is contained in:
Stefan Hacker
2010-12-27 16:39:48 +01:00
parent b25b446f84
commit 793fb121fe
2 changed files with 17 additions and 5 deletions

18
mumo.py
View File

@@ -56,7 +56,10 @@ default.update({'ice':(('host', str, '127.0.0.1'),
('port', int, 6502), ('port', int, 6502),
('slice', str, 'Murmur.ice'), ('slice', str, 'Murmur.ice'),
('secret', str, ''), ('secret', str, ''),
('watchdog', int, 30)), ('slicedir', str, '/usr/share/slice'),
('watchdog', int, 30),
('callback_host', str, '127.0.0.1'),
('callback_port', int, -1)),
'iceraw':None, 'iceraw':None,
'murmur':(('servers', commaSeperatedIntegers, []),), 'murmur':(('servers', commaSeperatedIntegers, []),),
@@ -68,7 +71,11 @@ def do_main_program():
#--- Moderator implementation #--- Moderator implementation
# All of this has to go in here so we can correctly daemonize the tool # All of this has to go in here so we can correctly daemonize the tool
# without loosing the file descriptors opened by the Ice module # without loosing the file descriptors opened by the Ice module
Ice.loadSlice('', ['-I' + Ice.getSliceDir(), cfg.ice.slice]) if not hasattr(Ice, "getSliceDir"):
Ice.loadSlice('-I%s %s' % (cfg.ice.slicedir, cfg.ice.slice))
else:
Ice.loadSlice('', ['-I' + Ice.getSliceDir(), cfg.ice.slice])
import Murmur import Murmur
class mumoIceApp(Ice.Application): class mumoIceApp(Ice.Application):
@@ -112,7 +119,12 @@ def do_main_program():
base = ice.stringToProxy('Meta:tcp -h %s -p %d' % (cfg.ice.host, cfg.ice.port)) base = ice.stringToProxy('Meta:tcp -h %s -p %d' % (cfg.ice.host, cfg.ice.port))
self.meta = Murmur.MetaPrx.uncheckedCast(base) self.meta = Murmur.MetaPrx.uncheckedCast(base)
adapter = ice.createObjectAdapterWithEndpoints('Callback.Client', 'tcp -h %s' % cfg.ice.host) if cfg.ice.callback_port > 0:
cbp = ' -p %d' % cfg.ice.callback_port
else:
cbp = ''
adapter = ice.createObjectAdapterWithEndpoints('Callback.Client', 'tcp -h %s%s' % (cfg.ice.callback_host, cbp))
adapter.activate() adapter.activate()
self.adapter = adapter self.adapter = adapter

View File

@@ -519,7 +519,7 @@ class MumoManager(Worker):
for name in names: for name in names:
try: try:
modinst = self.modules[name] modinst = self.modules[name]
if not modinst.is_alive(): if not modinst.isAlive():
modinst.start() modinst.start()
log.debug("Module '%s' started", name) log.debug("Module '%s' started", name)
else: else:
@@ -566,7 +566,7 @@ class MumoManager(Worker):
except Queue.Empty: pass except Queue.Empty: pass
for modinst in stoppedmodules.itervalues(): for modinst in stoppedmodules.itervalues():
if modinst.is_alive(): if modinst.isAlive():
modinst.stop() modinst.stop()
log.debug("Module '%s' is being stopped", name) log.debug("Module '%s' is being stopped", name)
else: else: