本文整理汇总了Python中comoonics.ComSystem.askExecModeCmd方法的典型用法代码示例。如果您正苦于以下问题:Python ComSystem.askExecModeCmd方法的具体用法?Python ComSystem.askExecModeCmd怎么用?Python ComSystem.askExecModeCmd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类comoonics.ComSystem
的用法示例。
在下文中一共展示了ComSystem.askExecModeCmd方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: executeRecover
# 需要导入模块: from comoonics import ComSystem [as 别名]
# 或者: from comoonics.ComSystem import askExecModeCmd [as 别名]
def executeRecover(self, _file, destdir, dir=True):
# recover -s wspbackup.messe-muenchen.de -c wspbackup.messe-muenchen.de -a -d /mnt/backup/recover /tmp/metadata/vg_gfstest-lv_gfstest_filesystem.xml
if dir:
_dir=_file
_selection="*"
else:
_dir=os.path.dirname(_file)
_selection=os.path.basename(_file)
_cmd="%s %s -c %s -s %s -d %s %s" %(LegatoNetworker.LEGATO_CMD_RECOVER, " ".join(self.recover_options),
self.client, self.server, destdir, _dir)
if ComSystem.askExecModeCmd(_cmd):
# Ignore timeouts
_shell=pexpect.spawn(_cmd, [], None)
if self.log.getEffectiveLevel() == DEBUG:
_shell.logfile=file(str("/tmp/%s.log" %(os.path.basename(LegatoNetworker.LEGATO_CMD_RECOVER))), "w")
_shell.cmdlogfile=file(str("/tmp/%s-cmd.log" %(os.path.basename(LegatoNetworker.LEGATO_CMD_RECOVER))), "w")
_shell.expect(self.LEGATO_RECOVER_SHELL)
_shell.sendline("add -q %s" %_selection)
_shell.expect(self.LEGATO_RECOVER_SHELL)
_shell.sendline("recover")
_shell.expect(self.LEGATO_RECOVER_SHELL, None)
_shell.close()
示例2: cmd
# 需要导入模块: from comoonics import ComSystem [as 别名]
# 或者: from comoonics.ComSystem import askExecModeCmd [as 别名]
def cmd(self, cmd, params=None, match=None):
self.last_cmd=cmd
if not match:
match=HP_EVA_SSSU.MATCH_COMMANDSTATUS
self.last_cmd=cmd+HP_EVA_SSSU.DELIM+self.toParams(params)
mylogger.log(CMD_LOG_LEVEL, self.last_cmd)
if not ComSystem.askExecModeCmd(self.last_cmd):
return 0
self.sssu_shell.sendline(self.last_cmd)
self.sssu_shell.expect(match)
self.last_output=self.sssu_shell.before
self.xml_output=None
if self.sssu_shell.match==pexpect.EOF:
return 0
else:
if isinstance(self.sssu_shell.match,pexpect.ExceptionPexpect):
raise CommandError(1, self.last_cmd, self.sssu_shell.before)
else:
thematch=self.sssu_shell.match
#mylogger.debug("self.sssu_shell.match.group(1): %s" %(thematch.group(1)))
self.last_error_code=int(thematch.group(1))
if self.last_error_code == 0:
self.xml_output=self.LastOutput2XML()
return self.last_error_code
else:
# Check for the special case when system is managed by another agent to get the right back
_match=self.MATCH_MANAGED_ERROR.search(self.last_output)
if _match and self.managed_overwrite:
mylogger.warn("SSSU Warning: System is managed by another agent (%s, %s). Overwriting." %(_match.group(1), _match.group(2)))
self.setSystem(self.system, "manage")
self.cmd(cmd, params, match)
return 0
raise CommandError(self.last_error_code, self.last_cmd, self.last_output)