Ejemplo n.º 1
0
    def is_bug_open(cls, bug_id):
        """Checks whether the Launchpad bug for the given bug id is open.
        An issue is considered open if its status is either "Fix Committed"
        or "Fix Released". An issue is also open if none of its tags are in
        the closed_tags list in the config file.
        """
        config = LaunchpadTrackerConfig()
        log = logging.getLogger('RunnerLog')
        launchpad = LaunchpadClient()

        # check the bug's tags
        if config.closed_tags is not None:
            bug_resp = launchpad.get_bug_by_id(bug_id)
            cls._log_if_not_found(log, bug_resp, bug_id)

            tags = bug_resp.model.tags if bug_resp.model else None
            if cls._bug_tags_are_open(tags, config):
                return True

        # check the bug's status
        if config.use_status:
            tasks_resp = launchpad.get_bug_tasks(bug_id)
            cls._log_if_not_found(log, tasks_resp, bug_id)

            tasks = tasks_resp.model or []
            if cls._bug_status_is_open(tasks, config):
                return True

        log.info('Bug does not affect project {0} '
                 'or project name is not correct.'.format(config.project))
        return False
Ejemplo n.º 2
0
    def is_bug_open(cls, bug_id):
        """Checks whether the Launchpad bug for the given bug id is open.
        An issue is considered open if its status is either "Fix Committed"
        or "Fix Released". An issue is also open if none of its tags are in
        the closed_tags list in the config file.
        """
        config = LaunchpadTrackerConfig()
        log = logging.getLogger('RunnerLog')
        launchpad = LaunchpadClient()

        # check the bug's tags
        if config.closed_tags is not None:
            bug_resp = launchpad.get_bug_by_id(bug_id)
            cls._log_if_not_found(log, bug_resp, bug_id)

            tags = bug_resp.model.tags if bug_resp.model else None
            if cls._bug_tags_are_open(tags, config):
                return True

        # check the bug's status
        if config.use_status:
            tasks_resp = launchpad.get_bug_tasks(bug_id)
            cls._log_if_not_found(log, tasks_resp, bug_id)

            tasks = tasks_resp.model or []
            if cls._bug_status_is_open(tasks, config):
                return True

        log.info('Bug does not affect project {0} '
                 'or project name is not correct.'.format(config.project))
        return False
Ejemplo n.º 3
0
    def is_bug_open(cls, bug_id):
        """Checks whether the Launchpad bug for the given bug id is open.
        An issue is considered open if its status is either "Fix Committed"
        or "Fix Released."
        """
        config = LaunchpadTrackerConfig()
        log = logging.getLogger('RunnerLog')
        launchpad = LaunchpadClient()

        resp = launchpad.get_bug_tasks(bug_id)
        if resp.status_code == 404:
            log.info('Couldn\'t find bug with ID {0}'.format(bug_id))

        tasks = resp.model or []
        for bug_task in tasks:
            if bug_task.bug_target_name == config.project:
                return bug_task.status not in ('Fix Committed', 'Fix Released')

        log.info('Bug does not affect project {0} '
                 'or project name is not correct.'.format(config.project))
        return False
Ejemplo n.º 4
0
def _get_lp():
    from lplight.client import LaunchpadClient
    import lplight.client

    web_session = get_file_cache("launchpad")
    lplight.client.requests = web_session

    global _lp_client

    if _lp_client is None:
        _lp_client = LaunchpadClient()
    return _lp_client
Ejemplo n.º 5
0
    def is_bug_open(cls, bug_id):
        """Checks whether the Launchpad bug for the given bug id is open.
        An issue is considered open if its status is either "Fix Committed"
        or "Fix Released."
        """
        config = LaunchpadTrackerConfig()
        log = logging.getLogger('RunnerLog')
        launchpad = LaunchpadClient()

        resp = launchpad.get_bug_tasks(bug_id)
        if resp.status_code == 404:
            log.info('Couldn\'t find bug with ID {0}'.format(bug_id))

        tasks = resp.model or []
        for bug_task in tasks:
            if bug_task.bug_target_name == config.project:
                return bug_task.status not in ('Fix Committed', 'Fix Released')

        log.info('Bug does not affect project {0} '
                 'or project name is not correct.'.format(config.project))
        return False