%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/host.pyo

�
���^c@@s`dZddlmZmZmZddlmZddlZe	d�Z
d�Zd�ZdS(u}
Management of addresses and names in hosts file
===============================================

The ``/etc/hosts`` file can be managed to contain definitions for specific hosts:

.. code-block:: yaml

    salt-master:
      host.present:
        - ip: 192.168.0.42

Or using the ``names`` directive, you can put several names for the same IP.
(Do not try one name with space-separated values).

.. code-block:: yaml

    server1:
      host.present:
        - ip: 192.168.0.42
        - names:
          - server1
          - florida

.. note::

    Changing the ``names`` in ``host.present`` does not cause an
    update to remove the old entry.

.. code-block:: yaml

    server1:
      host.present:
        - ip:
          - 192.168.0.42
          - 192.168.0.43
          - 192.168.0.44
        - names:
          - server1

You can replace all existing names for a particular IP address:

.. code-block:: yaml

    127.0.1.1:
      host.only:
        - hostnames:
          - foo.example.com
          - foo

Or delete all existing names for an address:

.. code-block:: yaml

    203.0.113.25:
        host.only:
          - hostnames: []

i(tabsolute_importtprint_functiontunicode_literals(tsixNc
C@s-i|d6id6td6dd6}t|t�s=|g}ntd�}g}t�}t�}|jg|D]}||kro||f^qo�x�tj|�D]�\}}	||kr||	kr�|r�|j||f�q|j	dg�j
dj||��q�q�||	kr7|j
d	j||��q�tj
jjj|�re|j||f�q�t|d<|j
d
j||��q�Wx�|D]�\}}tdr�d|d<|j
dj||��nUtd
||�r�|j
dj||��n&t|d<|j
dj||��q�|dj	di�j	|g�j
|�q�Wx�|D]�\}}tdr�d|d<|j
dj||��nUtd||�r�|j
dj||��n&t|d<|j
dj||��qX|dj	di�j	|g�j
|�qXWdj|�|d<|S(un
    Ensures that the named host is present with the given ip

    name
        The host to assign an ip to

    ip
        The ip addr(s) to apply to the host. Can be a single IP or a list of IP
        addresses.

    clean : False
        Remove any entries which don't match those configured in the ``ip``
        option.

        .. versionadded:: 2018.3.4
    unameuchangesuresultuucommentuhosts.list_hostsuwarningsu�Host {0} present for IP address {1}. To get rid of this warning, either run this state with 'clean' set to True to remove {0} from {1}, or add {1} to the 'ip' argument.uHost {0} ({1}) already presentu Invalid IP Address for {0} ({1})utestuHost {0} ({1}) would be addeduhosts.add_hostuAdded host {0} ({1})uFailed to add host {0} ({1})uaddeduHost {0} ({1}) would be removedu
hosts.rm_hostuRemoved host {0} ({1})uFailed to remove host {0} ({1})uremovedu
N(tTruet
isinstancetlistt__salt__tsettupdateRt	iteritemstaddt
setdefaulttappendtformattsalttutilstvalidatetnettip_addrtFalset__opts__tNonetjoin(
tnametiptcleantrett	all_hoststcommentstto_addt	to_removetaddrtaliases((s4/usr/lib/python2.7/site-packages/salt/states/host.pytpresentFsf


		2



-


-cC@s+i|d6id6dd6dd6}t|t�s=|g}ng}x�|D]�}td||�s�t|d<|jdj||��qJtdr�|jd	j||��qJtd
||�r�i|d6|d<t|d<|jdj||��qJt|d<|jd
�qJWdj	|�|d<|S(u�
    Ensure that the named host is absent

    name
        The host to remove

    ip
        The ip addr(s) of the host to remove
    unameuchangesuresultuucommentuhosts.has_pairuHost {0} ({1}) already absentutestu"Host {0} ({1}) needs to be removedu
hosts.rm_hostuhostuRemoved host {0} ({1})uFailed to remove hostu
N(
RRRRRR
RRRR(RRRRt_ip((s4/usr/lib/python2.7/site-packages/salt/states/host.pytabsent�s*







cC@sGi|d6id6dd6dd6}t|tj�r@|g}ndjtd|��}djd�|D��}||kr�d	j||�|d<t|d<|Std
r�dj|||�|d<|Std||�|d<|dsd
dj|||�|d<|Sdj|||�|d<ii|d6|d6|6|d<|S(u
    Ensure that only the given hostnames are associated with the
    given IP address.

    .. versionadded:: 2016.3.0

    name
        The IP address to associate with the given hostnames.

    hostnames
        Either a single hostname or a list of hostnames to associate
        with the given IP address in the given order.  Any other
        hostname associated with the IP address is removed.  If no
        hostnames are specified, all hostnames associated with the
        given IP address are removed.
    unameuchangesuresultuucommentu uhosts.get_aliascs@s|]}|j�VqdS(N(tstrip(t.0tx((s4/usr/lib/python2.7/site-packages/salt/states/host.pys	<genexpr>�su#IP address {0} already set to "{1}"utestu$Would change {0} from "{1}" to "{2}"uhosts.set_hostu#hosts.set_host failed to change {0}u from "{1}" to "{2}"u,successfully changed {0} from "{1}" to "{2}"uoldunewN(	RRRtstring_typesRRRRR(Rt	hostnamesRtoldtnew((s4/usr/lib/python2.7/site-packages/salt/states/host.pytonly�s4




(
t__doc__t
__future__RRRtsalt.extRtsalt.utils.validate.netRRR"R$R,(((s4/usr/lib/python2.7/site-packages/salt/states/host.pyt<module><sd	&

Zerion Mini Shell 1.0