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

�
���^c@@s�dZddlmZmZmZddlmZddlmZddlj	j
Z
ddlmZdZ
dZd	�Zdddddded
�Zddded�Zd�Zd
�Zd�ZdS(us
Manage LXD images.

.. versionadded:: 2019.2.0

.. note:

    - `pylxd`_ version 2 is required to let this work,
      currently only available via pip.

        To install on Ubuntu:

        $ apt-get install libssl-dev python-pip
        $ pip install -U pylxd

    - you need lxd installed on the minion
      for the init() and version() methods.

    - for the config_get() and config_get() methods
      you need to have lxd-client installed.

.. _: https://github.com/lxc/pylxd/blob/master/doc/source/installation.rst

:maintainer: René Jochum <rene@jochums.at>
:maturity: new
:depends: python-pylxd
:platform: Linux
i(tabsolute_importtprint_functiontunicode_literals(tCommandExecutionError(tSaltInvocationErrorN(tmapurestructuredtext enu	lxd_imagecC@sdtkrtStS(u>
    Only load if the lxd module is available in __salt__
    ulxd.version(t__salt__t__virtualname__tFalse(((s9/usr/lib/python2.7/site-packages/salt/states/lxd_image.pyt__virtual__-sc	C@sg|d4krg}n|}i
|d6|d6|d6|d6|d6|d6|d6|d6|d	6id
6}	d4}
y&td|||||dt�}
Wn8tk
r�}t|	tj|��Stk
r�}nX|
d4krLtd
rdj	|�}i|d6|	d
<t
|	|�Sy|ddkr�td|dd|dd|dd|dd|jd	t�d|d|d|d|d|d|d|dt�}
n|ddkr"d|kr�t|d<ntd |d!d|d|d|d|d|d|d4krt
n|d"|ddt�}
n|dd#kr�td$|d%|dd|d|d|d|d|d|d4krzt
n|d|d4kr�t
n|dt�}
n|dd&krtd'|d&d|d|d|d|d|d|d4kr�t
n|d|d4kr
t
n|dt�}
nWqLtk
rH}t|	tj|��SXn||krh|j|�ntg|
jD]}
tj|
d�^qu�}tttj|��}g}xa|j|�D]P}td
s�td(|
|�|jd)j	|��q�|jd*j	|��q�Wxd|j|�D]S}td
sftd+|
|d,�|jd-j	|��q)|jd.j	|��q)W|r�||	d
d<n|d4k	r|
j|krtd
s�d/j	|�|	d
d<||
_td0|
�qd1j	|�|	d
d<ntd
rA|	d
rAt
|	d2j	t|	d
j����St|	d3j	t|	d
j����S(5uU	
    Ensure an image exists, copy it else from source

    name :
        An alias of the image, this is used to check if the image exists and
        it will be added as alias to the image on copy/create.

    source :
        Source dict.

        For an LXD to LXD copy:

        .. code-block: yaml

            source:
                type: lxd
                name: ubuntu/xenial/amd64  # This can also be a fingerprint.
                remote_addr: https://images.linuxcontainers.org:8443
                cert: ~/.config/lxd/client.crt
                key: ~/.config/lxd/client.key
                verify_cert: False

        .. attention:

            For this kind of remote you also need to provide:
            - a https:// remote_addr
            - a cert and key
            - verify_cert

        From file:

        .. code-block: yaml

            source:
                type: file
                filename: salt://lxd/files/busybox.tar.xz
                saltenv: base

        From simplestreams:

        .. code-block: yaml

            source:
                type: simplestreams
                server: https://cloud-images.ubuntu.com/releases
                name: xenial/amd64

        From an URL:

        .. code-block: yaml

            source:
                type: url
                url: https://dl.stgraber.org/lxd

    aliases :
        List of aliases to append, can be empty.

    public :
        Make this image public available on this instance?
            None on source_type LXD means copy source
            None on source_type file means False

    auto_update :
        Try to auto-update from the original source?
            None on source_type LXD means copy source
            source_type file does not have auto-update.

    remote_addr :
        An URL to a remote Server, you also have to give cert and key if you
        provide remote_addr!

        Examples:
            https://myserver.lan:8443
            /var/lib/mysocket.sock

    cert :
        PEM Formatted SSL Zertifikate.

        Examples:
            ~/.config/lxc/client.crt

    key :
        PEM Formatted SSL Key.

        Examples:
            ~/.config/lxc/client.key

    verify_cert : True
        Wherever to verify the cert, this is by default True
        but in the most cases you want to set it off as LXD
        normaly uses self-signed certificates.
    unameusourceualiasesupublicuauto_updateuremote_addrucertukeyuverify_certuchangesulxd.image_get_by_aliast_rawutestuWould create the image "{0}"ucreatedutypeulxdulxd.image_copy_lxdtsrc_remote_addrtsrc_certtsrc_keytsrc_verify_certtremote_addrtcerttkeytverify_certtaliasestpublictauto_updateufileusaltenvulxd.image_from_fileufilenametsaltenvu
simplestreamsulxd.image_from_simplestreamsuserveruurlulxd.image_from_urlulxd.image_alias_deleteuRemoved alias "{0}"uWould remove alias "{0}"ulxd.image_alias_adduuAdded alias "{0}"uWould add alias "{0}"u!Setting the image public to {0!s}ulxd.pylxd_save_objectuWould set public to {0!s}uWould do {0} changesu{0} changesN(tNoneRtTrueRt_errortsixt	text_typeRt__opts__tformatt
_unchangedtgett__env__RtappendtsetRRt
differenceRtlentkeyst_success(tnametsourceRRRRRRRtrettimagetetmsgtatold_aliasestnew_aliasest
alias_changestk((s9/usr/lib/python2.7/site-packages/salt/states/lxd_image.pytpresent4s�f	











/


	 cC@s�i|d6|d6|d6|d6|d6id6}d}y&td|||||dt�}Wn�tk
r�}t|tj|��Stk
r
}y&td	|||||dt�}Wqtk
r�}t|tj|��Stk
r}t|d
j	|��SXnXt
drDidj	|�d
6|d<t||dd
�Std|�idj	|�d
6|d<t||dd
�S(u�
    name :
        An alias or fingerprint of the image to check and delete.

    remote_addr :
        An URL to a remote Server, you also have to give cert and key if you
        provide remote_addr!

        Examples:
            https://myserver.lan:8443
            /var/lib/mysocket.sock

    cert :
        PEM Formatted SSL Zertifikate.

        Examples:
            ~/.config/lxc/client.crt

    key :
        PEM Formatted SSL Key.

        Examples:
            ~/.config/lxc/client.key

    verify_cert : True
        Wherever to verify the cert, this is by default True
        but in the most cases you want to set it off as LXD
        normaly uses self-signed certificates.
    unameuremote_addrucertukeyuverify_certuchangesulxd.image_get_by_aliasR
u
lxd.image_getuImage "{0}" not found.utestuImage "{0}" would get deleted.uremovedulxd.image_deleteuImage "{0}" has been deleted.N(RRRRRRRRR&RR(R'RRRRR)R*R+((s9/usr/lib/python2.7/site-packages/salt/states/lxd_image.pytabsent-s<"

cC@s1t|d<||d<d|kr-i|d<n|S(Nuresultucommentuchanges(R(R)tsuccess_msg((s9/usr/lib/python2.7/site-packages/salt/states/lxd_image.pyR&|s



cC@s1d|d<||d<d|kr-i|d<n|S(Nuresultucommentuchanges(R(R)R,((s9/usr/lib/python2.7/site-packages/salt/states/lxd_image.pyR�s



cC@s1t|d<||d<d|kr-i|d<n|S(Nuresultucommentuchanges(R(R)terr_msg((s9/usr/lib/python2.7/site-packages/salt/states/lxd_image.pyR�s



(t__doc__t
__future__RRRtsalt.exceptionsRRtsalt.ext.sixtextRtsalt.ext.six.movesRt
__docformat__RR	RRR2R3R&RR(((s9/usr/lib/python2.7/site-packages/salt/states/lxd_image.pyt<module>s,		�K		

Zerion Mini Shell 1.0