fix wrong replies for change and do

now correctly reply with 'changed' and 'done'

Change-Id: Ic2b8e6d6d7d4c8301dc8b273115a10e1f8e40a2e
This commit is contained in:
Enrico Faulhaber
2016-12-09 14:13:26 +01:00
parent b6af55c358
commit 002c843d74
3 changed files with 18 additions and 26 deletions

View File

@@ -158,8 +158,6 @@ class Dispatcher(object):
def get_module(self, modulename):
module = self._dispatcher_modules.get(modulename, modulename)
if module != modulename:
self.log.debug('get_module(%r) -> %r' % (modulename, module))
return module
def remove_module(self, modulename_or_obj):
@@ -220,8 +218,10 @@ class Dispatcher(object):
# now call func and wrap result as value
# note: exceptions are handled in handle_request, not here!
func = getattr(moduleobj, 'do'+command)
res = Value(modulename, command=command, value=func(*arguments), t=time.time())
func = getattr(moduleobj, 'do'+command)
res = func(*arguments)
res = CommandReply(module=modulename, command=command, result=[res, dict(t=time.time())])
# res = Value(modulename, command=command, value=func(*arguments), t=time.time())
return res
def _setParamValue(self, modulename, pname, value):
@@ -242,8 +242,8 @@ class Dispatcher(object):
else:
setattr(moduleobj, pname, value)
if pobj.timestamp:
return Value(modulename, pname, value=pobj.value, t=pobj.timestamp)
return Value(modulename, pname, value=pobj.value)
return WriteReply(module=modulename, parameter=pname, value=[pobj.value, dict(t=pobj.timestamp)])
return WriteReply(module=modulename, parameter=pname, value=[pobj.value, {}])
def _getParamValue(self, modulename, pname):
moduleobj = self.get_module(modulename)