remote_operations.py 文件源码

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

项目:intel-manager-for-lustre 作者: intel-hpdd 项目源码 文件源码
def host_contactable(self, address):
        try:
            # TODO: Better way to check this?
            result = self._ssh_address(
                address,
                "echo 'Checking if node is ready to receive commands.'",
                expected_return_code=None
            )

        except socket.error:
            logger.debug("Unknown socket error when checking %s" % address)
            return False
        except paramiko.AuthenticationException, e:
            logger.debug("Auth error when checking %s: %s" % (address, e))
            return False
        except paramiko.SSHException, e:
            logger.debug("General SSH error when checking %s: %s" % (address, e))
            return False
        except EOFError:
            logger.debug("Connection unexpectedly killed while checking %s" % address)
            return False

        if not result.rc == 0:
            # Wait, what?  echo returned !0?  How is that possible?
            logger.debug("exit status %d from echo on %s: inconceivable!" % (result.rc, address))
            return False

        return True
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号