�
�Udac @` s� d d l m Z m Z m Z e Z i d d 6d g d 6d d 6Z d Z d Z d d
l m
Z
m Z m Z y/ d d l
Z
d d l j Z d d l m Z Wn e k
r� n Xd
� Z e d k r� e � n d S( i ( t absolute_importt divisiont print_functions 1.1t metadata_versiont previewt statust communityt supported_bys�
---
module: tower_label
author: "Wayne Witzel III (@wwitzel3)"
version_added: "2.3"
short_description: create, update, or destroy Ansible Tower label.
description:
- Create, update, or destroy Ansible Tower labels. See
U(https://www.ansible.com/tower) for an overview.
options:
name:
description:
- Name to use for the label.
required: True
organization:
description:
- Organization the label should be applied to.
required: True
state:
description:
- Desired state of the resource.
default: "present"
choices: ["present", "absent"]
extends_documentation_fragment: tower
s�
- name: Add label to tower organization
tower_label:
name: Custom Label
organization: My Organization
state: present
tower_config_file: "~/tower_cli.cfg"
( t TowerModulet tower_auth_configt tower_check_modeN( t settingsc C` s t d t d t � d t d t � d t d d d g d d � � } t d | d
t � } | j j d � } | j j d � } | j j d � } i | d 6| d 6} t | � } t j | � �.t | � t j
d � } y� t j
d � } | j d | � } | d k r9| j d | d | d d
t � }
|
d | d <n+ | d k rd| j d | d | d � }
n Wn~ t
j k
r�} | j d d j | � d t � nJ t
j t
j t
j t
j f k
r�} | j d d j | � d t � n XWd QX|
d | d <| j | � d S( Nt namet requiredt organizationt statet choicest presentt absentt defaultt
argument_spect supports_check_modet labelt idt create_on_missingt msgs3 Failed to update label, organization not found: {0}t changeds Failed to update label: {0}( t dictt TrueR t paramst getR R t runtime_valuesR
t tower_clit get_resourcet modifyt deletet exct NotFoundt fail_jsont formatt Falset ConnectionErrort
BadRequestt AuthErrort exit_json( R t moduleR R R t json_outputt
tower_authR t org_rest orgt resultt excinfo( ( s` /usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/ansible_tower/tower_label.pyt main? s6
"#"')t __main__( t
__future__R R R t typet
__metaclass__t ANSIBLE_METADATAt
DOCUMENTATIONt EXAMPLESt"