%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //lib/python2.7/site-packages/salt/modules/jira_mod.pyo

�
���^c@@sQdZddlmZmZmZddlZeje�Zyddl	m
Z
Wn!ek
rtddlm
Z
nXyddl
Z
eZWnek
r�eZnXdZdgZdad�Zdddd�Zdddd	�Zd
ddddd
dddddd�Zdddd�Zdedddd�Zdddd�ZdS(uG
JIRA Execution module
=====================

.. versionadded:: 2019.2.0

Execution module to manipulate JIRA tickets via Salt.

This module requires the ``jira`` Python library to be installed.

Configuration example:

.. code-block:: yaml

  jira:
    server: https://jira.atlassian.org
    username: salt
    password: pass
i(tabsolute_importtunicode_literalstprint_functionN(tclean_kwargsujirau*cC@str
tStdfS(Nu/Please install the jira Python libary from PyPI(tHAS_JIRAt__virtualname__tFalse(((s9/usr/lib/python2.7/site-packages/salt/modules/jira_mod.pyt__virtual__.scC@sktdddi�}|s.|jd�}n|sF|jd�}n|s^|jd�}n|||fS(uN
    Returns the credentials merged with the config data (opts + pillar).
    uconfig.mergeujiratdefaultuserveruusernameupassword(t__salt__tget(tservertusernametpasswordtjira_cfg((s9/usr/lib/python2.7/site-packages/salt/modules/jira_mod.pyt_get_credentials2scC@sUtsQtd|d|d|�\}}}tjd||fd|dt�antS(NRRR
t
basic_authtlogging(tJIRARtjiratTrue(RRR
((s9/usr/lib/python2.7/site-packages/salt/modules/jira_mod.pyt	_get_jiraBsujinjaubaseuBuguNormalc
K@s|rYtd|d|d|d|d|�}td|d|d|d|d|�}ntd|d|d|
�}|	s�g}	nii|d	6d
6|d6|d6i|d
6d6i|d
6d6|	d6}|jt|��|j|�}t|�}|
rt||
�n|S(u�
    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:

    .. code-block:: bash

        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
    ufile.apply_template_on_contentsttemplatetcontexttdefaultstsaltenvRRR
ukeyuprojectusummaryudescriptionunameu	issuetypeupriorityulabels(R	RtupdateRtcreate_issuetstrtassign_issue(tprojecttsummarytdescriptionttemplate_engineRRRt	issuetypetprioritytlabelstassigneeRRR
tkwargstjira_tdatatissuet	issue_key((s9/usr/lib/python2.7/site-packages/salt/modules/jira_mod.pyRPs@D
	
		
cC@s1td|d|d|�}|j||�}|S(u=
    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
    RRR
(RR(R*R%RRR
R'tassigned((s9/usr/lib/python2.7/site-packages/salt/modules/jira_mod.pyR�s
	c	C@s=td|d|d|�}|j||d|d|�}tS(u�
    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:

    .. code-block:: bash

        salt '*' jira.add_comment NE-123 'This is a comment'
    RRR
t
visibilitytis_internal(Rtadd_commentR(	R*tcommentR,R-RRR
R'tcomm((s9/usr/lib/python2.7/site-packages/salt/modules/jira_mod.pyR.�s"			cC@si|s
dStd|d|d|�}y|j|�}Wntjjk
rRdSX|j�jjdkS(uf
    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:

    .. code-block:: bash

        salt '*' jira.issue_closed NE-123
    RRR
uClosedN(	tNoneRR)Rt
exceptionst	JIRAErrortfieldststatustname(R*RRR
R'tticket((s9/usr/lib/python2.7/site-packages/salt/modules/jira_mod.pytissue_closeds	(t__doc__t
__future__RRRRt	getLoggert__name__tlogt
salt.utilsRtImportErrortsalt.utils.argsRRRRRt__proxyenabled__R1RRRRRRR.R8(((s9/usr/lib/python2.7/site-packages/salt/modules/jira_mod.pyt<module>sX



		_'

Zerion Mini Shell 1.0