当前位置: 首页>>代码示例>>Python>>正文


Python Glusto.run_local方法代码示例

本文整理汇总了Python中glusto.core.Glusto.run_local方法的典型用法代码示例。如果您正苦于以下问题:Python Glusto.run_local方法的具体用法?Python Glusto.run_local怎么用?Python Glusto.run_local使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在glusto.core.Glusto的用法示例。


在下文中一共展示了Glusto.run_local方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_download

# 需要导入模块: from glusto.core import Glusto [as 别名]
# 或者: from glusto.core.Glusto import run_local [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')
开发者ID:mbukatov,项目名称:glusto,代码行数:30,代码来源:test_glusto_ssh.py

示例2: test_run_local

# 需要导入模块: from glusto.core import Glusto [as 别名]
# 或者: from glusto.core.Glusto import run_local [as 别名]
 def test_run_local(self):
     """Testing SSH run_local() method"""
     print "Running: %s - %s" % (self.id(), self.shortDescription())
     rcode, rout, rerr = g.run_local('echo -n %s' % self.test_string)
     self.assertEqual(rcode, 0)
     self.assertEqual(rout, self.test_string)
     print rout
     self.assertEqual(rerr, '')
开发者ID:mbukatov,项目名称:glusto,代码行数:10,代码来源:test_glusto_ssh.py

示例3: test_upload

# 需要导入模块: from glusto.core import Glusto [as 别名]
# 或者: from glusto.core.Glusto import run_local [as 别名]
 def test_upload(self):
     """Testing SSH upload() method"""
     print "Running: %s - %s" % (self.id(), self.shortDescription())
     g.run(self.primary_host, 'rm -f /tmp/upload_test_file')
     rcode, rout, _ = g.run_local('md5sum /etc/hosts | awk \'{print $1}\'')
     if rcode == 0:
         md5sum = rout.strip()
     g.upload(self.primary_host,
              '/etc/hosts', '/tmp/upload_test_file')
     command = 'md5sum /tmp/upload_test_file | awk \'{print $1}\''
     rcode,  rout, _ = g.run(self.primary_host, command)
     if rcode == 0:
         md5sum_up = rout.strip()
     self.assertEqual(md5sum, md5sum_up, '')
开发者ID:mbukatov,项目名称:glusto,代码行数:16,代码来源:test_glusto_ssh.py


注:本文中的glusto.core.Glusto.run_local方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。