%PDF- %PDF-
Mini Shell

Mini Shell

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

�
���^c@@s�dZddlmZmZmZddlZddlZddlZddlZddl	Z	ddl
ZddlZddl
ZddlZddlZddlmZdgZeje�Zd�Zdd�Zd�Zddeeeed	�ZdS(
uh
Use the :ref:`Salt Event System <events>` to fire events from the
master to the minion and vice-versa.
i(tabsolute_importtprint_functiontunicode_literalsN(tsixu*cC@s>tgtj|�D]$\}}||kr||f^q�S(uQ
    Return a dictionary of only the subset of keys/values specified in keys
    (tdictRt	iteritems(tkeystmaster_dicttktv((s6/usr/lib/python2.7/site-packages/salt/modules/event.pyt_dict_subsetsc
C@stjdd�s*tjdd�dkrQtjdt�rQtjd|�tStddkr�tjjj	j
t�}itdd6|d6|d	6d
d6}z)y|j|�Wntk
r�nXWd|j
�XtS|s�tjd
�dkrmdtkr?djdtjjjtd�dtjdd��td<nt�}t}dtkrx3tdD]}|j|�qeWn|jtd�tjjt�}itdd6|d6|d	6|jd�d6d
d6}t|t�r�|j|�nxo|D]g}	tjjj	j
td|	�}z5y|j|�t}Wntk
rUt}nXWd|j
�Xq�W|SyEtjjjtdt�ji|d	6|d6dd6dd6d�SWnItk
r�tj�\}
}}t j!|
||�}
tj"|
�tSXdS(u�
    Fire an event off up to the master server

    CLI Example:

    .. code-block:: bash

        salt '*' event.fire_master '{"data":"my event data"}' 'tag'
    ulocalufile_clientuuse_master_when_localu8Local mode detected. Event with tag %s will NOT be sent.u	transporturaetuidutagudatau
_minion_eventucmdNu__cliu	salt-callu
master_uriutcp://{ip}:{port}tipu	interfacetporturet_portu4506umaster_uri_listtsaltutokt
master_uritlistenueventsupretagufire_master(#t__opts__tgettNonetFalsetlogtwarningR
t	transporttclientt
ReqChanneltfactorytsendt	ExceptiontclosetTruetformattutilstzeromqt
ip_brackettlisttappendtcrypttSAutht	gen_tokent
isinstanceRtupdateteventtMinionEventt
fire_eventtsystexc_infot	tracebacktformat_exceptiontdebug(tdatattagtpreloadtchanneltloadtmasterstretRtauthtmastertexc_typet	exc_valuet
exc_tracebacktlines((s6/usr/lib/python2.7/site-packages/salt/modules/event.pytfire_master"sj
=

		




*

c
C@s�yItjjjddtddtddtdt�}|j||�SWnItk
r�tj	�\}}}t
j|||�}tj
|�tSXdS(	u�
    Fire an event on the local minion event bus. Data must be formed as a dict.

    CLI Example:

    .. code-block:: bash

        salt '*' event.fire '{"data":"my event data"}' 'tag'
    uminiontsock_dirusock_dirRu	transporttoptsRN(R
RR)t	get_eventRRR+RR,R-R.R/RR0(R1R2R)R:R;R<R=((s6/usr/lib/python2.7/site-packages/salt/modules/event.pytfireps


	

c	K@s�i}|rPt|t�r:t|ttj��|d<qPttj�|d<n|r�t|t�r{t|t�|d<q�t|d<n|r�t|t�r�t|t�|d<q�t|d<n|r�tj	dd�|d<tj	d�|d<n|r|j
|�nt|tj�r*|j
|�ntj	d�sctj	d�dksctj	d	�d
krpt
||�St||d|�SdS(
u�
    Send an event to the Salt Master

    .. versionadded:: 2014.7.0

    :param tag: A tag to give the event.
        Use slashes to create a namespace for related events. E.g.,
        ``myco/build/buildserver1/start``, ``myco/build/buildserver1/success``,
        ``myco/build/buildserver1/failure``.

    :param data: A dictionary of data to send in the event.
        This is free-form. Send any data points that are needed for whoever is
        consuming the event. Arguments on the CLI are interpreted as YAML so
        complex data structures are possible.

    :param with_env: Include environment variables from the current shell
        environment in the event data as ``environ``.. This is a short-hand for
        working with systems that seed the environment with relevant data such
        as Jenkins.
    :type with_env: Specify ``True`` to include all environment variables, or
        specify a list of strings of variable names to include.

    :param with_grains: Include grains from the current minion in the event
        data as ``grains``.
    :type with_grains: Specify ``True`` to include all grains, or specify a
        list of strings of grain names to include.

    :param with_pillar: Include Pillar values from the current minion in the
        event data as ``pillar``. Remember Pillar data is often sensitive data
        so be careful. This is useful for passing ephemeral Pillar values
        through an event. Such as passing the ``pillar={}`` kwarg in
        :py:func:`state.sls <salt.modules.state.sls>` from the Master, through
        an event on the Minion, then back to the Master.
    :type with_pillar: Specify ``True`` to include all Pillar values, or
        specify a list of strings of Pillar keys to include. It is a
        best-practice to only specify a relevant subset of Pillar data.

    :param with_env_opts: Include ``saltenv`` and ``pillarenv`` set on minion
        at the moment when event is send into event data.
    :type with_env_opts: Specify ``True`` to include ``saltenv`` and
        ``pillarenv`` values or ``False`` to omit them.

    :param kwargs: Any additional keyword arguments passed to this function
        will be interpreted as key-value pairs and included in the event data.
        This provides a convenient alternative to YAML for simple values.

    CLI Example:

    .. code-block:: bash

        salt-call event.send myco/mytag foo=Foo bar=Bar
        salt-call event.send 'myco/mytag' '{foo: Foo, bar: Bar}'

    A convenient way to allow Jenkins to execute ``salt-call`` is via sudo. The
    following rule in sudoers will allow the ``jenkins`` user to run only the
    following command.

    ``/etc/sudoers`` (allow preserving the environment):

    .. code-block:: text

        jenkins ALL=(ALL) NOPASSWD:SETENV: /usr/bin/salt-call event.send*

    Call Jenkins via sudo (preserve the environment):

    .. code-block:: bash

        sudo -E salt-call event.send myco/jenkins/build/success with_env=[BUILD_ID, BUILD_URL, GIT_BRANCH, GIT_COMMIT]

    uenvironugrainsupillarusaltenvubaseu	pillarenvulocalufile_clientumaster_typeudisableR3N(R'R"R
Rtostenviront
__grains__t
__pillar__RRR(tcollectionstMappingRBR>(	R2R1R3twith_envtwith_grainstwith_pillart
with_env_optstkwargst	data_dict((s6/usr/lib/python2.7/site-packages/salt/modules/event.pyR�s.N

9
(t__doc__t
__future__RRRRGtloggingRCR,R.t
salt.cryptR
tsalt.utils.eventtsalt.utils.zeromqtsalt.payloadtsalt.transport.clienttsalt.extRt__proxyenabled__t	getLoggert__name__RR
RR>RBRR(((s6/usr/lib/python2.7/site-packages/salt/modules/event.pyt<module>s.		N	

Zerion Mini Shell 1.0