salt.modules.jira_mod

JIRA Execution module

New in version 2019.2.0.

Execution module to manipulate JIRA tickets via Salt.

This module requires the jira Python library to be installed.

Configuration example:

jira:
  server: https://jira.atlassian.org
  username: salt
  password: pass
salt.modules.jira_mod.add_comment(issue_key, comment, visibility=None, is_internal=False, server=None, username=None, password=None)

Add a comment to an existing ticket. Return True when it successfully added the comment.

issue_key

The issue ID to add the comment to.

comment

The body of the comment to be added.

visibility: None

A dictionary having two keys:

  • type: is role (or group if the JIRA server has configured comment visibility for groups).

  • value: the name of the role (or group) to which viewing of this comment will be restricted.

is_internal: False

Whether a comment has to be marked as Internal in Jira Service Desk.

CLI Example:

salt '*' jira.add_comment NE-123 'This is a comment'
salt.modules.jira_mod.assign_issue(issue_key, assignee, server=None, username=None, password=None)

Assign the issue to an existing user. Return True when the issue has been properly assigned.

issue_key

The JIRA ID of the ticket to manipulate.

assignee

The name of the user to assign the ticket to.

CLI Example:

salt '*' jira.assign_issue NET-123 example_user
salt.modules.jira_mod.create_issue(project, summary, description, template_engine='jinja', context=None, defaults=None, saltenv='base', issuetype='Bug', priority='Normal', labels=None, assignee=None, server=None, username=None, password=None, **kwargs)

Create a JIRA issue using the named settings. Return the JIRA ticket ID.

project

The name of the project to attach the JIRA ticket to.

summary

The summary (title) of the JIRA ticket. When the template_engine argument is set to a proper value of an existing Salt template engine (e.g., jinja, mako, etc.) it will render the summary before creating the ticket.

description

The full body description of the JIRA ticket. When the template_engine argument is set to a proper value of an existing Salt template engine (e.g., jinja, mako, etc.) it will render the description before creating the ticket.

template_engine: jinja

The name of the template engine to be used to render the values of the summary and description arguments. Default: jinja.

context: None

The context to pass when rendering the summary and description. This argument is ignored when template_engine is set as None

defaults: None

Default values to pass to the Salt rendering pipeline for the summary and description arguments. This argument is ignored when template_engine is set as None.

saltenv: base

The Salt environment name (for the rendering system).

issuetype: Bug

The type of the JIRA ticket. Default: Bug.

priority: Normal

The priority of the JIRA ticket. Default: Normal.

labels: None

A list of labels to add to the ticket.

assignee: None

The name of the person to assign the ticket to.

CLI Examples:

salt '*' jira.create_issue NET 'Ticket title' 'Ticket description'
salt '*' jira.create_issue NET 'Issue on {{ opts.id }}' 'Error detected on {{ opts.id }}' template_engine=jinja
salt.modules.jira_mod.issue_closed(issue_key, server=None, username=None, password=None)

Check if the issue is closed.

issue_key

The JIRA iD of the ticket to close.

Returns:

  • True: the ticket exists and it is closed.

  • False: the ticket exists and it has not been closed.

  • None: the ticket does not exist.

CLI Example:

salt '*' jira.issue_closed NE-123