本文整理汇总了Python中tomato.devices.Device._runAction方法的典型用法代码示例。如果您正苦于以下问题:Python Device._runAction方法的具体用法?Python Device._runAction怎么用?Python Device._runAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tomato.devices.Device
的用法示例。
在下文中一共展示了Device._runAction方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _runAction
# 需要导入模块: from tomato.devices import Device [as 别名]
# 或者: from tomato.devices.Device import _runAction [as 别名]
"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"):
示例2: _runAction
# 需要导入模块: from tomato.devices import Device [as 别名]
# 或者: from tomato.devices.Device import _runAction [as 别名]
def _runAction(self, action, attrs, direct):
if action == "execute":
return self.execute(attrs["cmd"])
else:
return Device._runAction(self, action, attrs, direct)
示例3: _runAction
# 需要导入模块: from tomato.devices import Device [as 别名]
# 或者: from tomato.devices.Device import _runAction [as 别名]
def _runAction(self, action, attrs, direct):
if action == "send_keys":
return self.sendKeys(attrs["keycodes"])
else:
return Device._runAction(self, action, attrs, direct)