"execute": isUser and self.state == State.STARTED, }) capabilities.update(other={ "console": isUser and self.getVncPort() and self.state == State.STARTED }) return capabilities def _runAction(self, action, attrs, direct): if action == "execute": fault.check("cmd" in attrs, "Command not given") try: return self.execute(attrs["cmd"]) except exceptions.CommandError, exc: raise fault.new(str(exc), fault.USER_ERROR) else: return Device._runAction(self, action, attrs, direct) def _startVnc(self): if not self.getVncPort(): self._assignVncPort() if self._vncRunning(): return vzctl.startVnc(self.host, self.getVmid(), self.getVncPort(), self.vncPassword()) def _profileChanged(self): vzctl.setProfile(self.host, self.getVmid(), **self.getProfile().attrs) def _configureRoutes(self): #Note: usage of self as host is intentional ifaceutil.deleteDefaultRoute(self) if self.hasAttribute("gateway4"):
def _runAction(self, action, attrs, direct): if action == "execute": return self.execute(attrs["cmd"]) else: return Device._runAction(self, action, attrs, direct)
def _runAction(self, action, attrs, direct): if action == "send_keys": return self.sendKeys(attrs["keycodes"]) else: return Device._runAction(self, action, attrs, direct)