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


Python SSHManager.isfile_on_remote方法代码示例

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


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

示例1: store_astute_yaml_for_one_node

# 需要导入模块: from fuelweb_test.helpers.ssh_manager import SSHManager [as 别名]
# 或者: from fuelweb_test.helpers.ssh_manager.SSHManager import isfile_on_remote [as 别名]
    def store_astute_yaml_for_one_node(nailgun_node):
        ssh_manager = SSHManager()
        if 'roles' not in nailgun_node:
            return None
        errmsg = 'Downloading "{0}.yaml" from the {1} failed'
        msg = 'File "{0}.yaml" was downloaded from the {1}'
        nodename = nailgun_node['name']
        ip = nailgun_node['ip']
        for role in nailgun_node['roles']:
            filename = '{0}/{1}-{2}-{3}.yaml'.format(settings.LOGS_DIR,
                                                     func_name,
                                                     nodename,
                                                     role)

            if not ssh_manager.isfile_on_remote(ip,
                                                '/etc/{0}.yaml'.format(role)):
                role = 'primary-' + role
            if ssh_manager.download_from_remote(ip,
                                                '/etc/{0}.yaml'.format(role),
                                                filename):
                logger.info(msg.format(role, nodename))
            else:
                logger.error(errmsg.format(role, nodename))
        if settings.DOWNLOAD_FACTS:
            fact_filename = re.sub(r'-\w*\.', '-facts.', filename)
            generate_facts(ip)
            if ssh_manager.download_from_remote(ip,
                                                '/tmp/facts.yaml',
                                                fact_filename):
                logger.info(msg.format('facts', nodename))
            else:
                logger.error(errmsg.format('facts', nodename))
开发者ID:avgoor,项目名称:fuel-qa,代码行数:34,代码来源:utils.py

示例2: get_puppet_report

# 需要导入模块: from fuelweb_test.helpers.ssh_manager import SSHManager [as 别名]
# 或者: from fuelweb_test.helpers.ssh_manager.SSHManager import isfile_on_remote [as 别名]
    def get_puppet_report(node):
        """Get puppet run report from corresponding node

        :param node: a dictionary with node description
        :return: a dictionary with puppet report data
        """
        ssh = SSHManager()
        ip = node['ip']
        report_file = "/var/lib/puppet/state/last_run_report.yaml"
        asserts.assert_true(ssh.isfile_on_remote(ip, report_file),
                            'File {!r} not found on node {!r}'
                            .format(report_file, node['id']))
        with ssh.open_on_remote(ip, report_file) as f:
            data = yaml.load(f)
        ssh.rm_rf_on_remote(ip, report_file)
        return data
开发者ID:avgoor,项目名称:fuel-qa,代码行数:18,代码来源:base_lcm_test.py


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