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

�
���^c@@s�dZddlmZmZddlZddlZddlZddlm	Z	ej
e�ZdZ
d�Zdd�Zd�Zed	�Zed
�Zd�ZdS(u�
Microsoft Update files management via wusa.exe

:maintainer:    Thomas Lemarchand
:platform:      Windows
:depends:       PowerShell

.. versionadded:: 2018.3.4
i(tabsolute_importtunicode_literalsN(tCommandExecutionErroruwusacC@sMtjjj�stdfStddddt�}|dsItdfStS(u
    Load only on Windows
    u!Only available on Windows systemsucmd.shell_infotshellu
powershelltlist_modulesu	installeduPowerShell not available(tsalttutilstplatformt
is_windowstFalset__salt__t__virtualname__(tpowershell_info((s9/usr/lib/python2.7/site-packages/salt/modules/win_wusa.pyt__virtual__s


cC@sEd|j�kr$dj|�}ntjd|�td|ddd|�}d|krf|d=n|jd	d
�r�|d	j�d}t|d|��nd
|ks�|d
dkr�tdj|�d|��n|dd
kr�d|d<ny#tj	j
j|ddt�}Wn#t
k
r@tdd|��nX|S(u}
    Execute the desired powershell command and ensure that it returns data
    in JSON format and load that into python
    uconvertto-jsonu{0} | ConvertTo-JsonuPowerShell: %sucmd.run_allRu
powershelltcwdupidustderruitinfouretcodeuIssue executing PowerShell {0}ustdoutu{}tstrictuNo JSON results from PowerShell(tlowertformattlogtdebugR
tgett
splitlinesRRRtjsontloadsR	t
ValueError(tcmdRtretterror((s9/usr/lib/python2.7/site-packages/salt/modules/win_wusa.pyt_pshell_json)s(

#
cC@s,tdddj|�dddt�dkS(u
    Check if a specific KB is installed.

    Args:

        name (str):
            The name of the KB to check

    Returns:
        bool: ``True`` if installed, otherwise ``False``

    CLI Example:

    .. code-block:: bash

        salt '*' wusa.is_installed KB123456
    ucmd.retcodeRuGet-HotFix -Id {0}Ru
powershelltignore_retcodei(R
RtTrue(tname((s9/usr/lib/python2.7/site-packages/salt/modules/win_wusa.pytis_installedLscC@s�d|dg}|r%|jd�n
|jd�td|dt�}tjj|�}idj|�d6d	d
6}||kr�t||��n|r�tdj|���ntS(u�
    Install a KB from a .msu file.

    Args:

        path (str):
            The full path to the msu file to install

        restart (bool):
            ``True`` to force a restart if required by the installation. Adds
            the ``/forcerestart`` switch to the ``wusa.exe`` command. ``False``
            will add the ``/norestart`` switch instead. Default is ``False``

    Returns:
        bool: ``True`` if successful, otherwise ``False``

    Raise:
        CommandExecutionError: If the package is already installed or an error
            is encountered

    CLI Example:

    .. code-block:: bash

        salt '*' wusa.install C:/temp/KB123456.msu
    uwusa.exeu/quietu
/forcerestartu
/norestartucmd.retcodeRu{0} is already installedi$u
Unknown erroriWuUnknown error: {0}(tappendR
RtostpathtbasenameRR(R$trestartRtret_codet	file_nameterrors((s9/usr/lib/python2.7/site-packages/salt/modules/win_wusa.pytinstallcs

cC@s/dddg}tjjtjj|��d}tjj|�rS|j|�n5|jdj|j�jd�r~|dn|��|r�|jd�n
|jd	�t	d
|dt
�}idj|�d
6dj|�d6dd6}||kr
t||��n|r+tdj|���nt
S(u�
    Uninstall a specific KB.

    Args:

        path (str):
            The full path to the msu file to uninstall. This can also be just
            the name of the KB to uninstall

        restart (bool):
            ``True`` to force a restart if required by the installation. Adds
            the ``/forcerestart`` switch to the ``wusa.exe`` command. ``False``
            will add the ``/norestart`` switch instead. Default is ``False``

    Returns:
        bool: ``True`` if successful, otherwise ``False``

    Raises:
        CommandExecutionError: If an error is encountered

    CLI Example:

    .. code-block:: bash

        salt '*' wusa.uninstall KB123456

        # or

        salt '*' wusa.uninstall C:/temp/KB123456.msu
    uwusa.exeu
/uninstallu/quietiu/kb:{0}ukbiu
/forcerestartu
/norestartucmd.retcodeRu{0} does not support uninstalli $�u{0} not installedi$u*Unknown error. Try specifying an .msu fileiWuUnknown error: {0}(R#R$tsplitextR%texistsR"RRt
startswithR
RR(R$R&RtkbR'R)((s9/usr/lib/python2.7/site-packages/salt/modules/win_wusa.pyt	uninstall�s$ "/

cC@s8g}td�}x|D]}|j|d�qW|S(u�
    Get a list of updates installed on the machine

    Returns:
        list: A list of installed updates

    CLI Example:

    .. code-block:: bash

        salt '*' wusa.list
    uGet-HotFix | Select HotFixIDuHotFixID(RR"(tkbsRtitem((s9/usr/lib/python2.7/site-packages/salt/modules/win_wusa.pytlist�s


(t__doc__t
__future__RRtloggingR#tsalt.utils.platformRtsalt.exceptionsRt	getLoggert__name__RRR
tNoneRR!R	R*R/R2(((s9/usr/lib/python2.7/site-packages/salt/modules/win_wusa.pyt<module>
s	#	1=

Zerion Mini Shell 1.0