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

�
���^c@@s�dZddlmZmZmZdZddlmZmZe	e	e
e	e	e	e	e	e	e	e	e	e	e	e	e	d�Ze
e	d�Ze
e	d�Z
ee	d�Ze
e	d	�Zd
�Ze	e	d�ZdS(
u1
Manage Linux Containers
=======================
i(tabsolute_importtprint_functiontunicode_literalsurestructuredtext en(tCommandExecutionErrortSaltInvocationErrorcC@s0i|d6td6dj|�d6id6}t|||f�s�td|�}td�|D��s}t|d<d|d<q�y|d	}Wq�tk
r�q�Xn|r�td
|d|�r�t|d<dj|�|d<n|ds�|S|rd
j|�nd}itd|d|�d6}tdr7|dd9krxdj||r]d
j|�nd�|d<d9|d<|S|d9kr�|S|r�|dd:kr�dj||ddkr�dnd�|d<d9|d<|S|dcd7<|Sq7|dd;kr dj|�|d<d9|d<|S|dcd7<|Sn|dd9krcy�|r�td||d|d|d|d |d|d!|�}n^td"|d|d|d#|d$|d%|d&|	d'|
d |d!|d(|
d|d)|d*|�
}Wn0tt	fk
r}t|d<|j
|d<qcX|r;d+j||�|d<nd,j|�|d<|d-d.|d.<n|dtkr�|d9kr�q�|r�td|d|�}|dkr�|dcd7<q�d/}yk|dkr�d0nd1}t||d|�d-d.|d.<|d.dkr-t|d<|dc|7<nWn?t	tfk
ro}t|d<|dcd2j||�7<q�X|dd9kr�|dcd37<q�d4j||ddkr�dnd�|d<q�td|d|�}|dkr
|dd9k	r�|dcd7<q�q�d5}yStd6|d|�d-d.|d.<|d.dkrbt|d<|dc|7<nWn?t	tfk
r�}t|d<|dcd2j||�7<q�X|dd9kr�|dcd77<q�d8j|�|d<nd.|krtd|d|�|d.<n|d|d.kr,||dd-<n|S(<u9
    .. versionchanged:: 2015.8.0

        The :mod:`lxc.created <salt.states.lxc.created>` state has been renamed
        to ``lxc.present``, and the :mod:`lxc.cloned <salt.states.lxc.cloned>`
        state has been merged into this state.

    Create the named container if it does not exist

    name
        The name of the container to be created

    path
        path to the container parent
        default: /var/lib/lxc (system default)

        .. versionadded:: 2015.8.0


    running : False
        * If ``True``, ensure that the container is running
        * If ``False``, ensure that the container is stopped
        * If ``None``, do nothing with regards to the running state of the
          container

        .. versionadded:: 2015.8.0

    clone_from
        Create named container as a clone of the specified container

    snapshot : False
        Use Copy On Write snapshots (LVM). Only supported with ``clone_from``.

    profile
        Profile to use in container creation (see the :ref:`LXC Tutorial
        <tutorial-lxc-profiles-container>` for more information). Values in a
        profile will be overridden by the parameters listed below.

    network_profile
        Network Profile to use in container creation
        (see the :ref:`LXC Tutorial <tutorial-lxc-profiles-container>`
        for more information). Values in a profile will be overridden by
        the parameters listed below.

        .. versionadded:: 2015.5.2

    **Container Creation Arguments**

    template
        The template to use. For example, ``ubuntu`` or ``fedora``.
        For a full list of available templates, check out
        the :mod:`lxc.templates <salt.modules.lxc.templates>` function.

        Conflicts with the ``image`` argument.

        .. note::

            The ``download`` template requires the following three parameters
            to be defined in ``options``:

            * **dist** - The name of the distribution
            * **release** - Release name/version
            * **arch** - Architecture of the container

            The available images can be listed using the :mod:`lxc.images
            <salt.modules.lxc.images>` function.

    options

        .. versionadded:: 2015.5.0

        Template-specific options to pass to the lxc-create command. These
        correspond to the long options (ones beginning with two dashes) that
        the template script accepts. For example:

        .. code-block:: yaml

            web01:
              lxc.present:
                - template: download
                - options:
                    dist: centos
                    release: 6
                    arch: amd64

        Remember to double-indent the options, due to :ref:`how PyYAML works
        <nested-dict-indentation>`.

        For available template options, refer to the lxc template scripts
        which are ususally located under ``/usr/share/lxc/templates``,
        or run ``lxc-create -t <template> -h``.

    image
        A tar archive to use as the rootfs for the container. Conflicts with
        the ``template`` argument.

    backing
        The type of storage to use. Set to ``lvm`` to use an LVM group.
        Defaults to filesystem within /var/lib/lxc.

    fstype
        Filesystem type to use on LVM logical volume

    size
        Size of the volume to create. Only applicable if ``backing`` is set to
        ``lvm``.

    vgname : lxc
        Name of the LVM volume group in which to create the volume for this
        container. Only applicable if ``backing`` is set to ``lvm``.

    lvname
        Name of the LVM logical volume in which to create the volume for this
        container. Only applicable if ``backing`` is set to ``lvm``.

    thinpool
        Name of a pool volume that will be used for thin-provisioning this
        container. Only applicable if ``backing`` is set to ``lvm``.
    unameuresultuContainer '{0}' already existsucommentuchangesulxc.get_container_profilecs@s!|]}|dkr|VqdS(utemplateuimageu
clone_fromN(utemplateuimageu
clone_from((t.0tx((s3/usr/lib/python2.7/site-packages/salt/states/lxc.pys	<genexpr>�suhNo template, image, or clone_from parameter was found in either the state's arguments or the LXC profileu
clone_fromu
lxc.existstpathu!Clone source '{0}' does not existucloned from {0}ucreatedu	lxc.stateuoldutestuContainer '{0}' will be {1}ufrozenustoppeduContainer '{0}' would be {1}uunfrozenustartedu and is runningurunningu Container '{0}' would be stoppedu and is stoppedu	lxc.clonetprofiletnetwork_profiletsnapshottsizetbackingu
lxc.createttemplatetoptionstimagetconfigtfstypetvgnametlvnametthinpooluCloned container '{0}' as '{1}'uCreated container '{0}'ustateunewu, but it could not be startedulxc.unfreezeu	lxc.startu{0}: {1}u, and the container was starteduContainer '{0}' was {1}u, but it could not be stoppedulxc.stopu, and the container was stoppeduContainer '{0}' was stoppedN(ufrozenustopped(ufrozenurunning(tTruetformattanyt__salt__tFalsetKeyErrort__opts__tNoneRRtstrerror(tnametrunningt
clone_fromR
RR	R
RRRRRRRRRRtrett	c_profiletactiontstatetresulttexctc_stateterrort
start_func((s3/usr/lib/python2.7/site-packages/salt/states/lxc.pytpresents�

















 

 cC@s�i|d6id6td6dj|�d6}td|d|�sE|Stdrpd|d<d	j|�|d<|Sy td
|d|d|�}Wn6ttfk
r�}t|d<dj|�|d<n&X|d
|dd
<dj|�|d<|S(u�
    Ensure a container is not present, destroying it if present

    name
        Name of the container to destroy

    stop
        stop before destroying
        default: false

        .. versionadded:: 2015.5.2

    path
        path to the container parent
        default: /var/lib/lxc (system default)

        .. versionadded:: 2015.8.0


    .. code-block:: yaml

        web01:
          lxc.absent
    unameuchangesuresultuContainer '{0}' does not existucommentu
lxc.existsRutestu"Container '{0}' would be destroyedulxc.destroytstopu Failed to destroy container: {0}ustateuContainer '{0}' was destroyedN(RRRRRRRR(RR+RR!R%R&((s3/usr/lib/python2.7/site-packages/salt/states/lxc.pytabsentMs$


 
cC@s�i|d6td6dj|�d6id6}itd|d|�d6}|ddkryt|d<d	j|�|d<|S|dd
kr�|r�|S|ddkr�|r�t}n|r�|ddkr�d}q�d }n|ddkr�d!}nd"}tdr,d|d<dj||d�|d<|Syi|ddkr_|r_td|d|�}n5|r~td|d|�}ntd|d|�}WnJttfk
r�}t|d<|j|d<td|d|�|d<n�X|dd|d<|dd
kr+t|d<dj|d|�|d<ndj||d�|d<y|d
|dd
<Wnt	k
rnnX|d|dkr�||dd<n|S(#u4
    .. versionchanged:: 2015.5.0
        The :mod:`lxc.started <salt.states.lxc.started>` state has been renamed
        to ``lxc.running``

    Ensure that a container is running

    .. note::

        This state does not enforce the existence of the named container, it
        just starts the container if it is not running. To ensure that the
        named container exists, use :mod:`lxc.present
        <salt.states.lxc.present>`.

    name
        The name of the container

    path
        path to the container parent
        default: /var/lib/lxc (system default)

        .. versionadded:: 2015.8.0

    restart : False
        Restart container if it is already running

    .. code-block:: yaml

        web01:
          lxc.running

        web02:
          lxc.running:
            - restart: True
    unameuresultu"Container '{0}' is already runningucommentuchangesu	lxc.stateRuolduContainer '{0}' does not existurunningustoppedurestartu	restartedustartustartedufrozenuunfreezeuunfrozenutestuContainer '{0}' would be {1}iulxc.unfreezeulxc.restartu	lxc.startunewustateuUnable to {0} container '{1}'iu$Container '{0}' was successfully {1}N(urestartu	restarted(ustartustarted(uunfreezeuunfrozen(ustartustarted(
RRRRRRRRRR(RtrestartRR!R$R#R%R&((s3/usr/lib/python2.7/site-packages/salt/states/lxc.pyRsb$


				





cC@sGi|d6td6dj|�d6id6}itd|d|�d6}|ddkrxt|d<d	j|�|d<n7|dd
kr�|r�t|d<dj|�|d<n|dtks�|ddkr�|S|dd
kr�d}nd}tdr$d|d<dj||d�|d<|Sy td|d|d|�}WnJttfk
r�}t|d<|j|d<td|d|�|d<n�X|dd|d<|ddkr�t|d<dj|d|�|d<ndj||d�|d<y|d|dd<Wnt	k
rnX|d|dkrC||dd<n|S(u
    .. versionadded:: 2015.5.0

    Ensure that a container is frozen

    .. note::

        This state does not enforce the existence of the named container, it
        just freezes the container if it is running. To ensure that the named
        container exists, use :mod:`lxc.present <salt.states.lxc.present>`.

    name
        The name of the container

    path
        path to the container parent
        default: /var/lib/lxc (system default)

        .. versionadded:: 2015.8.0


    start : True
        Start container first, if necessary. If ``False``, then this state will
        fail if the container is not running.

    .. code-block:: yaml

        web01:
          lxc.frozen

        web02:
          lxc.frozen:
            - start: False
    unameuresultu!Container '{0}' is already frozenucommentuchangesu	lxc.stateRuolduContainer '{0}' does not existustoppeduContainer '{0}' is stoppedufrozenustart and freezeustarted and frozenufreezeutestuContainer '{0}' would be {1}iu
lxc.freezetstartunewustateuUnable to {0} container '{1}'iu$Container '{0}' was successfully {1}ustartedN(ustart and freezeustarted and frozen(ufreezeufrozen(
RRRRRRRRRR(RR.RR!R$R#R%R&((s3/usr/lib/python2.7/site-packages/salt/states/lxc.pytfrozen�sR#



 	

 



cC@s�i|d6td6dj|�d6id6}itd|d|�d6}|ddkryt|d<d	j|�|d<|S|dd
kr�|S|r�d}nd}tdr�d|d<dj||d�|d<|Sy td|d|d|�}WnJttfk
r@}t|d<|j|d<td|d|�|d<ndX|dd|d<|dd
kr�t|d<dj|d|�|d<ndj||d�|d<|d|dkr�||dd<n|S(u~
    Ensure that a container is stopped

    .. note::

        This state does not enforce the existence of the named container, it
        just stops the container if it running or frozen. To ensure that the
        named container exists, use :mod:`lxc.present
        <salt.states.lxc.present>`, or use the :mod:`lxc.absent
        <salt.states.lxc.absent>` state to ensure that the container does not
        exist.

    name
        The name of the container

    path
        path to the container parent
        default: /var/lib/lxc (system default)

        .. versionadded:: 2015.8.0

    kill : False
        Do not wait for the container to stop, kill all tasks in the container.
        Older LXC versions will stop containers like this irrespective of this
        argument.

        .. versionadded:: 2015.5.0

    .. code-block:: yaml

        web01:
          lxc.stopped
    unameuresultu"Container '{0}' is already stoppeducommentuchangesu	lxc.stateRuolduContainer '{0}' does not existustoppedu
force-stopu
force-stoppedustoputestuContainer '{0}' would be {1}iulxc.stoptkillunewustateuUnable to {0} container '{1}'iu$Container '{0}' was successfully {1}N(u
force-stopu
force-stopped(ustopustopped(	RRRRRRRRR(RR0RR!R$R#R%R&((s3/usr/lib/python2.7/site-packages/salt/states/lxc.pytstopped:sF"


	

 


cK@s i|d6dd6td6id6S(un
    .. deprecated:: 2015.5.0

    This state function has been disabled, as it did not conform to design
    guidelines. Specifically, due to the fact that :mod:`lxc.set_password
    <salt.modules.lxc.set_password>` uses ``chpasswd(8)`` to set the password,
    there was no method to make this action idempotent (in other words, the
    password would be changed every time). This makes this state redundant,
    since the following state will do the same thing:

    .. code-block:: yaml

        setpass:
          module.run:
            - name: set_pass
            - m_name: root
            - password: secret
    unameuoThe lxc.set_pass state is no longer supported. Please see the LXC states documentation for further information.ucommenturesultuchanges(R(Rtkwargs((s3/usr/lib/python2.7/site-packages/salt/states/lxc.pytset_pass�s
cC@s{tdr3i|d6dj|�d6td6id6S|sBi}n|sQi}ntd|d|d	|�}||d<|S(
u\
    .. warning::

        This state is unsuitable for setting parameters that appear more than
        once in an LXC config file, or parameters which must appear in a
        certain order (such as when configuring more than one network
        interface).

        `Issue #35523`_ was opened to track the addition of a suitable replacement
        or fix.

    Edit LXC configuration options

    .. deprecated:: 2015.5.0

    path
        path to the container parent
        default: /var/lib/lxc (system default)

        .. versionadded:: 2015.8.0


    .. code-block:: bash

        setconf:
          lxc.edited_conf:
            - name: ubuntu
            - lxc_conf:
                - network.ipv4.ip: 10.0.3.6
            - lxc_conf_unset:
                - lxc.utsname

    .. _`Issue #35523`: https://github.com/saltstack/salt/issues/35523

    utestunameu{0} lxc.conf will be editeducommenturesultuchangesulxc.update_lxc_conftlxc_conftlxc_conf_unset(RRRR(RR4R5tcret((s3/usr/lib/python2.7/site-packages/salt/states/lxc.pytedited_conf�s$

		
	
N(t__doc__t
__future__RRRt
__docformat__tsalt.exceptionsRRRRR*R,RRR/R1R3R7(((s3/usr/lib/python2.7/site-packages/salt/states/lxc.pyt<module>s4�/2dWO	

Zerion Mini Shell 1.0