

def setup(self):
    self._jira_url = self._config['url']
    rsa_cert_file = self._config['rsa_cert_file']
    if (not os.path.exists(rsa_cert_file)):
        raise Exception(('Cert file for JIRA OAuth not found at %s.' % rsa_cert_file))
    self._rsa_key = self._read_cert(rsa_cert_file)
    self._poll_interval = self._config.get('poll_interval', self._poll_interval)
    oauth_creds = {
        'access_token': self._config['oauth_token'],
        'access_token_secret': self._config['oauth_secret'],
        'consumer_key': self._config['consumer_key'],
        'key_cert': self._rsa_key,
    }
    self._jira_client = JIRA(options={
        'server': self._jira_url,
    }, oauth=oauth_creds)
    if (self._projects_available is None):
        issue._projects_available = set()
        for proj in self._jira_client.projects():
            self._projects_available.add(proj.key)
    self._project = self._config.get('project', None)
    if ((not self._project) or (self._project not in self._projects_available)):
        raise Exception(('Invalid project (%s) to track.' % self._project))
    self._jql_query = ('project=%s' % self._project)
    all_issues = self._jira_client.search_issues(self._jql_query, maxResults=None)
    self._issues_in_project = {issue.key: issue for issue in all_issues}

dataset/ETHPy150Open StackStorm/st2contrib/packs/jira/sensors/jira_sensor.py JIRASensor.setup/VarMisuse@162/283 `self`->`issue`