File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/win_dism.cpython-310.pyc
Back
o ;j[X � @ s� d Z ddlZddlZddlZddlZddlZddlmZ e� e �ZdZz7ej j�� s,e�ej�ej�ej�d�d��rGej�ej�d�d�Znej�ej�d�d�Zej�ed�ZW n eyj e�d � dZY nw d d� Zd/dd �Z d0dd�Zd1dd�Zd/dd�Zd/dd�Zd/dd�Z d2dd�Z d3dd�Z!d4dd�Z"d/dd �Z#d/d!d"�Z$ d5d#d$�Z%d1d%d&�Z&d/d'd(�Z'd1d)d*�Z(d/d+d,�Z)d/d-d.�Z*dS )6z� Install features/packages for Windows using DISM, which is useful for minions not running server versions of Windows. Some functions are only available on Windows 10. � N)�CommandExecutionErrorZdismZ SystemRootZ SysNativeZSystem32zdism.exezwin_dism: Non-Windows systemc C s t jj�� sdS tS )z Only works on Windows )Fz!Only available on Windows systems)�salt�utils�platform� is_windows�__virtualname__� r r �I/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/win_dism.py�__virtual__( s r c C sX t d|r d|� �ndd|� �g}td |�}| � d|� d�}t�||tj�}|�� |S )N�/English�/Image:�/Onlinez/Get-�cmd.runz : (.*)\r\n.*State : z\r\n)�bin_dism�__salt__�re�findall� MULTILINE�sort)� type_regex�plural_type� install_value�image�cmd�out�pattern�capabilitiesr r r �_get_components2 s �r Fc C s� t jj�td d�dkrtd�td ���td|rd|� �nddd | � �g}|r0|�d |� �� |r7|�d� |s>|�d� t d |�S )a� Install a capability Args: capability (str): The capability to install source (:obj:`str`, optional): The optional source of the capability. Default is set by group policy and can be Windows Update. Default is ``None``. limit_access (:obj:`bool`, optional): Prevent DISM from contacting Windows Update for the source package. Default is ``False``. image (:obj:`str`, optional): The path to the root directory of an offline Windows image. If ``None`` is passed, the running operating system is targeted. Default is ``None``. restart (:obj:`bool`, optional): Reboot the machine if required by the install. Default is ``False``. Raises: NotImplementedError: For all versions of Windows that are not Windows 10 and later. Server editions of Windows use ServerManager instead. Returns: dict: A dictionary containing the results of the command CLI Example: .. code-block:: bash salt '*' dism.add_capability 'Tools.Graphics.DirectX~~~~0.0.1.0' � osversion�10���zD`install_capability` is not available on this version of Windows: {}�/Quietr r z/Add-Capability�/CapabilityName:�/Source:�/LimitAccess� /NoRestart�cmd.run_all� r r �versions�version_cmp� __grains__�NotImplementedError�formatr �appendr )� capability�source�limit_accessr �restartr r r r �add_capability@ s$ ) �� r2 c C sf t jj�td d�dkrtd�td ���td|rd|� �nddd | � �g}|s-|�d � t d |�S )a5 Uninstall a capability Args: capability(str): The capability to be removed image (:obj:`str`, optional): The path to the root directory of an offline Windows image. If ``None`` is passed, the running operating system is targeted. Default is ``None``. restart (:obj:`bool`, optional): Reboot the machine if required by the install. Default is ``False``. Raises: NotImplementedError: For all versions of Windows that are not Windows 10 and later. Server editions of Windows use ServerManager instead. Returns: dict: A dictionary containing the results of the command CLI Example: .. code-block:: bash salt '*' dism.remove_capability 'Tools.Graphics.DirectX~~~~0.0.1.0' r r r zF`uninstall_capability` is not available on this version of Windows: {}r! r r z/Remove-Capabilityr"