%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/modules/freebsd_update.pyc

�
���^c@@s�dZddlmZmZmZddlZddlZddlm	Z	ddl
mZeje
�ZdZdZd�Zd	�Zd
d
ddd�Zd�Zd
�Zd�Zd�Zd�Zd�ZdS(u�
Support for freebsd-update utility on FreeBSD.

.. versionadded:: 2017.7.0

:maintainer:    George Mamalakis <mamalos@gmail.com>
:maturity:      new
:platform:      FreeBSD
i(tabsolute_importtunicode_literalstprint_functionN(tsix(tCommandNotFoundErrorufreebsd_updateufreebsd-updatecC@s^tddkrtdfSttd�dkr:tdfSdtdj�krZtd	fStS(
ut
    .. versionadded:: 2016.3.4

    Only work on FreeBSD RELEASEs >= 6.2, where freebsd-update was introduced.
    uosuFreeBSDuXThe freebsd_update execution module cannot be loaded: only available on FreeBSD systems.u	osreleaseg������@uBfreebsd_update is only available on FreeBSD versions >= 6.2-RELESEureleaseu
kernelreleaseu4freebsd_update is only available on FreeBSD RELEASES(t
__grains__tFalsetfloattlowert__virtualname__(((s?/usr/lib/python2.7/site-packages/salt/modules/freebsd_update.pyt__virtual__s


cK@s�tjjjd�}|s*td��ng}d|krY|jdj|d��nd|kr�|jdj|d��nd|kr�|jdj|d��nd	|kr�|jd
�nd|kr�|jdj|d��nd
|kr|jdj|d
��nd|krB|jdj|d��nd|krk|jdj|d��n|r�dj|dj|��S|S(u�
    .. versionadded:: 2016.3.4

    Private function that returns the freebsd-update command string to be
    executed. It checks if any arguments are given to freebsd-update and appends
    them accordingly.
    ufreebsd-updateu""freebsd-update" command not foundubasediru-b {0}uworkdiru-d {0}uconffileu-f {0}uforceu-Fukeyu-k {0}u
newreleaseu-r {0}userveru-s {0}uaddressu-t {0}u{0} {1}u (tsalttutilstpathtwhichRtappendtformattjoin(tkwargst
update_cmdtparams((s?/usr/lib/python2.7/site-packages/salt/modules/freebsd_update.pyt_cmd-s.ucK@sad}t|�}djg||||fD]}|^q+�}	|rkt|t�rktd|	|�}
ntd|	�}
t|t�r�x*tj|
�D]\}}|||<q�Wnd|
kr.|
ddkr.djg|
d|
dfD]}|r�|^q��}
dj|	||
�}tj	|�n/y|
d}Wnt
k
r\tj	d	�nX|S(
u�
    Helper function that wraps the execution of freebsd-update command.

    orig:
        Originating function that called _wrapper().

    pre:
        String that will be prepended to freebsd-update command.

    post:
        String that will be appended to freebsd-update command.

    err_:
        Dictionary on which return codes and stout/stderr are copied.

    run_args:
        Arguments to be passed on cmd.run_all.

    kwargs:
        Parameters of freebsd-update command.
    uu ucmd.run_alluretcodeiustdoutustderru3Unable to run "{0}" with run_args="{1}". Error: {2}uAcmd.run_all did not return a dictionary with a key named 'stdout'(RRt
isinstancetdictt__salt__Rt
itermitemsRtlogterrortKeyError(torigtpretpostterr_trun_argsRtrettcmdtxtcmd_strtrestktvtmsg((s?/usr/lib/python2.7/site-packages/salt/modules/freebsd_update.pyt_wrapperPs$.6
c	K@shd}d}i}ttd�dkr5|d7}n|d7}t|d<tdd|d	|d
||�S(u�
    .. versionadded:: 2016.3.4

    freebsd-update fetch wrapper. Based on the currently installed world and the
    configuration options set, fetch all available binary updates.

    kwargs:
        Parameters of freebsd-update command.
    uu	osreleasegffffff$@u--not-running-from-cronu env PAGER=catupython_shellufetchRRR!(RRtTrueR*(RRRR!((s?/usr/lib/python2.7/site-packages/salt/modules/freebsd_update.pytfetch~s


cK@s
td|�S(u�
    .. versionadded:: 2016.3.4

    freebsd-update install wrapper. Install the most recently fetched updates or
    upgrade.

    kwargs:
        Parameters of freebsd-update command.
    uinstall(R*(R((s?/usr/lib/python2.7/site-packages/salt/modules/freebsd_update.pytinstall�s
cK@s
td|�S(u�
    .. versionadded:: 2016.3.4

    freebsd-update rollback wrapper. Uninstalls the most recently installed
    updates.

    kwargs:
        Parameters of freebsd-update command.
    urollback(R*(R((s?/usr/lib/python2.7/site-packages/salt/modules/freebsd_update.pytrollback�s
cK@s�i}xfd	D]^}i}t|d||�}d|krN|ddkrN|Sd|kr
|d||<q
q
Wdjgtj|�D]\}}dj||�^q��S(
u�
    .. versionadded:: 2016.3.4

    Command that simplifies freebsd-update by running freebsd-update fetch first
    and then freebsd-update install.

    kwargs:
        Parameters of freebsd-update command.
    ufetchuinstallR uretcodeiustdoutu
u{0}: {1}(ufetchuinstall(R*RRt	iteritemsR(RtstdouttmodeR R"R'R(((s?/usr/lib/python2.7/site-packages/salt/modules/freebsd_update.pytupdate�s

cK@s
td|�S(u�
    .. versionadded:: 2016.3.4

    freebsd-update IDS wrapper function. Compares the system against a "known
    good" index of the installed release.

    kwargs:
        Parameters of freebsd-update command.
    uIDS(R*(R((s?/usr/lib/python2.7/site-packages/salt/modules/freebsd_update.pytids�s
cK@sd}tj|�|S(u�
    .. versionadded:: 2016.3.4

    Dummy function used only to print a message that upgrade is not available.
    The reason is that upgrade needs manual intervention and reboot, so even if
    used with:

       yes | freebsd-upgrade -r VERSION

    the additional freebsd-update install that needs to run after the reboot
    cannot be implemented easily.

    kwargs:
        Parameters of freebsd-update command.
    u+freebsd-update upgrade not yet implemented.(Rtwarning(RR)((s?/usr/lib/python2.7/site-packages/salt/modules/freebsd_update.pytupgrade�s
(ufreebsd-update(t__doc__t
__future__RRRtloggingtsalt.utils.pathRtsalt.extRtsalt.exceptionsRt	getLoggert__name__RR	t__virtual_aliases__R
RtNoneR*R,R-R.R2R3R5(((s?/usr/lib/python2.7/site-packages/salt/modules/freebsd_update.pyt<module>
s"		#.		
	
		

Zerion Mini Shell 1.0