本文整理汇总了Python中lib.remote.remote_util.RemoteMachineShellConnection.execute_cbtransfer方法的典型用法代码示例。如果您正苦于以下问题:Python RemoteMachineShellConnection.execute_cbtransfer方法的具体用法?Python RemoteMachineShellConnection.execute_cbtransfer怎么用?Python RemoteMachineShellConnection.execute_cbtransfer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib.remote.remote_util.RemoteMachineShellConnection
的用法示例。
在下文中一共展示了RemoteMachineShellConnection.execute_cbtransfer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_and_restore_csv
# 需要导入模块: from lib.remote.remote_util import RemoteMachineShellConnection [as 别名]
# 或者: from lib.remote.remote_util.RemoteMachineShellConnection import execute_cbtransfer [as 别名]
def create_and_restore_csv(self):
try:
self.__load_data()
shell_obj = RemoteMachineShellConnection(self.master)
self.log.info("Removing backup folder if already present")
info = shell_obj.extract_remote_info()
path = "/tmp/backup/"
if info.type.lower() == "windows":
path = "/cygdrive/c" + path
#TODO : Check for mac also
shell_obj.delete_files(path)
create_dir = "mkdir " + path
data_type = "csv:"
destination = path + "data.csv"
shell_obj.execute_command(create_dir)
source = "http://localhost:8091"
options = "-b default" + self.username_arg + self.password_arg
shell_obj.execute_cbtransfer(source, data_type + destination, options)
self.log.info("Created csv file @ %s" % destination)
source, destination = destination, source
options = "-B standard_bucket0" + self.username_arg + self.password_arg
self.log.info("Restoring data....!")
shell_obj.execute_cbtransfer(source, destination, options)
self.sleep(10)
self.log.info("Checking whether number of items loaded match with the number of items restored.")
rest = RestConnection(self.master)
itemCount = rest.get_bucket_json('standard_bucket0')['basicStats']['itemCount']
self.assertEqual(itemCount, self.num_items, msg="Number of items loaded do no match\
with the number of items restored. Number of items loaded is {0} \
but number of items restored is {1}".format(self.num_items, itemCount))
self.log.info("Number of items loaded = Number of items restored. Pass!!")
finally:
shell_obj.disconnect()