%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python2.7/site-packages/salt/states/
Upload File :
Create Path :
Current File : //lib/python2.7/site-packages/salt/states/ansiblegate.pyc

�
���^c@@sdZddlmZmZmZddlZddlZddlZddlZ	ddl
jjZddl
mZddlZ	eje�ZdZed�defd��Y�Zd�Zd	�Zd
�Ze	jjjjd�ddddd��ZdS(
u�
Execution of Ansible modules from within states
===============================================

With `ansible.call` these states allow individual Ansible module calls to be
made via states. To call an Ansible module function use a :mod:`module.run <salt.states.ansible.call>`
state:

.. code-block:: yaml

    some_set_of_tasks:
      ansible:
        - system.ping
        - packaging.os.zypper
          - name: emacs
          - state: installed

i(tabsolute_importtprint_functiontunicode_literalsN(tdependsuansibletAnsibleStatecB@s eZdZd�Zd�ZRS(u
    Ansible state caller.
    cC@sYg}i}x@|pgD]2}t|t�r>|j|�q|j|�qW||fS(u_
        Get args and kwargs from the argset.

        :param argset:
        :return:
        (t
isinstancetdicttupdatetappend(tselftargsettargstkwargstelement((s;/usr/lib/python2.7/site-packages/salt/states/ansiblegate.pytget_args8scK@s�i|jd�d6id6dd6td6}x�|j�D]�\}}|j|�\}}y*tdj|�i||gd6�}Wn8tk
r�}dj||jj|�}t	|d<nX||d|<q8W|S(	u8
        Call Ansible module.

        :return:
        unameuchangesuucommenturesultuansible.{0}u	__pub_argu-Module "{0}" failed. Error message: ({1}) {2}(
tpoptTruetitemsRt__salt__tformatt	Exceptiont	__class__t__name__tFalse(R	Rtrettmod_namet
mod_paramsRtans_mod_outterr((s;/usr/lib/python2.7/site-packages/salt/states/ansiblegate.pyt__call__Hs
*(Rt
__module__t__doc__RR(((s;/usr/lib/python2.7/site-packages/salt/states/ansiblegate.pyR3s	cC@sttjtdd��tS(uD
    Disable, if Ansible is not available around on the Minion.
    ucallc[@s
t�|�S(N(R(R((s;/usr/lib/python2.7/site-packages/salt/states/ansiblegate.pyt<lambda>gs(tsetattrtsystmodulesRt__virtualname__(((s;/usr/lib/python2.7/site-packages/salt/states/ansiblegate.pyt__virtual__cscC@stjjt�S(u
    Get a fileclient
    (tsaltt
fileclienttget_file_clientt__opts__(((s;/usr/lib/python2.7/site-packages/salt/states/ansiblegate.pyt_clientkscC@s�i}x�|dD]�}i}x�|dD]�}i}xVtj|d�D]A\}}|dtkrH|jd|jdi��||<qHqHW|r(|||dd<q(q(W|r|||d	d<qqW|S(
u-
    Find changes in ansible return data
    uplaysutasksuhostsuchangedudiffuchangesutaskunameuplay(tsixt	iteritemsRtget(tplaystchangestplayttask_changesttaskthost_changesthosttdata((s;/usr/lib/python2.7/site-packages/salt/states/ansiblegate.pyt_changesrs )uansible-playbookc
C@s�itd6id6dj|�d6|d6}|r�t|tj�sWtjj|�rt�j	|d�}t
jd|�nt|t�s�t
j
d|�i}ntd	d
|d||�nt|t�s�t
j
d|�i}ntd
|d|dtdt|�}td�tj|d�D��rTdj|�|d<t|d<n�tdr�dj|�|d<d|d<t|�|d<nitd
|d|dt|�}dj|�|d<t|�|d<td�tj|d�D��|d<|S(u�
    Run Ansible Playbooks

    :param name: path to playbook. This can be relative to rundir or the git repo
    :param rundir: location to run ansible-playbook from.
    :param git_repo: git repository to clone for ansible playbooks.  This is cloned
                     using the `git.latest` state, and is cloned to the `rundir`
                     if specified, otherwise it is clone to the `cache_dir`
    :param git_kwargs: extra kwargs to pass to `git.latest` state module besides
                       the `name` and `target`
    :param ansible_kwargs: extra kwargs to pass to `ansible.playbooks` execution
                           module besides the `name` and `target`

    :return: Ansible playbook output.

    .. code-block:: yaml

        run nginx install:
          ansible.playbooks:
            - name: install.yml
            - git_repo: git://github.com/gituser/playbook.git
            - git_kwargs:
                rev: master
    uresultuchangesuRunning playbook {0}ucommentunameubaseurundir set to %su$Setting git_kwargs to empty dict: %su
git.latesttnamettargetu(Setting ansible_kwargs to empty dict: %suansible.playbookstrundirtchecktdiffcs@s|]}|dVqdS(uchangedN((t.0R:((s;/usr/lib/python2.7/site-packages/salt/states/ansiblegate.pys	<genexpr>�sustatsu'No changes to be made from playbook {0}utestu&Changes will be made from playbook {0}u!Changes were made by playbook {0}cs@s%|]}|do|dVqdS(ufailuresuunreachableN((R<R:((s;/usr/lib/python2.7/site-packages/salt/states/ansiblegate.pys	<genexpr>�sN(RRRR+t	text_typetostpathtisdirR*t_extrn_pathtlogttraceRtdebugt
__states__RRtallt
itervaluesR)tNoneR6(R7R9tgit_repot
git_kwargstansible_kwargsRtcheckstresults((s;/usr/lib/python2.7/site-packages/salt/states/ansiblegate.pyt	playbooks�sD
&	

	%#


(Rt
__future__RRRtloggingR>R"tsalt.fileclientR&tsalt.ext.sixtextR+tsalt.utils.decoratorsRtsalt.utils.decorators.patht	getLoggerRRBR$tobjectRR%R*R6tutilst
decoratorsR?twhichRHRN(((s;/usr/lib/python2.7/site-packages/salt/states/ansiblegate.pyt<module>#s"/			

Zerion Mini Shell 1.0