6 defaults={'user':'','opt':''}
8 self.config=ConfigParser.ConfigParser(self.defaults)
9 self.config.read(os.path.join(os.environ['HOME'],Utils_Identity.getapplipath(),'launchers.cfg'))
11 return self.config.sections()
12 def options(self,computer):
13 if not self.config.has_section(computer):
17 for opt in self.config.options(computer):
18 d[opt]=self.config.get(computer,opt)
29 def Slaunch(self,computer,CMD):
30 self.launch(computer,CMD.split())
33 def launch(self,computer,CMD):
35 conf=config.options(computer)
37 command=["ssh",computer]
39 command=command+['-l',conf["user"]]
41 command=command+string.split(conf["opt"])
42 command=command+[os.path.join(Utils_Identity.getapplipath(),'runSession')]+CMD
43 command=command+['>', "/tmp/" + CMD[1] + "_" + computer + ".log 2>&1"]
46 pid = os.spawnvp(os.P_NOWAIT, command[0], command)
51 def register(name,klass):
56 def setLauncher(name):
58 launcher=_register[name]
60 def getLauncher(computer):
62 Return a launcher for the computer
63 If can be specified in config
64 If not return the default one : launcher
66 conf=config.options(computer)
67 name=conf.get("launcher","")
68 return _register.get(name,launcher)
73 # Try to import a plugin module (user defined) that
74 # can define other launchers and register them
76 # 2- register it with : Launchers.register(name,klass)
77 # 3- eventually set it as default one : Launchers.setLauncher(name)