%PDF- %PDF-
Mini Shell

Mini Shell

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

�
���^c@@s�dZddlmZmZmZddlZddlmZed�Zee	d�Z
ed�Zed�Ze	ee	d	�Z
e	ed
�ZdS(uG
Manage grains on the minion
===========================

This state allows for grains to be set.

Grains set or altered with this module are stored in the 'grains'
file on the minions, By default, this file is located at: ``/etc/salt/grains``

.. note::
   This does **NOT** override any grains set in the minion config file.
i(tabsolute_importtprint_functiontunicode_literalsN(tDEFAULT_TARGET_DELIMcC@sztj|t|�}i|d6id6td6dd6}t�}td||�}||krvt|d<d|d<n|S(u�
    Ensure that a grain is set

    name
        The grain name

    delimiter
        A delimiter different from the default can be provided.

    Check whether a grain exists. Does not attempt to check or set the value.
    unameuchangesuresultuGrain existsucommentu
grains.getuGrain does not exist(tretsubRtTruetobjectt__salt__tFalse(tnamet	delimitertrett
_non_existenttexisting((s6/usr/lib/python2.7/site-packages/salt/states/grains.pytexistss

	

cC@sCtj|t|�}i|d6id6td6dd6}t�}td||�}||krmd|d<|Stdr�d|d<||kr�d	j|�|d<i|d
6|d<n+dj|�|d<ii||6d6|d<|Std
||d|�}|dtkr5|dikr5dj||�|d<n||d<|S(u�
    Ensure that a grain is set

    .. versionchanged:: v2015.8.2

    name
        The grain name

    value
        The value to set on the grain

    force
        If force is True, the existing grain will be overwritten
        regardless of its existing or provided value type. Defaults to False

        .. versionadded:: v2015.8.2

    delimiter
        A delimiter different from the default can be provided.

        .. versionadded:: v2015.8.2

    It is now capable to set a grain to a complex value (ie. lists and dicts)
    and supports nested grains as well.

    If the grain does not yet exist, a new grain is set to the given value. For
    a nested grain, the necessary keys are created if they don't exist. If
    a given key is an existing value, it will be converted, but an existing value
    different from the given key will fail the state.

    If the grain with the given name exists, its value is updated to the new
    value unless its existing or provided value is complex (list or dict). Use
    `force: True` to overwrite.

    .. code-block:: yaml

      cheese:
        grains.present:
          - value: edam

      nested_grain_with_complex_value:
        grains.present:
          - name: icinga:Apache SSL
          - value:
            - command: check_https
            - params: -H localhost -p 443 -S

      with,a,custom,delimiter:
        grains.present:
          - value: yay
          - delimiter: ','
    unameuchangesuresultuucommentu
grains.getuGrain is already setutestuGrain {0} is set to be addedunewuGrain {0} is set to be changeduchangedu
grains.settforceuSet grain {0} to {1}N(	RRRRRRt__opts__tNonetformat(R
tvalueRRRR
R((s6/usr/lib/python2.7/site-packages/salt/states/grains.pytpresent0s.5

	


 
cC@stj|t|�}i|d6id6td6dd6}td|�}|r
t|t�s}t|d<dj|�|d<|St|t�r�t	|�j
t	td|���r�dj||�|d<|S|tjd	i�krMt	|�j
tjd	i�|�}|rMtt	|�jtd	|��}d
j||�|d<qMnd	tkrfitd	<n|td	kr�t	�td	|<ntd	|j|�n&||kr�dj||�|d<|Stdr
d|d<dj||�|d<i|d
6|d<|SntdrFd|d<dj|�|d<i|d
6|d<|Std||�}t|t�r�t	|�j
t	td|���s�t|d<dj||�|d<|Sn@|td|dt�kr�t|d<dj||�|d<|Sdj||�|d<i|d
6|d<|S(u\
    .. versionadded:: 2014.1.0

    Ensure the value is present in the list-type grain. Note: If the grain that is
    provided in ``name`` is not present on the system, this new grain will be created
    with the corresponding provided value.

    name
        The grain name.

    value
        The value is present in the list type grain.

    delimiter
        A delimiter different from the default ``:`` can be provided.

        .. versionadded:: v2015.8.2

    The grain should be `list type <http://docs.python.org/2/tutorial/datastructures.html#data-structures>`_

    .. code-block:: yaml

        roles:
          grains.list_present:
            - value: web

    For multiple grains, the syntax looks like:

    .. code-block:: yaml

        roles:
          grains.list_present:
            - value:
              - web
              - dev
    unameuchangesuresultuucommentu
grains.getuGrain {0} is not a valid listu!Value {1} is already in grain {0}upending_grainsu=Removed value {0} from update due to context found in "{1}".
utestu,Value {1} is set to be appended to grain {0}unewuGrain {0} is set to be addedu
grains.appendu$Failed append value {1} to grain {0}RuAppend value {1} to grain {0}N(RRRRRt
isinstancetlistR	Rtsettissubsett__context__tgettintersectiont
differencetupdateRR(R
RRRtgrainRt
new_grains((s6/usr/lib/python2.7/site-packages/salt/states/grains.pytlist_presentsf%


%%#




%

cC@s�tj|t|�}i|d6id6td6dd6}g}td|d�}|r�t|t�r�t|t�s�|g}nx|D]}||kr�|jdj	||��q�t
dr$d|d<|jd	j	||��d
|dj�krigd
6|d<n|dd
j|�q�||kr�td||�|jdj	||��d
|dj�kr�igd
6|d<n|dd
j|�q�q�Wd
j|�|d<|St
|d<dj	|�|d<ndj	|�|d<|S(u�
    Delete a value from a grain formed as a list.

    .. versionadded:: 2014.1.0

    name
        The grain name.

    value
       The value to delete from the grain list.

    delimiter
        A delimiter different from the default ``:`` can be provided.

        .. versionadded:: v2015.8.2

    The grain should be `list type <http://docs.python.org/2/tutorial/datastructures.html#data-structures>`_

    .. code-block:: yaml

        roles:
          grains.list_absent:
            - value: db

    For multiple grains, the syntax looks like:

    .. code-block:: yaml

        roles:
          grains.list_absent:
            - value:
              - web
              - dev
    unameuchangesuresultuucommentu
grains.getu"Value {1} is absent from grain {0}utestu+Value {1} in grain {0} is set to be deletedudeletedu
grains.removeu$Value {1} was deleted from grain {0}u
uGrain {0} is not a valid listuGrain {0} does not existN(RRRRRRRRtappendRRtkeystjoinR	(R
RRRtcommentsRtval((s6/usr/lib/python2.7/site-packages/salt/states/grains.pytlist_absent�sH$







cC@sFt�}tj|t|�}i|d6id6td6dd6}td||�}|dkrtdr�d|d<|tkr�dj|�|d<i|d	6|d<n|Std
|dd|d|�}|dr	|tkr	d
j|�|d<i|d	6|d<q	n||d<n,||k	r/tdr�d|d<|tkridj|�|d<i|d	6|d<n+dj|�|d<i|d6dd6|d<|Std
|dd|d|�}|dr"|tkr�d
j|�|d<i|d	6|d<q"dj|�|d<i|d6dd6|d<n||d<ndj|�|d<|S(u|
    .. versionadded:: 2014.7.0

    Delete a grain from the grains config file

    name
        The grain name

    destructive
        If destructive is True, delete the entire grain. If
        destructive is False, set the grain's value to None. Defaults to False.

    force
        If force is True, the existing grain will be overwritten
        regardless of its existing or provided value type. Defaults to False

        .. versionadded:: v2015.8.2

    delimiter
        A delimiter different from the default can be provided.

        .. versionadded:: v2015.8.2

    .. versionchanged:: v2015.8.2

    This state now support nested grains and complex values. It is also more
    conservative: if a grain has a value that is a list or a dict, it will
    not be removed unless the `force` parameter is True.

    .. code-block:: yaml

      grain_name:
        grains.absent
    unameuchangesuresultuucommentu
grains.getutestuGrain {0} is set to be deletedudeletedu
grains.settdestructiveRuGrain {0} was deletedu/Value for grain {0} is set to be deleted (None)ugrainuvalueu#Value for grain {0} was set to NoneuGrain {0} does not existN(	RRRRRRRRR(R
R(RRR
RR((s6/usr/lib/python2.7/site-packages/salt/states/grains.pytabsent*s\'	




	





	

cC@s�tj|t|�}i|d6id6td6dd6}td|d�}|s\|tkr�t|t�r||kr�dj	||�|d<|St
dr�d|d<d	j	||�|d<i|d
6|d<|Std||�dj	||�|d<i|d
6|d<q�|tkr�t
drVd|d<d
j	||�|d<i|d
6|d<|S|dkrhgn|g}|j|�td||�dj	||�|d<i|d
6|d<q�t|d<dj	|�|d<nt|d<dj	|�|d<|S(u�
    .. versionadded:: 2014.7.0

    Append a value to a list in the grains config file. The grain that is being
    appended to (name) must exist before the new value can be added.

    name
        The grain name

    value
        The value to append

    convert
        If convert is True, convert non-list contents into a list.
        If convert is False and the grain contains non-list contents, an error
        is given. Defaults to False.

    delimiter
        A delimiter different from the default can be provided.

        .. versionadded:: v2015.8.2

    .. code-block:: yaml

      grain_name:
        grains.append:
          - value: to_be_appended
    unameuchangesuresultuucommentu
grains.getu.Value {1} is already in the list for grain {0}utestu)Value {1} in grain {0} is set to be addeduaddedu
grains.appendu Value {1} was added to grain {0}uDGrain {0} is set to be converted to list and value {1} will be addedu
grains.setvaluGrain {0} is not a valid listuGrain {0} does not existN(
RRRRRRt
__grains__RRRRR"R	(R
RtconvertRRR((s6/usr/lib/python2.7/site-packages/salt/states/grains.pyR"�sL








(t__doc__t
__future__RRRRt
salt.defaultsRRR	RR!R'R)R"(((s6/usr/lib/python2.7/site-packages/salt/states/grains.pyt<module>
sO_MX

Zerion Mini Shell 1.0