Exemple #1
0
 def proc_evt_variable_get(self, task, evt):
     """Process variable_get event."""
     handle = evt.arg('handle', '')
     dest = evt.arg('dest', '')
     if handle == '' and localhost(dest):
         key = evt.arg('key')
         if self.runtime.vars.has_key(key):
             value = self.runtime.vars[key]
             task.proc_cmd(command.variable_value(key, value,
                 handle=handle, dest=dest))
         else:
             task.proc_cmd(command.variable_value(key, None,
                 handle=handle, error="Undefined variable.", dest=dest))
         return True
     else:
         key = evt.arg('key')
         s = repr(("command.variable_value", key, handle, dest))
         if self.__waiting_tasks.has_key(s):
             _, l = self.__waiting_tasks[s]
             if task not in l:
                 l.append(task)
                 log.debug("Controller.__waiting_tasks=%r", self.__waiting_tasks)
             return True
         _, l = self.__waiting_tasks[s] = (evt, [task])
         log.debug("Controller.__waiting_tasks=%r", self.__waiting_tasks)
Exemple #2
0
 def proc_evt_variable_set(self, task, evt):
     """Process variable_set event."""
     handle = evt.arg('handle', '')
     dest = evt.arg('dest', '')
     if handle == '' and localhost(dest):
         self.proc_local_variable_set(evt)
         return True
     else:
         pass
Exemple #3
0
 def proc_evt_variables(self, task, evt):
     """Process variables event."""
     handle = evt.arg('handle', '')
     dest = evt.arg('dest', '')
     if handle == '' and localhost(dest):
         task.proc_cmd(command.answer(evt.id(), self.proc_local_variables(evt)))
         return True
     else:
         s = repr(("command.answer", evt.id()))
         self.__waiting_tasks[s] = (evt, [task])
Exemple #4
0
 def proc_evt_variable_get(self, evt):
     host = evt.arg('dest')
     if localhost(host):
         return
     # FIXME? remote Controller could listen on another port:
     port = self.def_port
     # loop for testing:
     if test_loop(host):
         # test.loop for testing forwarder on single machine.
         # could be used with port number test.loop:11432
         # Modify the dest field to avoid inifinite loop:
         evt.args()['dest'] = host.upper()
         port = int(test_loop_port(host) or port)
     cmd = command.forward(event=evt)
     d = self.remote_call(cmd, host, port)
     if d:
         d.addCallback(self.handle_evt_variable_get, evt)
Exemple #5
0
 def proc_evt_variable_get(self, evt):
     host = evt.arg('dest')
     if localhost(host):
         return
     # FIXME? remote Controller could listen on another port:
     port = self.def_port
     # loop for testing:
     if test_loop(host):
         # test.loop for testing forwarder on single machine.
         # could be used with port number test.loop:11432
         # Modify the dest field to avoid inifinite loop:
         evt.args()['dest'] = host.upper()
         port = int(test_loop_port(host) or port)
     cmd = command.forward(event=evt)
     d = self.remote_call(cmd, host, port)
     if d:
         d.addCallback(self.handle_evt_variable_get, evt)