_rtype = "OMFApplication"
_authorized_connections = ["OMFNode"]
- @classmethod
- def stdin_send(cls, old_value, new_value):
- print "AAHHHHHHHH"
-
@classmethod
def _register_attributes(cls):
""" Register the attributes of an OMF application
path = Attribute("path", "Path of the application")
args = Attribute("args", "Argument of the application")
env = Attribute("env", "Environnement variable of the application")
- stdin = Attribute("stdin", "Input of the application", default = "", set_hook = cls.stdin_send )
+ stdin = Attribute("stdin", "Input of the application", default = "")
cls._register_attribute(appid)
cls._register_attribute(path)
cls._register_attribute(args)
self._omf_api = None
+ self.add_set_hook()
+
@property
def exp_id(self):
if self.ec.exp_id.startswith('exp-'):
if rm_list: return rm_list[0]
return None
+ def stdin_hook(self, old_value, new_value):
+ self._omf_api.send_stdin(self.node.get('hostname'), new_value, self.get('appid'))
+ return new_value
+
+ def add_set_hook(self):
+ attr = self._attrs["stdin"]
+ attr.set_hook = self.stdin_hook
def valid_connection(self, guid):
xmpp_node = self._host_session_id(hostname)
self._client.publish(payload, xmpp_node)
+
def send_stdin(self, hostname, value, app_id):
""" Send to the stdin of the application the value