Esempio n. 1
0
 def __init__(self, args, repo=None, auth=None):
     logger.debug("__init__ args:%s repo:%s", args, repo)
     self.args = args
     if (repo is None):
         self.__repo_owner, self.__repo = None, None
     else:
         self.repo_owner, self.repo_name = repo
     if (auth is None):
         self.__user, self.__password = None, None
     else:
         self.__user, self.__password = auth
     idli.set_status_mapping(bitbucket_status_mapping)
Esempio n. 2
0
 def __init__(self, args, repo=None, auth=None):
     logger.debug("__init__ args:%s repo:%s", args, repo)
     self.args = args
     if (repo is None):
         self.__repo_owner, self.__repo = None, None
     else:
         self.repo_owner, self.repo_name = repo
     if (auth is None):
         self.__user, self.__password = None, None
     else:
         self.__user, self.__password = auth
     idli.set_status_mapping(bitbucket_status_mapping)
Esempio n. 3
0
    def __get_statuses(self):
        try: #If we are properly configured, try to get statuses
            self.token()
        except cfg.IdliMissingConfigException:
            pass

        try:
            if float(cfg.get_config_value(self.config_section, "last_status_list_time")) + self.STATUS_CHECK_INTERVAL > time.time():
                idli.set_status_mapping(json.loads(cfg.get_config_value(self.config_section, "last_status_list")))
                return
        except cfg.IdliMissingConfigException:
            pass
        try:
            result = json.loads(self.__url_request("/issue_statuses.json"))
            statuses_list = result['issue_statuses']
            statuses = {}
            for s in statuses_list:
                statuses[s['name'].lower()] = not ('is_closed' in s and s['is_closed'])
            cfg.set_config_value(self.config_section, "last_status_list", json.dumps(statuses), global_val=False)
            cfg.set_config_value(self.config_section, "last_status_list_time", str(time.time()))
            idli.set_status_mapping(statuses)
        except HttpRequestException as e:
            mapping = { 'New' : True, 'Closed' : False, 'In Progress' : True, 'Rejected' : False, 'Resolved' : False, 'Feedback' : True }
            cfg.set_config_value(self.config_section, "last_status_list", json.dumps(mapping), global_val=False)
            cfg.set_config_value(self.config_section, "last_status_list_time", float(time.time()), global_val=False)
            idli.set_status_mapping(mapping)
        except cfg.IdliMissingConfigException:
            pass