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/supervisorctl.pyo

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zdd
l	Z	ddl
mZmZd�Z
ed
kr�e
�nd
S(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bysi
---
module: supervisorctl
short_description: Manage the state of a program or group of programs running via supervisord
description:
     - Manage the state of a program or group of programs running via supervisord
version_added: "0.7"
options:
  name:
    description:
      - The name of the supervisord program or group to manage.
      - The name will be taken as group name when it ends with a colon I(:)
      - Group support is only available in Ansible version 1.6 or later.
    required: true
  config:
    description:
      - The supervisor configuration file path
    version_added: "1.3"
  server_url:
    description:
      - URL on which supervisord server is listening
    version_added: "1.3"
  username:
    description:
      - username to use for authentication
    version_added: "1.3"
  password:
    description:
      - password to use for authentication
    version_added: "1.3"
  state:
    description:
      - The desired state of program/group.
    required: true
    choices: [ "present", "started", "stopped", "restarted", "absent", "signalled" ]
  signal:
    description:
      - The signal to send to the program/group, when combined with the 'signalled' state. Required when l(state=signalled).
    version_added: "2.8"
  supervisorctl_path:
    description:
      - path to supervisorctl executable
    version_added: "1.4"
notes:
  - When C(state) = I(present), the module will call C(supervisorctl reread) then C(supervisorctl add) if the program/group does not exist.
  - When C(state) = I(restarted), the module will call C(supervisorctl update) then call C(supervisorctl restart).
  - When C(state) = I(absent), the module will call C(supervisorctl reread) then C(supervisorctl remove) to remove the target program/group.
requirements: [ "supervisorctl" ]
author:
    - "Matt Wright (@mattupstate)"
    - "Aaron Wang (@inetfuture) <[email protected]>"
s�
# Manage the state of program to be in 'started' state.
- supervisorctl:
    name: my_app
    state: started

# Manage the state of program group to be in 'started' state.
- supervisorctl:
    name: 'my_apps:'
    state: started

# Restart my_app, reading supervisorctl configuration from a specified file.
- supervisorctl:
    name: my_app
    state: restarted
    config: /var/opt/my_project/supervisord.conf

# Restart my_app, connecting to supervisord with credentials and server URL.
- supervisorctl:
    name: my_app
    state: restarted
    username: test
    password: testpass
    server_url: http://localhost:9001

# Send a signal to my_app via supervisorctl
- supervisorctl:
    name: my_app
    state: signalled
    signal: USR1
N(t
AnsibleModulet
is_executablec
`s�tdtdt�dtdtdd�dtdt�dtdt�dtdtd	t�d
tdtdd�dtdtdd
dddddg�dtdt��}td|dt���jd�t��jd�r�t��jd��n�jd��jjd�}�jjd�}�jjd�}�jjd�}�jjd
�}�jjd�}tdddddddd��_|r�t	j
j|�r�t|�r�|g�q��j
dd|�n�jdt�g�|r�jd|g�n|r+�jd |g�n|rG�jd!|g�n|rc�jd"|g�n�dkr�|r��j
dd#�nd��fd$�����fd%�}����fd&�}�dkr?�d'd(t�\}	}
}|�}t|�d)kr&�j
d�dd*�n||d+�d,d�n|�}�dkrt|�d)kr��jd-td�d��n�jr��jd-t�n�d.d(t��d/��\}	}
}d0�|
kr��jd-td�d��q�j
d|
d�d��n�d
kr�t|�d)krT�jd-td�d��n�jrp�jd-t�n�d.d(t��d1��\}	}
}d2�|
kr��jd-td�d��q��j
d|
d�d��n�dkr6t|�d)kr�j
d�dd*�n||d3�d4d�n�dkr�t|�d)krm�j
d�dd*�n||d5�d6d�n�dkr�t|�d)kr��j
d�dd*�n||d7�d8|d�ndS(9Ntnametrequiredtconfigttypetpatht
server_urltusernametpasswordtno_logtsupervisorctl_pathtstatetchoicestpresenttstartedt	restartedtstoppedtabsentt	signalledtsignalt
argument_spectsupports_check_modet:tLANGtCtLC_ALLtLC_MESSAGEStLC_CTYPEtmsgsEProvided path to supervisorctl does not exist or isn't executable: %st
supervisorctls-cs-ss-us-ps+State 'signalled' requires a 'signal' valuec`s?t��}|j|�|r/|j|�n�j||�S(N(tlisttappendtrun_command(tcmdR
tkwargstargs(tmoduletsupervisorctl_args(sT/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/supervisorctl.pytrun_supervisorctl�s

c
`s�g}�d�\}}}x�|j�D]�}g|jd�D]}|dkr>|^q>}|d}|d}�r�d|kr(|jd�d}	|	�kr�q(q�q�q(n|�kr�q(n|j||f�q(W|S(NRt tiiR(t
splitlinestsplitR((
tmatchedtrctoutterrtlinetfieldtfieldstprocess_nameRtgroup(tis_groupR
R/(sT/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/supervisorctl.pytget_matched_processes�s .

	c
	`sg}x0|D](\}}||�r
|j|�q
q
Wt|�dkrj�jdtd�d��n�jr��jdt�nxU|D]M}�||dt�\}}}	d||f|kr��jd|�q�q�W�jdtd�d�d|�dS(	NitchangedR
Rtcheck_rcs%s: %sR%taffected(R(tlent	exit_jsontFalset
check_modetTruet	fail_json(
t	processest
status_filtertactiontexpected_resulttto_take_action_onR;RR5R6R7(R-R
R/R(sT/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/supervisorctl.pyttake_action_on_processes�s	
tupdateR@isERROR (no such process)cS`stS(N(RF(ts((sT/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/supervisorctl.pyt<lambda>�strestartR?trereadtremoves%s: removed process grouptadds%s: added process groupcS`s
|dkS(NtRUNNINGtSTARTING(RURV((RO((sT/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/supervisorctl.pyRP�ststartcS`s
|dkS(NRURV(sRUNNINGsSTARTING((RO((sT/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/supervisorctl.pyRP�ststopcS`s
|dkS(NRU((RO((sT/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/supervisorctl.pyRPss	signal %s(tdictRFRDRtparamstendswithtrstriptgettrun_command_environ_updatetosRtexistsR	RGtget_bin_pathtextendtNoneRBRCRE(
targ_specRRRRRRR>RMR5R6R7RH((R=R-R
R/RR.sT/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/supervisorctl.pytmainis�'

$					t__main__(t
__future__RRRR
t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLESR_tansible.module_utils.basicRR	Ret__name__(((sT/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/supervisorctl.pyt<module>s


6 	�

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