%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //lib/python2.7/site-packages/salt/modules/kernelpkg_linux_apt.pyo

�
���^c@@sAdZddlmZmZmZddlZddlZddlZyJddlm	Z	ddl
mZddl
mZddlmZeZWnek
r�eZnXeje�ZdZd	�Zd
�Zd�Zd�Zd
�Zd�Zedd�Z d�Z!d�Z"ed�Z#d�Z$d�Z%d�Z&dS(u3
Manage Linux kernel packages on APT-based systems
i(tabsolute_importtprint_functiontunicode_literalsN(tsix(tLooseVersion(tfilter(tCommandExecutionErroru	kernelpkgcC@sRtstdfStjdd�dkr,tStjdd�dkrHtStdfS(	u7
    Load this module on Debian-based systems only
    u&Required library could not be importedu	os_familyuuKaliuDebianuCumulusu8Module kernelpkg_linux_apt: no APT based system detected(uKaliuDebian(tHAS_REQUIRED_LIBStFalset
__grains__tgett__virtualname__(((sD/usr/lib/python2.7/site-packages/salt/modules/kernelpkg_linux_apt.pyt__virtual__s
cC@s&dtkrtdtd�StdS(u�
    Return the version of the running kernel.

    CLI Example:

    .. code-block:: bash

        salt '*' kernelpkg.active
    upkg.normalize_nameu
kernelrelease(t__salt__R	(((sD/usr/lib/python2.7/site-packages/salt/modules/kernelpkg_linux_apt.pytactive*s
cC@s�tjdjt�t���}tddt�}|dkrIg}ntt	|j
|��}|dkrqgStt��d}tj
r�tg|D]}||^q�dt�Stg|D]}||^q�dtjt��SdS(u�
    Return a list of all installed kernels.

    CLI Example:

    .. code-block:: bash

        salt '*' kernelpkg.list_installed
    u^{0}-[\d.-]+-{1}$u
pkg.list_pkgstversions_as_listitcmptkeyN(tretcompiletformatt_package_prefixt_kernel_typeR
tTruetNonetlistRtmatchtlenRtPY2tsortedt_cmp_versiont	functoolst
cmp_to_key(tpkg_retpkgstresultt
prefix_lentpkg((sD/usr/lib/python2.7/site-packages/salt/modules/kernelpkg_linux_apt.pytlist_installed:s
		'cC@sotddjt�t���}|dkr5t�Stjd|�}dj|jd�|jd�t��S(u�
    Return the version of the latest kernel from the package repositories.

    CLI Example:

    .. code-block:: bash

        salt '*' kernelpkg.latest_available
    upkg.latest_versionu{0}-{1}uu^(\d+\.\d+\.\d+)\.(\d+)u{0}-{1}-{2}ii(R
RRRtlatest_installedRRtgroup(R#tversion((sD/usr/lib/python2.7/site-packages/salt/modules/kernelpkg_linux_apt.pytlatest_availableVs
cC@st�}|r|dSdS(u�
    Return the version of the latest installed kernel.

    CLI Example:

    .. code-block:: bash

        salt '*' kernelpkg.latest_installed

    .. note::
        This function may not return the same value as
        :py:func:`~salt.modules.kernelpkg_linux_apt.active` if a new kernel
        has been installed and the system has not yet been rebooted.
        The :py:func:`~salt.modules.kernelpkg_linux_apt.needs_reboot` function
        exists to detect this condition.
    i����N(R&R(R"((sD/usr/lib/python2.7/site-packages/salt/modules/kernelpkg_linux_apt.pyR'js	cC@stt��tt��kS(u�
    Detect if a new kernel version has been installed but is not running.
    Returns True if a new kernel is installed, False otherwise.

    CLI Example:

    .. code-block:: bash

        salt '*' kernelpkg.needs_reboot
    (t
_LooseVersionRR'(((sD/usr/lib/python2.7/site-packages/salt/modules/kernelpkg_linux_apt.pytneeds_reboot�scC@s�tdddjt�t���}t�}i|d6t�d6t�d6|d6|d6}|r�|r�tjd	�td
d|�n|S(u�
    Upgrade the kernel and optionally reboot the system.

    reboot : False
        Request a reboot if a new kernel is available.

    at_time : immediate
        Schedule the reboot at some point in the future. This argument
        is ignored if ``reboot=False``. See
        :py:func:`~salt.modules.system.reboot` for more details
        on this argument.

    CLI Example:

    .. code-block:: bash

        salt '*' kernelpkg.upgrade
        salt '*' kernelpkg.upgrade reboot=True at_time=1

    .. note::
        An immediate reboot often shuts down the system before the minion has a
        chance to return, resulting in errors. A minimal delay (1 minute) is
        useful to ensure the result is delivered to the master.
    upkg.installtnameu{0}-{1}uupgradesuactiveulatest_installedureboot_requestedureboot_requiredu&Rebooting system due to kernel upgradeu
system.reboottat_time(	R
RRR*R,RR'tlogtwarning(trebootR.R#t
_needs_reboottret((sD/usr/lib/python2.7/site-packages/salt/modules/kernelpkg_linux_apt.pytupgrade�s
	



cC@stt��tt��kS(u�
    Detect if a new kernel version is available in the repositories.
    Returns True if a new kernel is available, False otherwise.

    CLI Example:

    .. code-block:: bash

        salt '*' kernelpkg.upgrade_available
    (R+R*R'(((sD/usr/lib/python2.7/site-packages/salt/modules/kernelpkg_linux_apt.pytupgrade_available�scC@s�|t�kr'tdj|���n|t�krEtd��ndjt�|�}tjd|�td|�i|gd6S(uk
    Remove a specific version of the kernel.

    release
        The release number of an installed kernel. This must be the entire release
        number as returned by :py:func:`~salt.modules.kernelpkg_linux_apt.list_installed`,
        not the package name.

    CLI Example:

    .. code-block:: bash

        salt '*' kernelpkg.remove 4.4.0-70-generic
    u%Kernel release '{0}' is not installeduActive kernel cannot be removedu{0}-{1}uRemoving kernel package %su	pkg.purgeuremoved(R&RRRRR/tinfoR
(treleasettarget((sD/usr/lib/python2.7/site-packages/salt/modules/kernelpkg_linux_apt.pytremove�scC@slg}xXt�D]M}|t�kr+qn|rF|t�krFqn|jt|�d�qWi|d6S(u�
    Remove all unused kernel packages from the system.

    keep_latest : True
        In the event that the active kernel is not the latest one installed, setting this to True
        will retain the latest kernel package, in addition to the active one. If False, all kernel
        packages other than the active one will be removed.

    CLI Example:

    .. code-block:: bash

        salt '*' kernelpkg.cleanup
    uremoved(R&RR'textendR9(tkeep_latesttremovedtkernel((sD/usr/lib/python2.7/site-packages/salt/modules/kernelpkg_linux_apt.pytcleanup�scC@sdS(u5
    Return static string for the package prefix
    ulinux-image((((sD/usr/lib/python2.7/site-packages/salt/modules/kernelpkg_linux_apt.pyR	scC@stjdt��jd�S(u3
    Parse the kernel name and return its type
    u^[\d.-]+-(.+)$i(RRRR((((sD/usr/lib/python2.7/site-packages/salt/modules/kernelpkg_linux_apt.pyRscC@s<t|�}t|�}||kr(dS||kr8dSdS(u6
    Compare function for package version sorting
    i����ii(R+(titem1titem2tvers1tvers2((sD/usr/lib/python2.7/site-packages/salt/modules/kernelpkg_linux_apt.pyRs('t__doc__t
__future__RRRRtloggingRtsalt.extRtsalt.utils.versionsRR+tsalt.ext.six.movesRtsalt.exceptionsRRRtImportErrorRt	getLoggert__name__R/RRRR&R*R'R,RR4R5R9R>RRR(((sD/usr/lib/python2.7/site-packages/salt/modules/kernelpkg_linux_apt.pyt<module>s6


						,		"		

Zerion Mini Shell 1.0