Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/web_infrastructure/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/web_infrastructure/taiga_issue.pyc

�
�Udac@`s)ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlmZdd
l
mZddlmZmZddlmZdZy*ddlmZddlmZeZWn#ek
r�e
j�ZeZnXed�Zd�Z e!dkr%e �ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys2
---
module: taiga_issue
short_description: Creates/deletes an issue in a Taiga Project Management Platform
description:
  - Creates/deletes an issue in a Taiga Project Management Platform (U(https://taiga.io)).
  - An issue is identified by the combination of project, issue subject and issue type.
  - This module implements the creation or deletion of issues (not the update).
version_added: "2.0"
options:
  taiga_host:
    description:
      - The hostname of the Taiga instance.
    default: https://api.taiga.io
  project:
    description:
      - Name of the project containing the issue. Must exist previously.
    required: True
  subject:
    description:
      - The issue subject.
    required: True
  issue_type:
    description:
      - The issue type. Must exist previously.
    required: True
  priority:
    description:
      - The issue priority. Must exist previously.
    default: Normal
  status:
    description:
      - The issue status. Must exist previously.
    default: New
  severity:
    description:
      - The issue severity. Must exist previously.
    default: Normal
  description:
    description:
      - The issue description.
    default: ""
  attachment:
    description:
      - Path to a file to be attached to the issue.
  attachment_description:
    description:
      - A string describing the file to be attached to the issue.
    default: ""
  tags:
    description:
      - A lists of tags to be assigned to the issue.
    default: []
  state:
    description:
      - Whether the issue should be present or not.
    choices: ["present", "absent"]
    default: present
author: Alejandro Guirao (@lekum)
requirements: [python-taiga]
notes:
- The authentication is achieved either by the environment variable TAIGA_TOKEN or by the pair of environment variables TAIGA_USERNAME and TAIGA_PASSWORD
s�
# Create an issue in the my hosted Taiga environment and attach an error log
- taiga_issue:
    taiga_host: https://mytaigahost.example.com
    project: myproject
    subject: An error has been found
    issue_type: Bug
    priority: High
    status: New
    severity: Important
    description: An error has been found. Please check the attached error log for details.
    attachment: /path/to/error.log
    attachment_description: Error log file
    tags:
      - Error
      - Needs manual check
    state: present

# Deletes the previously created issue
- taiga_issue:
    taiga_host: https://mytaigahost.example.com
    project: myproject
    subject: An error has been found
    issue_type: Bug
    state: absent
s# N(tgetenv(tisfile(t
AnsibleModuletmissing_required_lib(t	to_native(tTaigaAPI(tTaigaExceptionc$
`s%t}y�td�}|r3td|d|�}n_td|�}td�}td�}t||g�s|t|difS|jd|d|�|j�j}t�fd	�|jj	d
|��}t
|�dkr�t|d�ifS|d
}|j}t�fd�|jj	d|��}t
|�dkrTt|d��fifS|d
j}t�fd�|jj	d|��}t
|�dkr�t|d��fifS|d
j}t�fd�|j
��}t
|�dkrt|d��fifS|d
j�t�fd�|j��}t
|�dkrbt|d��fifS|d
j}i�d6�d6�d6�d6�d6�d6|d6|d6}t��fd�|j��}t
|�} | d
kr{|dkrht}|
sX|j�||�|d|d|�}!|	rX|!j|	d|
�|	|d <|
|d!<qXnt|d"|fSt|d#ifSnr| dkr�|d$kr�t}|
s�|d
j�nt|d%ifSt|d&ifSnt|d'��fifSWn0tk
r }"d(t|"�}#t||#ifSXd)S(*s�
    Method that creates/deletes issues depending whether they exist and the state desired

    The credentials should be passed via environment variables:
        - TAIGA_TOKEN
        - TAIGA_USERNAME and TAIGA_PASSWORD

    Returns a tuple with these elements:
        - A boolean representing the success of the operation
        - A descriptive message
        - A dict with the issue attributes, in case of issue creation, otherwise empty dict
    tTAIGA_TOKENthostttokentTAIGA_USERNAMEtTAIGA_PASSWORDsMissing credentialstusernametpasswordc`s
|j�kS(N(tname(tx(tproject_name(sR/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/taiga_issue.pyt<lambda>�stmemberisUnable to find project %sic`s
|j�kS(N(R(R(tissue_priority(sR/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/taiga_issue.pyR�stprojects/Unable to find issue priority %s for project %sc`s
|j�kS(N(R(R(tissue_status(sR/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/taiga_issue.pyR�ss-Unable to find issue status %s for project %sc`s
|j�kS(N(R(R(t
issue_type(sR/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/taiga_issue.pyR�ss+Unable to find issue type %s for project %sc`s
|j�kS(N(R(R(tissue_severity(sR/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/taiga_issue.pyR�ss)Unable to find severity %s for project %stsubjecttpriorityRttypetseveritytdescriptionttagsc`s|j�ko|j�kS(N(R R"(R(t
issue_subjectttype_id(sR/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/taiga_issue.pyR�stpresentt
attachmenttattachment_descriptions
Issue createdsIssue does not existtabsents
Issue deletedsIssue already existss1More than one issue with subject %s in project %ssAn exception happened: %sN(tFalseRR
tanytauthtmetidtfiltertprojectstlisttlent
prioritiestissue_statusestlist_issue_typestlist_severitiestlist_issuestTruet	add_issuetattachtdeleteRR($tmodulet
taiga_hostRR&RRRRtissue_descriptiontissue_attachmenttissue_attachment_descriptiont
issue_tagststatet
check_modetchangedRtapiRRtuser_idtproject_listRt
project_idt
priority_listtpriority_idtstatus_listt	status_idt	type_listt
severity_listtseverity_idtissuetmatching_issue_listtmatching_issue_list_lent	new_issuetexctmsg((RRRR&RRR'sR/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/taiga_issue.pytmanage_issue}s�'
	'
'



!'
c!C`s�tdtdtdtdd�dtdt�dtdt�dtdt�d	tdtdd
�dtdtdd�d
tdtdd
�dtdtdd�dtdtdd�dtdtdd�dtdtdgdd�dtdtdddgdd��dt�}ts9|jdtd�dt�n|j	d}|j	d}|j	d}|j	d	}|j	d}|j	d}|j	d
}|j	d}|j	d}	|j	d}
|	r�t
|	�s�d|	}|jd|�q�n|j	d}|j	d}
t||||||||||	|
||
d|j�
\}}}}|r�t
|�dkr�|jd |d|d!|�q�|jd |d|�n|jd|�dS("Nt
argument_specR?trequiredtdefaultshttps://api.taiga.ioRR RR!tNormalRtNewR#R$tR)R*R%R"R3RDtchoicesR(R+tsupports_check_modeRWspython-taigat	exceptions%s is not a fileREiRFRR(R
tdictR,R:tNonetTAIGA_MODULE_IMPORTEDt	fail_jsonRt
TAIGA_IMP_ERRtparamsR	RXRER4t	exit_json(R>R?RR&RRRRR@RARBRWRCRDt
return_statusRFtissue_attr_dict((sR/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/taiga_issue.pytmain�sn	













t__main__("t
__future__RRRR"t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNt	tracebacktosRtos.pathR	tansible.module_utils.basicR
Rtansible.module_utils._textRRcRfttaigaR
ttaiga.exceptionsRR:RdtImportErrort
format_excR,RXRkt__name__(((sR/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/taiga_issue.pyt<module>s0


A


o	B

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]