helpers.py 文件源码

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

项目:integration 作者: mendersoftware 项目源码 文件源码
def verify_reboot_performed(self, max_wait=60*30):
        logger.info("waiting for system to reboot")

        successful_connections = 0
        timeout = time.time() + max_wait

        while time.time() <= timeout:
            try:
                with settings(warn_only=True, abort_exception=FabricFatalException):
                    time.sleep(1)
                    if exists(self.tfile):
                        logger.debug("temp. file still exists, device hasn't rebooted.")
                        continue
                    else:
                        logger.debug("temp. file no longer exists, device has rebooted.")
                        successful_connections += 1

                    # try connecting 10 times before returning
                    if successful_connections <= 9:
                        continue
                    return

            except (BaseException):
                logger.debug("system exit was caught, this is probably because SSH connectivity is broken while the system is rebooting")
                continue

        if time.time() > timeout:
            pytest.fail("Device never rebooted!")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号