本文整理匯總了Python中glusto.core.Glusto.transfer方法的典型用法代碼示例。如果您正苦於以下問題:Python Glusto.transfer方法的具體用法?Python Glusto.transfer怎麽用?Python Glusto.transfer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類glusto.core.Glusto
的用法示例。
在下文中一共展示了Glusto.transfer方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_transfer
# 需要導入模塊: from glusto.core import Glusto [as 別名]
# 或者: from glusto.core.Glusto import transfer [as 別名]
def test_transfer(self):
"""Testing SSH transfer() method"""
print "Running: %s - %s" % (self.id(), self.shortDescription())
remote_file = '/etc/hosts'
remote_file_copy = '/tmp/transfer_test_file'
host1 = self.hosts[0]
host2 = self.hosts[1]
# remove remote test file copy(ignore error if not exist)
g.run(host2, 'rm -f %s' % remote_file_copy)
# md5sum remote file
command = 'md5sum %s| awk \'{print $1}\'' % remote_file
rcode, rout, _ = g.run(self.primary_host, command)
if rcode == 0:
md5sum_orig = rout.strip()
# transfer it
g.transfer(host1, remote_file, host2, remote_file_copy)
# md5sum remote file copy
command = 'md5sum %s | awk \'{print $1}\'' % remote_file_copy
rcode, rout, _ = g.run(host2, command)
if rcode == 0:
md5sum_copy = rout.strip()
# compare the md5sums
self.assertEqual(md5sum_orig, md5sum_copy, 'md5sums do not match')