HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/states/__pycache__/win_wusa.cpython-310.pyc
o

�N�g�
�@sVdZddlZddlZddlZddlmZmZe�e	�Z
dZdd�Zdd�Z
d	d
�ZdS)z�
Microsoft Updates (KB) Management

This module provides the ability to enforce KB installations from files (.msu),
without WSUS or Windows Update

.. versionadded:: 2018.3.4
�N)�CommandExecutionError�SaltInvocationErrorZwusacCstjj��sdStS)z
    Load only on Windows
    )Fz!Only available on Windows systems)�salt�utils�platformZ
is_windows�__virtualname__�rr�H/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/win_wusa.py�__virtual__sr
c
Cs>|iddd�}|s
td��|std��td|�r&d|d<|�d	�|d
<|Stddur=d|d<|�d
�|d
<d|d<|Std|td�}|sXd�tjj�|�t�}||d
<|Sd}ztd|�Wnt	yw}z	|j
}WYd}~nd}~wwtd|�r�|�d|��|d
<ddd�|d<d|d<|S|�d|��|d
<|S)aR
    Ensure an update is installed on the minion

    Args:

        name(str):
            Name of the Windows KB ("KB123456")

        source (str):
            Source of .msu file corresponding to the KB

    Example:

    .. code-block:: yaml

        KB123456:
          wusa.installed:
            - source: salt://kb123456.msu
    F���name�changes�result�commentzMust specify a KB "name"z'Must specify a "source" file to install�wusa.is_installedTrz already installedr�testNz would be installedz
cp.cache_file)�pathZsaltenvz$Unable to cache {} from saltenv "{}"zwusa.installz was installed. ��old�newrz failed to install. )r�__salt__�__opts__Z__env__�formatrr�urlZredact_http_basic_authr�message)r
�source�retZcached_source_path�msgZadditional_comment�excrrr	�	installed!sF����r cCs�|iddd�}td|�sd|d<|�d�|d<|Std	dur1d
|d<|�d�|d<d
|d<|Std|�td|�sQ|�d
�|d<ddd�|d<d|d<|S|�d�|d<|S)z�
    Ensure an update is uninstalled from the minion

    Args:

        name(str):
            Name of the Windows KB ("KB123456")

    Example:

    .. code-block:: yaml

        KB123456:
          wusa.uninstalled
    FrrrTrz already uninstalledrrNz would be uninstalledzwusa.uninstallz was uninstalledrrz failed to uninstall)rr)r
rrrr	�uninstalledgs$�r!)�__doc__�loggingZsalt.utils.platformrZsalt.utils.urlZsalt.exceptionsrr�	getLogger�__name__�logrr
r r!rrrr	�<module>s	

F