%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/pkgrepo.pyc

�
���^c@@s�dZddlmZmZmZddlZddlmZmZddl	m
ZddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ddlmZd�Zed�Zd	�ZdS(
u�

Management of APT/DNF/YUM/Zypper package repos
==============================================

States for managing software package repositories on Linux distros. Supported
package managers are APT, DNF, YUM and Zypper. Here is some example SLS:

.. code-block:: yaml

    base:
      pkgrepo.managed:
        - humanname: CentOS-$releasever - Base
        - mirrorlist: http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
        - comments:
            - 'http://mirror.centos.org/centos/$releasever/os/$basearch/'
        - gpgcheck: 1
        - gpgkey: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

.. code-block:: yaml

    base:
      pkgrepo.managed:
        - humanname: Logstash PPA
        - name: deb http://ppa.launchpad.net/wolfnet/logstash/ubuntu precise main
        - dist: precise
        - file: /etc/apt/sources.list.d/logstash.list
        - keyid: 28B04E4A
        - keyserver: keyserver.ubuntu.com
        - require_in:
          - pkg: logstash

      pkg.latest:
        - name: logstash
        - refresh: True

.. code-block:: yaml

    base:
      pkgrepo.managed:
        - humanname: deb-multimedia
        - name: deb http://www.deb-multimedia.org stable main
        - file: /etc/apt/sources.list.d/deb-multimedia.list
        - key_url: salt://deb-multimedia/files/marillat.pub

.. code-block:: yaml

    base:
      pkgrepo.managed:
        - humanname: Google Chrome
        - name: deb http://dl.google.com/linux/chrome/deb/ stable main
        - dist: stable
        - file: /etc/apt/sources.list.d/chrome-browser.list
        - require_in:
          - pkg: google-chrome-stable
        - gpgcheck: 1
        - key_url: https://dl-ssl.google.com/linux/linux_signing_key.pub

.. code-block:: yaml

    base:
      pkgrepo.managed:
        - ppa: wolfnet/logstash
      pkg.latest:
        - name: logstash
        - refresh: True


.. _bug: https://bugs.launchpad.net/ubuntu/+source/software-properties/+bug/1249080

.. note::

    On Ubuntu systems, the ``python-software-properties`` package should be
    installed for better support of PPA repositories. To check if this package
    is installed, run ``dpkg -l python-software-properties``.

    Also, some Ubuntu releases have a bug_ in their
    ``python-software-properties`` package, a missing dependency on pycurl, so
    ``python-pycurl`` will need to be manually installed if it is not present
    once ``python-software-properties`` is installed.

    On Ubuntu & Debian systems, the ``python-apt`` package is required to be
    installed. To check if this package is installed, run ``dpkg -l python-apt``.
    ``python-apt`` will need to be manually installed if it is not present.

i(tabsolute_importtprint_functiontunicode_literalsN(tCommandExecutionErrortSaltInvocationError(tSTATE_INTERNAL_KEYWORDS(tsixcC@s
dtkS(uI
    Only load if modifying repos is available for this package type
    upkg.mod_repo(t__salt__(((s7/usr/lib/python2.7/site-packages/salt/states/pkgrepo.pyt__virtual__iscK@s|	d|kr8tjjjdd�|jd�|d<ni|d6id6d8d6dd	6}d
tkr~t|d<d|d	<|Sd|kr�d
|ks�d|kr�t|d<d|d	<nd|kr�d
|ks�d|kr�t|d<d|d	<nd|kr#d|kr#t|d<d|d	<nd|krGt|d<d|d	<|S|jdd8�}|jdd8�}|d8k	r�|d8k	r�t|d<d|d	<|S|d8kr�|d8kr�t}n|}t	dd@krj|d8k	r,ydj
d|f�}Wq,tk
r(dj
dtj
|�f�}q,Xn|d8k	rNtjjj|�ntjjj|�|d<n�t	ddAkr�d |kr�|jd �|d<nd|kr�||d<n|d8k	r�tjjj|�ntjjj|�|d<nNt	ddBkrA|d8k	r%tjjj|�ntjjj|�|d<nxtD]}|j|d8�qHWy&td
|d#|jd$d8��}Wn4tk
r�}	t|d<d%j||	�|d	<|SXd&tkr�td&d'||�}
n|}
t	dd(krtjjjj|�}n|r|jd)d8�|
jd)d8�x�|
D]�}||kr�|dkr�t	ddkr�tjjj|
|�s�Pq�q�Pq�PqB|d*kr�t|
|�t||�kr�Pq�qB|d+kr�t	dd(kr�|
|j�}t|d,�|d,)g||jd-�D]}|j�^q\}
}}|
j�}
t|
d,�|
d,)||
krpPnd.|kr�tjjjj|d.�}||kr�Pq�q�qB|d.krt	ddkrtjjjj||�}tjjjj|
|�}||kr�Pq�qB|d/krR|
|rRt|
|�t||�kr�Pq�qBt	ddCkr�td0�|
|||fD��r�tjjj|
|�tjjj||�kr�Pq�qBtj
|
|�tj
||�krBPqBqBWt|d<d1j|�|d	<|Sntd2r�d3j|�|d	<|r�xn|
D]U}|
j|�|j|�kr;i|
j|�d46|j|�d56|d|<q;q;Wn||dd<|S|jd6t�r�tjj j!|d)d7��Wd8QXny?t	dd(krtd9|d:t"|�ntd9||�Wn4t#k
rV}	t|d<d;j||	�|d	<|SXy�td
|d#|jd$d8��}|r�xq|
D]U}|j|�|j|�kr�i|j|�d46|j|�d56|d|<q�q�Wni|d6|d<t|d<d<j|�|d	<Wn3t#k
rI	}	t|d<d=j||	�|d	<nX|drx	t$j%td>j&j'jd?d8�n|S(Du�
    This state manages software package repositories. Currently, :mod:`yum
    <salt.modules.yumpkg>`, :mod:`apt <salt.modules.aptpkg>`, and :mod:`zypper
    <salt.modules.zypper>` repositories are supported.

    **YUM/DNF/ZYPPER-BASED SYSTEMS**

    .. note::
        One of ``baseurl`` or ``mirrorlist`` below is required. Additionally,
        note that this state is not presently capable of managing more than one
        repo in a single repo file, so each instance of this state will manage
        a single repo file containing the configuration for a single repo.

    name
        This value will be used in two ways: Firstly, it will be the repo ID,
        as seen in the entry in square brackets (e.g. ``[foo]``) for a given
        repo. Secondly, it will be the name of the file as stored in
        /etc/yum.repos.d (e.g. ``/etc/yum.repos.d/foo.conf``).

    enabled : True
        Whether or not the repo is enabled. Can be specified as True/False or
        1/0.

    disabled : False
        Included to reduce confusion due to APT's use of the ``disabled``
        argument. If this is passed for a YUM/DNF/Zypper-based distro, then the
        reverse will be passed as ``enabled``. For example passing
        ``disabled=True`` will assume ``enabled=False``.

    humanname
        This is used as the "name" value in the repo file in
        ``/etc/yum.repos.d/`` (or ``/etc/zypp/repos.d`` for SUSE distros).

    baseurl
        The URL to a yum repository

    mirrorlist
        A URL which points to a file containing a collection of baseurls

    comments
        Sometimes you want to supply additional information, but not as
        enabled configuration. Anything supplied for this list will be saved
        in the repo configuration with a comment marker (#) in front.

    gpgautoimport
        Only valid for Zypper package manager. If set to True, automatically
        trust and import public GPG key for the repository. The key should be
        specified with ``gpgkey`` parameter. See details below.

    Additional configuration values seen in YUM/DNF/Zypper repo files, such as
    ``gpgkey`` or ``gpgcheck``, will be used directly as key-value pairs.
    For example:

    .. code-block:: yaml

        foo:
          pkgrepo.managed:
            - humanname: Personal repo for foo
            - baseurl: https://mydomain.tld/repo/foo/$releasever/$basearch
            - gpgkey: file:///etc/pki/rpm-gpg/foo-signing-key
            - gpgcheck: 1


    **APT-BASED SYSTEMS**

    ppa
        On Ubuntu, you can take advantage of Personal Package Archives on
        Launchpad simply by specifying the user and archive name. The keyid
        will be queried from launchpad and everything else is set
        automatically. You can override any of the below settings by simply
        setting them as you would normally. For example:

        .. code-block:: yaml

            logstash-ppa:
              pkgrepo.managed:
                - ppa: wolfnet/logstash

    ppa_auth
        For Ubuntu PPAs there can be private PPAs that require authentication
        to access. For these PPAs the username/password can be passed as an
        HTTP Basic style username/password combination.

        .. code-block:: yaml

            logstash-ppa:
              pkgrepo.managed:
                - ppa: wolfnet/logstash
                - ppa_auth: username:password

    name
        On apt-based systems this must be the complete entry as it would be
        seen in the sources.list file.  This can have a limited subset of
        components (i.e. 'main') which can be added/modified with the
        ``comps`` option.

        .. code-block:: yaml

            precise-repo:
              pkgrepo.managed:
                - name: deb http://us.archive.ubuntu.com/ubuntu precise main

        .. note::

            The above example is intended as a more readable way of configuring
            the SLS, it is equivalent to the following:

            .. code-block:: yaml

                'deb http://us.archive.ubuntu.com/ubuntu precise main':
                  pkgrepo.managed

    disabled : False
        Toggles whether or not the repo is used for resolving dependencies
        and/or installing packages.

    enabled : True
        Included to reduce confusion due to YUM/DNF/Zypper's use of the
        ``enabled`` argument. If this is passed for an APT-based distro, then
        the reverse will be passed as ``disabled``. For example, passing
        ``enabled=False`` will assume ``disabled=False``.

    architectures
        On apt-based systems, architectures can restrict the available
        architectures that the repository provides (e.g. only amd64).
        architectures should be a comma-separated list.

    comps
        On apt-based systems, comps dictate the types of packages to be
        installed from the repository (e.g. main, nonfree, ...).  For
        purposes of this, comps should be a comma-separated list.

    file
       The filename for the .list that the repository is configured in.
       It is important to include the full-path AND make sure it is in
       a directory that APT will look in when handling packages

    dist
       This dictates the release of the distro the packages should be built
       for.  (e.g. unstable). This option is rarely needed.

    keyid
       The KeyID or a list of KeyIDs of the GPG key to install.
       This option also requires the ``keyserver`` option to be set.

    keyserver
       This is the name of the keyserver to retrieve gpg keys from.  The
       ``keyid`` option must also be set for this option to work.

    key_url
       URL to retrieve a GPG key from. Allows the usage of ``http://``,
       ``https://`` as well as ``salt://``.

       .. note::

           Use either ``keyid``/``keyserver`` or ``key_url``, but not both.

    key_text
        The string representation of the GPG key to install.

        .. versionadded:: 2018.3.0

       .. note::

           Use either ``keyid``/``keyserver``, ``key_url``, or ``key_text`` but
           not more than one method.

    consolidate : False
       If set to ``True``, this will consolidate all sources definitions to the
       sources.list file, cleanup the now unused files, consolidate components
       (e.g. main) for the same URI, type, and architecture to a single line,
       and finally remove comments from the sources.list file.  The consolidate
       will run every time the state is processed. The option only needs to be
       set on one repo managed by salt to take effect.

    clean_file : False
       If set to ``True``, empty the file before config repo

       .. note::
           Use with care. This can be dangerous if multiple sources are
           configured in the same file.

       .. versionadded:: 2015.8.0

    refresh : True
       If set to ``False`` this will skip refreshing the apt package database
       on debian based systems.

    refresh_db : True
       .. deprecated:: 2018.3.0
           Use ``refresh`` instead.

    require_in
       Set this to a list of pkg.installed or pkg.latest to trigger the
       running of apt-get update prior to attempting to install these
       packages. Setting a require in the pkg state will not work for this.
    u
refresh_dbuNeonu�The 'refresh_db' argument to 'pkg.mod_repo' has been renamed to 'refresh'. Support for using 'refresh_db' will be removed in the Neon release of Salt.urefreshunameuchangesuresultuucommentupkg.get_repou0Repo management not implemented on this platformukey_urlukeyidu	keyserveru@You may not use both "keyid"/"keyserver" and "key_url" argument.ukey_textuAYou may not use both "keyid"/"keyserver" and "key_text" argument.u7You may not use both "key_url" and "key_text" argument.urepoue'repo' is not a supported argument for this state. The 'name' argument is probably what was intended.uenabledudisabledu'Only one of enabled/disabled is alloweduosuUbuntuuMintu:uppau	os_familyuRedHatuSuseu	humannameu	NILinuxRTuPokytppa_authuppa_authu!Failed to examine repo '{0}': {1}upkg.expand_repo_deftrepouDebianufileucompsulineiu#ucommentsu
architecturescs@s|]}t|t�VqdS(N(t
isinstancetbool(t.0tx((s7/usr/lib/python2.7/site-packages/salt/states/pkgrepo.pys	<genexpr>�su%Package repo '{0}' already configuredutestu�Package repo '{0}' would be configured. This may cause pkg states to behave differently than stated if this action is repeated without test=True, due to the differences in the configured repositories.unewuoldu
clean_fileuwNupkg.mod_repotsaltenvu#Failed to configure repo '{0}': {1}uConfigured package repo '{0}'u+Failed to confirm config of repo '{0}': {1}u	test.pingu
pkg._avail(uUbuntuuMint(uRedHatuSuse(u	NILinuxRTuPoky(uRedHatuSuse((tsalttutilstversionst
warn_untiltpoptNoneRtFalsetTruet
__grains__tjoint	TypeErrorRt	text_typetdatatis_truet_STATE_INTERNAL_KEYWORDStgetRtformattpkgtdebt	strip_uritsortedtsplitt	partitiontstriptcombine_commentstrpmtsettanyt__opts__tfilestfopent__env__t	Exceptiontsystmodulest
__module__t__context__(tnametppatkwargstrettenabledtdisabledR
tkwargtpretexctsanitizedkwargstsanitizedsplitRt	reposplitt_tpre_commentst
post_commentstprecommentst
kwargcommentstpost((s7/usr/lib/python2.7/site-packages/salt/states/pkgrepo.pytmanagedps8�



$

$







	
%"
""


 5

 	&




%	

%



c@s�i|d6id6dd6dd6}d�krltdd krl�jd�}|jd
�sld
|}qlnt�fd�d!D��}|r�dtkr�t|d<d|d<|Sy&td|d�jdd��}Wn4tk
r}t|d<dj	||�|d<|SX|s6dj	|�|d<t
|d<|StdrWdj	|�|d<|Sytdd|��Wn1ttfk
r�}t|d<|j
|d<|SXtd�}||krz||dd<dj	|�|d<|s�t
|d<q�ytd|��}Wn<ttfk
rE}t|d<|dcdj	|�7<q�Xt
|d<||dd<|dcdj	|�7<nt|d<dj	|�|d<|S("u�
    This function deletes the specified repo on the system, if it exists. It
    is essentially a wrapper around pkg.del_repo.

    name
        The name of the package repo, as it would be referred to when running
        the regular package manager commands.

    **UBUNTU-SPECIFIC OPTIONS**

    ppa
        On Ubuntu, you can take advantage of Personal Package Archives on
        Launchpad simply by specifying the user and archive name.

        .. code-block:: yaml

            logstash-ppa:
              pkgrepo.absent:
                - ppa: wolfnet/logstash

    ppa_auth
        For Ubuntu PPAs there can be private PPAs that require authentication
        to access. For these PPAs the username/password can be specified.  This
        is required for matching if the name format uses the ``ppa:`` specifier
        and is private (requires username/password to access, which is encoded
        in the URI).

        .. code-block:: yaml

            logstash-ppa:
              pkgrepo.absent:
                - ppa: wolfnet/logstash
                - ppa_auth: username:password

    keyid
        If passed, then the GPG key corresponding to the passed KeyID will also
        be removed.

    keyid_ppa : False
        If set to ``True``, the GPG key's ID will be looked up from
        ppa.launchpad.net and removed, and the ``keyid`` argument will be
        ignored.

        .. note::
            This option will be disregarded unless the ``ppa`` argument is
            present.
    unameuchangesuresultuucommentuppauosuUbuntuuMintuppa:c3@s$|]}�j|�dk	VqdS(N(RR(R
R(R7(s7/usr/lib/python2.7/site-packages/salt/states/pkgrepo.pys	<genexpr>Zsukeyidu	keyid_ppaupkg.del_repo_keyu8Repo key management is not implemented for this platformupkg.get_repoR	uppa_authu#Failed to configure repo '{0}': {1}uPackage repo {0} is absentutestu�Package repo '{0}' will be removed. This may cause pkg states to behave differently than stated if this action is repeated without test=True, due to the differences in the configured repositories.upkg.del_repoR
upkg.list_reposurepouRemoved repo {0}u, but failed to remove key: {0}u, and keyid {0}uFailed to remove repo {0}N(uUbuntuuMint(ukeyidu	keyid_ppa(RRRt
startswithR+RRRRR RR,Rtstrerror(R5R7R8t
remove_keyR
R=trepost
removed_keyid((R7s7/usr/lib/python2.7/site-packages/salt/states/pkgrepo.pytabsent sh0















(t__doc__t
__future__RRRR1tsalt.exceptionsRRt
salt.stateRRtsalt.utils.dataRtsalt.utils.filestsalt.utils.pkg.debtsalt.utils.pkg.rpmtsalt.utils.versionstsalt.extRRRRGRM(((s7/usr/lib/python2.7/site-packages/salt/states/pkgrepo.pyt<module>Vs	��

Zerion Mini Shell 1.0