def ensure_connectable(self, nailgun):
    'Ensures that a nailgun client is connectable or raises NailgunError.'
    attempt_count = 1
    while 1:
        try:
            with closing(nailgun.try_connect()) as sock:
                logger.debug('Verified new ng server is connectable at {}'.format(sock.getpeername()))
                return
        except nailgun.NailgunConnectionError:
            if (attempt_count >= self._connect_attempts):
                logger.debug('Failed to connect to ng after {} attempts'.format(self._connect_attempts))
                raise
        attempt_count += 1
        time.sleep(self.WAIT_INTERVAL_SEC)
Ensures that a nailgun client is connectable or raises NailgunError.
def ensure_connectable(self, nailgun):
    
    attempt_count = 1
    while 1:
        try:
            with closing(nailgun.try_connect()) as sock:
                logger.debug('Verified new ng server is connectable at {}'.format(sock.getpeername()))
                return
        except nailgun.NailgunConnectionError:
            if (attempt_count >= self._connect_attempts):
                logger.debug('Failed to connect to ng after {} attempts'.format(self._connect_attempts))
                raise
        attempt_count += 1
        time.sleep(self.WAIT_INTERVAL_SEC)