本文整理汇总了Python中glusto.core.Glusto.download方法的典型用法代码示例。如果您正苦于以下问题:Python Glusto.download方法的具体用法?Python Glusto.download怎么用?Python Glusto.download使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类glusto.core.Glusto
的用法示例。
在下文中一共展示了Glusto.download方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_download
# 需要导入模块: from glusto.core import Glusto [as 别名]
# 或者: from glusto.core.Glusto import download [as 别名]
def test_download(self):
"""Testing SSH download() method"""
print "Running: %s - %s" % (self.id(), self.shortDescription())
remote_file = '/etc/hosts'
local_file = '/tmp/download_test_file'
# remove local test file (ignore error if not exist)
g.run_local('rm -f %s' % local_file)
# md5sum remote file
command = 'md5sum %s| awk \'{print $1}\'' % remote_file
rcode, rout, _ = g.run(self.primary_host, command)
if rcode == 0:
md5sum_up = rout.strip()
# download it
g.download(self.primary_host,
'/etc/hosts', '/tmp/download_test_file')
# md5sum local copy
command = 'md5sum %s | awk \'{print $1}\'' % local_file
rcode, rout, _ = g.run_local(command)
if rcode == 0:
md5sum_down = rout.strip()
# compare the md5sums
self.assertEqual(md5sum_down, md5sum_up, 'md5sums do not match')