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


Python SSH_utils.execute_remote_cmd_failed方法代码示例

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


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

示例1: check_nodes_info

# 需要导入模块: import SSH_utils [as 别名]
# 或者: from SSH_utils import execute_remote_cmd_failed [as 别名]
def check_nodes_info(utils,ssh,nodes_prefix,nodes_dir):

    x=0

    for ndprefix in nodes_prefix:

       output=SSH_utils.execute_remote_cmd_failed(utils,ssh,"ls -l /var/SandboxDir/%s/%s"%(ndprefix,nodes_dir[x]))

       if output.find("No such file or directory")==-1:
               utils.log_info("Command failed for some other reason. Expected reason 'No such file or directory'")
               raise GeneralError("Execute command ls -l /var/SandboxDir/%s/%s"%(ndprefix,nodes_dir[x]),"Command failed for some other reason. Expected reasaon 'No such file or directory'")

       x=x+1
开发者ID:italiangrid,项目名称:WMS-Test-Suite,代码行数:15,代码来源:purger.py

示例2: test8

# 需要导入模块: import SSH_utils [as 别名]
# 或者: from SSH_utils import execute_remote_cmd_failed [as 别名]
def test8(utils, ssh, title):

    utils.show_progress(title)
    utils.info(title)

    try:

        utils.set_dag_jdl(utils.get_jdl_file())

        utils.info("Submit a DAG job")

        JOBID = utils.run_command_continue_on_error(
            "glite-wms-job-submit %s --config %s --nomsg %s"
            % (utils.get_delegation_options(), utils.get_config_file(), utils.get_jdl_file())
        )

        utils.info("Job submitted successfuly. Returned JOBID: %s" % (JOBID))

        output = utils.run_command_continue_on_error(
            "glite-wms-job-status -c %s %s" % (utils.get_config_file(), JOBID)
        ).split("\n")

        nodes_prefix = []
        nodes_dir = []

        for line in output:

            if line.find("https://") != -1 and line.find(JOBID) == -1:

                id = line.split("Status info for the Job : ")[1]
                ndprefix = id.split("https://%s:9000/" % (utils.get_WMS()))[1][0:2]

                nodes_prefix.append(ndprefix)
                nodes_dir.append(SSH_utils.execute_remote_cmd(ssh, "ls /var/SandboxDir/%s" % (ndprefix)))

        prefix = JOBID.split("https://%s:9000/" % (utils.get_WMS()))[1][0:2]

        utils.info("Purge a DAG job")

        # WARNING EXECUTE COMMAND AS root INSTEAD OF glite USER
        utils.info("Execute '/usr/sbin/glite-wms-purgeStorage.sh -p /var/SandboxDir/%s -s' on remote host" % (prefix))

        output = SSH_utils.execute_remote_cmd(
            ssh, "/usr/sbin/glite-wms-purgeStorage.sh -p /var/SandboxDir/%s -s" % (prefix)
        )

        utils.info("Check glite-wms-purgeStorage.sh output")

        if output.find("%s: 3/3 nodes removed" % (JOBID)) != -1:
            utils.info("glite-wms-purgeStorage.sh successfully remove all the nodes of job %s" % (JOBID))
        else:
            utils.error("glite-wms-purgeStorage.sh didn't remove successfully all the nodes of job %s" % (JOBID))
            raise GeneralError(
                "Check glite-wms-purgeStorage.sh",
                "glite-wms-purgeStorage.sh didn't remove successfully all the nodes of job %s" % (JOBID),
            )

        if output.find("%s: removed" % (JOBID)) != -1:
            utils.info("glite-wms-purgeStorage.sh successfully remove the job %s" % (JOBID))
        else:
            utils.error("glite-wms-purgeStorage.sh didn't remove successfully the job %s" % (JOBID))
            raise GeneralError(
                "Check glite-wms-purgeStorage.sh",
                "glite-wms-purgeStorage.sh didn't remove successfully the job %s" % (JOBID),
            )

        utils.info("Check the SandBoxDir of nodes")

        x = 0

        for ndprefix in nodes_prefix:

            output = SSH_utils.execute_remote_cmd_failed(ssh, "ls -l /var/SandboxDir/%s/%s1" % (ndprefix, nodes_dir[x]))

            if output.find("No such file or directory") == -1:
                utils.error("Command failed for some other reason. Expected reasaon 'No such file or directory'")
                raise GeneralError(
                    "Execute command ls -l /var/SandboxDir/%s/%s" % (ndprefix, nodes_dir[x]),
                    "Command failed for some other reason. Expected reasaon 'No such file or directory'",
                )

            x = x + 1

        utils.info("Check job's final status")

        utils.job_status(JOBID)

        if utils.get_job_status().find("Cleared") != -1:
            utils.info("Job's final status after purge is Cleared")
        else:
            utils.error("Job's final status after purge is not Cleared , instead we get %s" % (utils.get_job_status()))
            raise GeneralError(
                "Check job final status after purge",
                "Job's final status after purge is not Cleared , instead we get %s" % (utils.get_job_status()),
            )

        utils.info("TEST OK")

    except (RunCommandError, GeneralError, TimeOutError), e:
        utils.log_error("%s" % (utils.get_current_test()))
#.........这里部分代码省略.........
开发者ID:sumo-tool,项目名称:WMS-Test-Suite,代码行数:103,代码来源:WMS-check-purger.py


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