X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=src%2Fnepi%2Fresources%2Fomf%2Fapplication.py;h=2f7628dd78201f357b323394c3a5a2c82887e529;hb=00625b636f65c97029861c1302b63fd474abdf0f;hp=e9389d085261aa2e1538dae0a195a06a47fd311c;hpb=38cae419a35e2f1847dcb279a3e25597e79c80ee;p=nepi.git diff --git a/src/nepi/resources/omf/application.py b/src/nepi/resources/omf/application.py index e9389d08..2f7628dd 100644 --- a/src/nepi/resources/omf/application.py +++ b/src/nepi/resources/omf/application.py @@ -47,10 +47,6 @@ class OMFApplication(OMFResource): _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 @@ -60,7 +56,7 @@ class OMFApplication(OMFResource): 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) @@ -88,6 +84,8 @@ class OMFApplication(OMFResource): self._omf_api = None + self.add_set_hook() + @property def exp_id(self): if self.ec.exp_id.startswith('exp-'): @@ -100,6 +98,13 @@ class OMFApplication(OMFResource): 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):