File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/__pycache__/win_update.cpython-310.pyc
Back
o ;j,� � @ s� d Z ddlZddlZddlZddlZddlZddlmZ zddl Z ddl ZdZW n e y3 dZY nw e�e�Zdddd �Zd Zdd� ZG d d� d�ZG dd� d�Zdd� ZdS )z/ Classes for working with Windows Update Agent � N)�CommandExecutionErrorTFzNever Requires RebootzAlways Requires RebootzCan Require Reboot)r � � Z win_updatec C s t jj�� sdS tsdS tS )N)Fz%win_update: Only available on Windows)Fzwin_update: Missing pywin32)�salt�utils�platformZ is_windows�HAS_PYWIN32�__virtualname__� r r �I/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/win_update.py�__virtual__ s r c @ s: e Zd ZdZddd�Zdd� Zdd� Zd d � Zdd� Zd S )�Updatesa] Wrapper around the 'Microsoft.Update.UpdateColl' instance Adds the list and summary functions. For use by the WindowUpdateAgent class. Code Example: .. code-block:: python # Create an instance updates = Updates() # Bind to the collection object found = updates.updates # This exposes Collections properties and methods # https://msdn.microsoft.com/en-us/library/windows/desktop/aa386107(v=vs.85).aspx found.Count found.Add # To use custom functions, use the original instance # Return the number of updates inside the collection updates.count() # Return a list of updates in the collection and details in a dictionary updates.list() # Return a summary of the contents of the updates collection updates.summary() ZSoftwareZDriver)r r c C s@ t jj�� � tj�d�| _W d � dS 1 sw Y dS )zd Initialize the updates collection. Can be accessed via ``Updates.updates`` �Microsoft.Update.UpdateCollN)r r �winapi�Com�win32com�client�Dispatch�updates��selfr r r �__init__I s "�zUpdates.__init__c C s | j jS )aN Return how many records are in the Microsoft Update Collection Returns: int: The number of updates in the collection Code Example: .. code-block:: python import salt.utils.win_update updates = salt.utils.win_update.Updates() updates.count() )r �Countr r r r �countQ s z Updates.countc C s | � � dkrdS t�d� i }| jD ]s}zt|jj�}W n ty, t�d� d}Y nw z|jj}W n tyC t�d� d}Y nw |j j t|j�| j |j |jt|j�t|j�t|j�t|j�t|j�t|j�|t| dd� |jD �d d� |jD �|jd �||j j <