%PDF- %PDF-
Mini Shell

Mini Shell

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

�
���^c@@sdZddlmZmZmZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZ
ddlmZmZddlmZddlZ
ddlZ
ddlZ
ddlZ
ddlmZy(ddlZddlZddlZWnek
r)dZnXdZeje �Z!de"fd	��YZ#d
e"fd��YZ$da%da&d�Z'd
�Z(ed�dd��Z)ed�dd��Z*e
j+j,j-j.d�de/e/de/ddde/e/e/ddde/ddd��Z0dS(u�
Ansible Support
===============

This module can have an optional minion-level
configuration in /etc/salt/minion.d/ as follows:

  ansible_timeout: 1200

The timeout is how many seconds Salt should wait for
any Ansible module to respond.
i(tabsolute_importtprint_functiontunicode_literalsN(tLoaderErrortCommandExecutionError(tdepends(tsixuansibletAnsibleModuleResolvercB@sJeZdZd�Zdd�Zd�Zdd�Zd�Zd�Z	RS(uD
    This class is to resolve all available modules in Ansible.
    cC@s||_i|_dS(N(toptst_modules_map(tselfR((s</usr/lib/python2.7/site-packages/salt/modules/ansiblegate.pyt__init__@s	c@s;i}tjjd}|s%|}nxtj|�D]��tjj|��}tjj|�rhq5ntjj|�r�|j	|j
|��q5t�fd�ddgD��s5�jd�s5�tj
jkr�q5n|j|d�jd�d}|jdd�jddd�jdd�}|||<q5W|S(	u@
        Get installed Ansible modules
        :return:
        ic3@s|]}�j|�VqdS(N(t
startswith(t.0telm(tp_el(s</usr/lib/python2.7/site-packages/salt/modules/ansiblegate.pys	<genexpr>Tsu__u.u.pyuu/i(tansibletmodulest__path__tostlistdirtpathtjointislinktisdirtupdatet_get_modules_maptanytendswitht	constantstIGNORE_FILEStreplacetsplit(R
Rtpathstroott	p_el_pathtals_name((Rs</usr/lib/python2.7/site-packages/salt/modules/ansiblegate.pyRDs$	"-cC@s�|jj|�}|dkr6tdj|���ntjdjdjg|jt	j
j�D]}|jd�d^q^���}|S(uU
        Introspect Ansible module.

        :param module:
        :return:
        uModule "{0}" was not founduansible.modules{0}u.iN(R	tgettNoneRtformatt	importlibt
import_moduleRR RRtsep(R
tmoduletm_refRtmod((s</usr/lib/python2.7/site-packages/salt/modules/ansiblegate.pytload_module^sDcC@s�|r$d|kr$dj|�}ng}x�|jj�D]�\}}|jd�d}djg|jtjj�D]}|ru|^qu�}|r�tj||�s�|r:|j	|�q:q:Wt
|�S(u@
        Return module map references.
        :return:
        u*u*{0}*u.i(R'R	titemsR RRRR*tfnmatchtappendtsorted(R
tpatternRtm_nametm_pathR((s</usr/lib/python2.7/site-packages/salt/modules/ansiblegate.pytget_modules_listms7cC@s tjd�|j�|_|S(NuResolving Ansible modules(tlogtdebugRR	(R
((s</usr/lib/python2.7/site-packages/salt/modules/ansiblegate.pytresolve|s
cC@stjd�|S(NuInstalling Ansible modules(R7R8(R
((s</usr/lib/python2.7/site-packages/salt/modules/ansiblegate.pytinstall�s
N(
t__name__t
__module__t__doc__RR&RR.R6R9R:(((s</usr/lib/python2.7/site-packages/salt/modules/ansiblegate.pyR<s			tAnsibleModuleCallercB@s&eZdZdZd�Zd�ZRS(i�uansible_timeoutcC@s.||_|jjj|j|j�|_dS(N(t	_resolverRR%tOPT_TIMEOUT_KEYtDEFAULT_TIMEOUTttimeout(R
tresolver((s</usr/lib/python2.7/site-packages/salt/modules/ansiblegate.pyR�s	c	O@s�|jj|�}t|d�sHtdj|jjdd����n|rddj|�|d<ntd�}|jdt	j
jj|��}t	j
j
jd	d
j|�gdtjd|j�}|j�t	j
j
jd
|jgd|jdtjd|j�}|j�yt	j
jj|j�}WnYtk
r�}i|jr[|jdpgtj|�d6}|jr�|j|d<n|SXd|kr�|d=n|j|d<|S(u�
        Call an Ansible module by invoking it.
        :param module: the name of the module.
        :param args: Arguments to the module
        :param kwargs: keywords to the module
        :return:
        umainu4This module is not callable (see "ansible.help {0}")uansible.modules.uu u_raw_paramsu!{{"ANSIBLE_MODULE_ARGS": {args}}}targsuechou{0}tstdoutRBupythontstdinu.uErroruGiven JSON outputu
invocationutimeout(R?R.thasattrRR'R;RRtstrtsalttutilstjsontdumpsttimed_subprocesst	TimedProct
subprocesstPIPERBtrunt__file__REtloadst
ValueErrortstderrRt	text_type(	R
R+RDtkwargstjs_argstproc_outtproc_exctouttex((s</usr/lib/python2.7/site-packages/salt/modules/ansiblegate.pytcall�s8		!

,	

(R;R<RAR@RR](((s</usr/lib/python2.7/site-packages/salt/modules/ansiblegate.pyR>�s	cC@s>d�}x.|D]&}ttjt|||d��qWdS(u8
    Set all Ansible modules callables
    :return:
    c@s�fd�}||_|S(u@
        Create a Salt function for the Ansible module.
        c@sai}|jd�rNx6|jdg�D]}t|t�r(|}Pq(q(Wntj�||�S(uM
            Call an Ansible module as a function from the Salt.
            u	__pub_arg(R%t
isinstancetdictt_callerR](RDtkwRWt_kw(tcmd_name(s</usr/lib/python2.7/site-packages/salt/modules/ansiblegate.pyt_cmd�s(R=(RctdocRd((Rcs</usr/lib/python2.7/site-packages/salt/modules/ansiblegate.pyt
_set_function�s	u	AvailableN(tsetattrtsysRR;(RRfR-((s</usr/lib/python2.7/site-packages/salt/modules/ansiblegate.pyt_set_callables�s	
cC@sytjjj�rtdfStdk	}|r5dp8d}|rutt�j	�j
�att�a
tt��ntS(u-
    Ansible module caller.
    :return:
    u1The ansiblegate module isn't supported on Windowsu'Ansible is not installed on this systemN(RIRJtplatformt
is_windowstFalseRR&Rt__opts__R9R:R?R>R`Ritlistt__virtualname__(trettmsg((s</usr/lib/python2.7/site-packages/salt/modules/ansiblegate.pyt__virtual__�s
c	G@sz|std��nytj|�}Wn.ttfk
rX}tdj|���nXi}i}xo|jjd�D][}y/tj	j
j|�}|r�|j|�nWqxt
k
r�}tjd|�qxXqxW|s=d|kr|jd�p�d}|d=||d<n|j�|dj|jjd	d��<n9x6|D].}|j|�}|d
k	rD|||<qDqDW|S(uS
    Display help on Ansible standard module.

    :param module:
    :return:
    ujPlease tell me what module you want to have helped with. Or call "ansible.list" to know what is available.u8Module "{0}" is currently not functional on your system.u---uError parsing doc section: %sudescriptionuuDescriptionu!Available sections on module "{}"uansible.modules.N(RR?R.tImportErrorRR't
DOCUMENTATIONR RIRJtyamlt	safe_loadRt	ExceptionR7terrorR%tkeysR;RR&(	R+RDterrReRptdocsettdescriptiontargtinfo((s</usr/lib/python2.7/site-packages/salt/modules/ansiblegate.pythelp�s4
+
cC@stjd|�S(u/
    Lists available modules.
    :return:
    R3(R?R6(R3((s</usr/lib/python2.7/site-packages/salt/modules/ansiblegate.pyRnsuansible-playbookicC@s'd|g}|r"|jd�n|r8|jd�nt|t�ri|jdjtj|���n:t|tj�r�|jd�r�|jdj|��n|r�|jd�n|r�|jdj|��n|r�|jd	j|��n|	r
|jd
�n|
r#|jd�n|r9|jd�n|rX|jd
j|��n|
rw|jdj|
��n|r�|jdj|��n|r�|jd�n|r�|jdj|��n|r�x�tj	|�D]�\}}|j
dd�}|tkr$|jdj|��q�t|tj�rR|jdj||��q�t|t�r�|jdj|tj|���q�q�Wn|jdj|��iidd6dd6d6|d6dj|�d6}t
d|�}tjd |�tj|d!�}|d"r#|d"td"<n|S(#u�
    Run Ansible Playbooks

    :param playbook: Which playbook to run.
    :param rundir: Directory to run `ansible-playbook` in. (Default: None)
    :param check: don't make any changes; instead, try to predict some
                  of the changes that may occur (Default: False)
    :param diff: when changing (small) files and templates, show the
                 differences in those files; works great with --check
                 (default: False)
    :param extra_vars: set additional variables as key=value or YAML/JSON, if
                       filename prepend with @, (default: None)
    :param flush_cache: clear the fact cache for every host in inventory
                        (default: False)
    :param forks: specify number of parallel processes to use
                  (Default: 5)
    :param inventory: specify inventory host path or comma separated host
                      list. (Default: None) (Ansible's default is /etc/ansible/hosts)
    :param limit: further limit selected hosts to an additional pattern (Default: None)
    :param list_hosts: outputs a list of matching hosts; does not execute anything else
                       (Default: False)
    :param list_tags: list all available tags (Default: False)
    :param list_tasks: list all tasks that would be executed (Default: False)
    :param module_path: prepend colon-separated path(s) to module library. (Default: None)
    :param skip_tags: only run plays and tasks whose tags do not match these
                      values (Default: False)
    :param start_at_task: start the playbook at the task matching this name (Default: None)
    :param: syntax_check: perform a syntax check on the playbook, but do not execute it
                          (Default: False)
    :param tags: only run plays and tasks tagged with these values (Default: None)

    :return: Playbook return

    CLI Example:

    .. code-block:: bash

        salt 'ansiblehost'  ansible.playbook playbook=/srv/playbooks/play.yml
    uansible-playbooku--checku--diffu--extra-vars='{0}'u@u--extra-vars={0}u
--flush-cacheu--inventory={0}u--limit={0}u--list-hostsu--list-tagsu--list-tasksu--module-path={0}u--skip-tags={0}u--start-at-task={0}u--syntax-checku
--tags={0}u_u-u--{0}u	--{0}={1}u--forks={0}ujsonuANSIBLE_STDOUT_CALLBACKu0uANSIBLE_RETRY_FILES_ENABLEDuenvucwdu ucmducmd.run_alluAnsible Playbook Return: %sustdouturetcode(R1R^R_R'RKRLRRVRt	iteritemsRtTrueRt__salt__R7R8RSt__context__(tplaybooktrundirtchecktdifft
extra_varstflush_cachetforkst	inventorytlimitt
list_hostst	list_tagst
list_taskstmodule_patht	skip_tagst
start_at_tasktsyntax_checkttagstplaybook_kwargstcommandtkeytvaluet
cmd_kwargsRptretdata((s</usr/lib/python2.7/site-packages/salt/modules/ansiblegate.pyt	playbookssf-"!,
(1R=t
__future__RRRRKRRhtloggingR(R0ROtsalt.utils.jsonRItsalt.exceptionsRRtsalt.utils.decoratorsRtsalt.utils.decorators.pathtsalt.utils.platformtsalt.utils.timed_subprocesstsalt.utils.yamltsalt.extRRtansible.constantstansible.modulesRsR&Rot	getLoggerR;R7tobjectRR>R?R`RiRrRRnRJt
decoratorsRtwhichRlR�(((s</usr/lib/python2.7/site-packages/salt/modules/ansiblegate.pyt<module>sP

J4			'			

Zerion Mini Shell 1.0