本文整理汇总了Python中lib.remote.remote_util.RemoteMachineShellConnection.execute_couch_dbinfo方法的典型用法代码示例。如果您正苦于以下问题:Python RemoteMachineShellConnection.execute_couch_dbinfo方法的具体用法?Python RemoteMachineShellConnection.execute_couch_dbinfo怎么用?Python RemoteMachineShellConnection.execute_couch_dbinfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib.remote.remote_util.RemoteMachineShellConnection
的用法示例。
在下文中一共展示了RemoteMachineShellConnection.execute_couch_dbinfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from lib.remote.remote_util import RemoteMachineShellConnection [as 别名]
# 或者: from lib.remote.remote_util.RemoteMachineShellConnection import execute_couch_dbinfo [as 别名]
def run(self):
file_name = "%s-%s-couch-dbinfo.txt" % (self.server.ip, time_stamp())
if not self.local:
from lib.remote.remote_util import RemoteMachineShellConnection
remote_client = RemoteMachineShellConnection(self.server)
print "Collecting dbinfo from %s\n" % self.server.ip
output, error = remote_client.execute_couch_dbinfo(file_name)
print "\n".join(output)
print "\n".join(error)
user_path = "/home/"
if remote_client.info.distribution_type.lower() == "mac":
user_path = "/Users/"
else:
if self.server.ssh_username == "root":
user_path = "/"
remote_path = "%s%s" % (user_path, self.server.ssh_username)
status = remote_client.file_exists(remote_path, file_name)
if not status:
raise Exception("%s doesn't exists on server" % file_name)
status = remote_client.get_file(remote_path, file_name, "%s/%s" % (self.path, file_name))
if status:
print "Downloading dbinfo logs from %s" % self.server.ip
else:
raise Exception("Fail to download db logs from %s" % self.server.ip)
remote_client.execute_command("rm -f %s" % os.path.join(remote_path, file_name))
remote_client.disconnect()