Exemplo n.º 1
0
def create_component_update_issue(jira_host, username, password, project_key,
                                  summary, component_name):
    """
    Creates upstream JIRA issue for the component update

    jira_host -- host address of the JIRA instance to connect to.
    username -- JIRA username with administration permissions.
    password -- JIRA user password.
    project_key -- upstream project key.
    summary -- description of the new issue.
    component_name -- name of the component to be assigned to the issue.
    """
    issue_type = jira_helper.get_issue_type_by_name(jira_host,
                                                    'Component Upgrade')
    component = jira_helper.get_component_by_name(jira_host, project_key,
                                                  component_name)
    body = json.dumps({
        'fields': {
            'project': {
                'key': project_key
            },
            'summary': summary,
            'issuetype': {
                'id': issue_type['id']
            },
            'assignee': {
                'name': username
            },
            'components': [{
                'id': component['id']
            }]
        }
    })
    issue = jira_helper.create_issue(jira_host, username, password, body)
    logging.info(
        'Created component upgrade issue: https://{0}/browse/{1}'.format(
            jira_host, issue['key']))
Exemplo n.º 2
0
def create_component_update_issue(jira_host, username, password, project_key, summary, component_name):
    """
    Creates upstream JIRA issue for the component update

    jira_host -- host address of the JIRA instance to connect to.
    username -- JIRA username with administration permissions.
    password -- JIRA user password.
    project_key -- upstream project key.
    summary -- description of the new issue.
    component_name -- name of the component to be assigned to the issue.
    """
    issue_type = jira_helper.get_issue_type_by_name(jira_host, 'Component Upgrade')
    component = jira_helper.get_component_by_name(jira_host, project_key, component_name)
    body = json.dumps({
        'fields': {
            'project': {'key': project_key},
            'summary': summary,
            'issuetype': {'id': issue_type['id']},
            'assignee': {'name': username},
            'components': [{'id': component['id']}]
        }
    })
    issue = jira_helper.create_issue(jira_host, username, password, body)
    logging.info('Created component upgrade issue: https://{0}/browse/{1}'.format(jira_host, issue['key']))