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

�
���^c@@s�dZddlmZmZmZddlZddlmZddlZ	ddl
Z	ddlZ	eje
�ZdZd�Zdd�Zdd�Zeeeeeddd	�ZdS(
u�
Installation of Windows Updates using the Windows Update Agent

.. versionadded:: 2017.7.0

Salt can manage Windows updates via the "wua" state module. Updates can be
installed and removed. Update management declarations are as follows:

For installation:

.. code-block:: yaml

    # Install a single update using the KB
    KB3194343:
      wua.installed

    # Install a single update using the name parameter
    install_update:
      wua.installed:
        - name: KB3194343

    # Install multiple updates using the updates parameter and a combination of
    # KB number and GUID
    install_updates:
      wua.installed:
       - updates:
         - KB3194343
         - bb1dbb26-3fb6-45fd-bb05-e3c8e379195c

For removal:

.. code-block:: yaml

    # Remove a single update using the KB
    KB3194343:
      wua.removed

    # Remove a single update using the name parameter
    remove_update:
      wua.removed:
        - name: KB3194343

    # Remove multiple updates using the updates parameter and a combination of
    # KB number and GUID
    remove_updates:
      wua.removed:
       - updates:
         - KB3194343
         - bb1dbb26-3fb6-45fd-bb05-e3c8e379195c
i(tabsolute_importtunicode_literalstprint_functionN(tsixuwuacC@s9tjjj�stdfStjjjs5tdfStS(u(
    Only valid on Windows machines
    u%WUA: Only available on Window systemsuWUA: Requires PyWin32 libraries(tsalttutilstplatformt
is_windowstFalset
win_updatetHAS_PYWIN32t__virtualname__(((s7/usr/lib/python2.7/site-packages/salt/states/win_wua.pyt__virtual__Cs


cC@s&t|tj�r|g}n|s-|}ni|d6id6td6dd6}tjjj�}|j|�}|j	�dkr�d|d<|Stjjj
�}x<|jD]1}tjjj
|j�s�|jj|�q�q�Wtjjj
�}g}xV|jD]K}tjjj
|j�s4|jj|�q|jd�|jD��qW|j	�dkr�d	|d<|dcd
j|�7<|Stdr�d|d<d|d<xI|jD]>}	|dcd
7<|dcdj|	jj|	jg�7<q�W|S|j|�|j|�|j�|j�j�}
x�|j�D]�}tjjj
|
|d�s�ii|
|dd dd6|
|dd6|6|dd<t|d<q<ii|
|dd dd6|
|dd6|
|dd6|6|dd<q<W|djdt�rd|d<n
d|d<|S(uu
    Ensure Microsoft Updates are installed. Updates will be downloaded if
    needed.

    Args:

        name (str):
            The identifier of a single update to install.

        updates (list):
            A list of identifiers for updates to be installed. Overrides
            ``name``. Default is None.

    .. note:: Identifiers can be the GUID, the KB number, or any part of the
       Title of the Microsoft update. GUIDs and KBs are the preferred method
       to ensure you're installing the correct update.

    .. warning:: Using a partial KB number or a partial Title could result in
       more than one update being installed.

    Returns:
        dict: A dictionary containing the results of the update

    CLI Example:

    .. code-block:: yaml

        # using a GUID
        install_update:
          wua.installed:
            - name: 28cf1b09-2b1a-458c-9bd1-971d1b26b211

        # using a KB
        install_update:
          wua.installed:
            - name: KB3194343

        # using the full Title
        install_update:
          wua.installed:
            - name: Security Update for Adobe Flash Player for Windows 10 Version 1607 (for x64-based Systems) (KB3194343)

        # Install multiple updates
        install_updates:
          wua.installed:
            - updates:
              - KB3194343
              - 28cf1b09-2b1a-458c-9bd1-971d1b26b211
    unameuchangesuresultuucommentiuNo updates foundcs@s|]}d|VqdS(uKBN((t.0tkb((s7/usr/lib/python2.7/site-packages/salt/states/win_wua.pys	<genexpr>�suUpdates already installed: u
 - utestuUpdates will be installed:u
u: u	InstalleduTitlei(u...uKBsufaileduNeedsRebootu	installeduUpdates faileduUpdates installed successfullyN(t
isinstanceRtstring_typestTrueRRR	tWindowsUpdateAgenttsearchtcounttUpdatestupdatestdatatis_truetIsDownloadedtAddtIsInstalledtextendtKBArticleIDstjoint__opts__tNonetIdentitytUpdateIDtTitletdownloadtinstalltrefreshtlistRtget(tnameRtrettwuatinstall_listR$titemR%tinstalled_updatestupdatet	post_info((s7/usr/lib/python2.7/site-packages/salt/states/win_wua.pyt	installedPsj2	










"

c	C@s�t|tj�r|g}n|s-|}ni|d6id6td6dd6}tjjj�}|j|�}|j	�dkr�d|d<|Stjjj
�}g}xV|jD]K}tjjj
|j�r�|jj|�q�|jd�|jD��q�W|j	�dkr:d	|d<|dcd
j|�7<|Stdr�d|d<d|d<xI|jD]>}|dcd
7<|dcdj|jj|jg�7<qbW|S|j|�|j�|j�j�}x�|j�D]�}tjjj
||d�rIii||dd dd6||dd6|6|dd<t|d<q�ii||dd dd6||dd6||dd6|6|dd<q�W|djdt�r�d|d<n
d|d<|S(uN
    Ensure Microsoft Updates are uninstalled.

    Args:

        name (str):
            The identifier of a single update to uninstall.

        updates (list):
            A list of identifiers for updates to be removed. Overrides ``name``.
            Default is None.

    .. note:: Identifiers can be the GUID, the KB number, or any part of the
       Title of the Microsoft update. GUIDs and KBs are the preferred method
       to ensure you're uninstalling the correct update.

    .. warning:: Using a partial KB number or a partial Title could result in
       more than one update being removed.

    Returns:
        dict: A dictionary containing the results of the removal

    CLI Example:

    .. code-block:: yaml

        # using a GUID
        uninstall_update:
          wua.removed:
            - name: 28cf1b09-2b1a-458c-9bd1-971d1b26b211

        # using a KB
        uninstall_update:
          wua.removed:
            - name: KB3194343

        # using the full Title
        uninstall_update:
          wua.removed:
            - name: Security Update for Adobe Flash Player for Windows 10 Version 1607 (for x64-based Systems) (KB3194343)

        # Install multiple updates
        uninstall_updates:
          wua.removed:
            - updates:
              - KB3194343
              - 28cf1b09-2b1a-458c-9bd1-971d1b26b211
    unameuchangesuresultuucommentiuNo updates foundcs@s|]}d|VqdS(uKBN((R
R((s7/usr/lib/python2.7/site-packages/salt/states/win_wua.pys	<genexpr>#suUpdates already removed: u
 - utestuUpdates will be removed:u
u: u	InstalleduTitlei(u...uKBsufaileduNeedsRebooturemoveduUpdates faileduUpdates removed successfullyN(RRRRRRR	RRRRRRRRRRRRRR R!R"R#t	uninstallR&R'RR((	R)RR*R+R2tremoved_updatesR-R/R0((s7/usr/lib/python2.7/site-packages/salt/states/win_wua.pytremoved�s`1	









"

cC@s�i|d6id6td6dd6}tjjj�}	|	jd|dtd|d	|d
|d|d|d
|�}
|
j�dkr�d|d<|St|
j�j��}|	j	|�}tjjj
�}
x<|jD]1}tjjj
|j�s�|
jj|�q�q�Wtjjj
�}x<|jD]1}tjjj
|j�s$|jj|�q$q$Wtdr�d|d<d|d<xI|jD]>}|dcd7<|dcdj|jj|jg�7<q�W|S|	j|
�|	j|�|	j�|	j�j�}x�|j�D]�}tjjj
||d�suii||dd dd6||dd6|6|dd<t|d<q
ii||dd dd6||dd6||dd6|6|dd<q
W|djdt�r�d|d<n
d|d<|S(u�
    Ensure Microsoft Updates that match the passed criteria are installed.
    Updates will be downloaded if needed.

    This state allows you to update a system without specifying a specific
    update to apply. All matching updates will be installed.

    Args:

        name (str):
            The name has no functional value and is only used as a tracking
            reference

        software (bool):
            Include software updates in the results (default is True)

        drivers (bool):
            Include driver updates in the results (default is False)

        skip_hidden (bool):
            Skip updates that have been hidden. Default is False.

        skip_mandatory (bool):
            Skip mandatory updates. Default is False.

        skip_reboot (bool):
            Skip updates that require a reboot. Default is True.

        categories (list):
            Specify the categories to list. Must be passed as a list. All
            categories returned by default.

            Categories include the following:

            * Critical Updates
            * Definition Updates
            * Drivers (make sure you set drivers=True)
            * Feature Packs
            * Security Updates
            * Update Rollups
            * Updates
            * Update Rollups
            * Windows 7
            * Windows 8.1
            * Windows 8.1 drivers
            * Windows 8.1 and later drivers
            * Windows Defender

        severities (list):
            Specify the severities to include. Must be passed as a list. All
            severities returned by default.

            Severities include the following:

            * Critical
            * Important


    Returns:
        dict: A dictionary containing the results of the update

    CLI Example:

    .. code-block:: yaml

        # Update the system using the state defaults
        update_system:
          wua.uptodate

        # Update the drivers
        update_drivers:
          wua.uptodate:
            - software: False
            - drivers: True
            - skip_reboot: False

        # Apply all critical updates
        update_critical:
          wua.uptodate:
            - severities:
              - Critical
    unameuchangesuresultuucommenttskip_hiddentskip_installedtskip_mandatorytskip_reboottsoftwaretdriverst
categoriest
severitiesiuNo updates foundutestuUpdates will be installed:u
u: u	InstalleduTitlei(u...uKBsufaileduNeedsRebootu	installeduUpdates faileduUpdates installed successfullyN(RRRR	Rt	availableRR'tkeysRRRRRRRRRR RR!R"R#R$R%R&RR((R)R9R:R5R7R8R;R<R*R+tavailable_updatesRR,R$R-R%R/R0((s7/usr/lib/python2.7/site-packages/salt/states/win_wua.pytuptodateRsbZ

		







"

(t__doc__t
__future__RRRtloggingtsalt.extRtsalt.utils.dataRtsalt.utils.platformtsalt.utils.win_updatet	getLoggert__name__tlogRRR R1R4RRR@(((s7/usr/lib/python2.7/site-packages/salt/states/win_wua.pyt<module>3s$	
�}

Zerion Mini Shell 1.0