ssh.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:deb-python-hplefthandclient 作者: openstack 项目源码 文件源码
def was_command_successful(self, output):
        """
        Given the entire output of an SSH command, this will check to see if
        the result returned is 0, aka it was successful. If result is not 0,
        the command failed and we return False.

        :param output: The output string of an SSH command
        :type output: str

        :returns: True if the command was successful
        """
        output_string = ''.join(output)
        match = re.match('.*result\s+0', output_string)
        if not match:
            raise exceptions.SSHException(
                "The command did not execute successfully.")

        return True
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号