%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/modules/win_dism.pyc

�
���^c@@sAdZddlmZmZmZddlZddlZddlZddlZ	ddl
Z	ddlmZej
e�ZdZy�e	jjj�s�e�nejjejjejjd�d��r�ejjejjd�d�Zn!ejjejjd�d�Zejjed	�ZWn$ek
rOejd
�d	ZnXd�Zdd�Zde de d
�Z!de d�Z"dd�Z#dd�Z$dd�Z%dde e de d�Z&e de d�Z'ddd�Z(dd�Z)dd�Z*e e de d�Z+de d�Z,dd�Z-dd�Z.dS(u�
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.

i(tabsolute_importtunicode_literalstprint_functionN(tsixudismu
SystemRootu	SysNativeuSystem32udism.exeuwin_dism: Non-Windows systemcC@s tjjj�stdfStS(u
    Only work on Windows
    u!Only available on Windows systems(tsalttutilstplatformt
is_windowstFalset__virtualname__(((s9/usr/lib/python2.7/site-packages/salt/modules/win_dism.pyt__virtual__/s
cC@sxtd|rdj|�nddj|�g}td|�}dj||�}tj||tj�}|j�|S(Nu/Englishu
/Image:{0}u/Onlineu/Get-{0}ucmd.runu{0} : (.*)\r\n.*State : {1}\r\n(tbin_dismtformatt__salt__tretfindallt	MULTILINEtsort(t
type_regextplural_typet
install_valuetimagetcmdtouttpatterntcapabilities((s9/usr/lib/python2.7/site-packages/salt/modules/win_dism.pyt_get_components9s
cC@s�tjjjtdd�dkr>tdjtd���ntd|rYdj|�nddd	j|�g}|r�|jd
j|��n|r�|jd�n|s�|jd�nt	d
|�S(u�
    Install a capability

    Args:
        capability (str): The capability to install
        source (Optional[str]): The optional source of the capability. Default
            is set by group policy and can be Windows Update.
        limit_access (Optional[bool]): Prevent DISM from contacting Windows
            Update for the source package
        image (Optional[str]): 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 (Optional[bool]): Reboot the machine if required by the install

    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
    u	osversionu10i����uE`install_capability` is not available on this version of Windows: {0}u/Quietu
/Image:{0}u/Onlineu/Add-Capabilityu/CapabilityName:{0}u/Source:{0}u/LimitAccessu
/NoRestartucmd.run_all(
RRtversionstversion_cmpt
__grains__tNotImplementedErrorRRtappendR
(t
capabilitytsourcetlimit_accessRtrestartR((s9/usr/lib/python2.7/site-packages/salt/modules/win_dism.pytadd_capabilityFs  "cC@s�tjjjtdd�dkr>tdjtd���ntd|rYdj|�nddd	j|�g}|s�|jd
�nt	d|�S(u�
    Uninstall a capability

    Args:
        capability(str): The capability to be removed
        image (Optional[str]): 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 (Optional[bool]): Reboot the machine if required by the install

    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
    u	osversionu10i����uG`uninstall_capability` is not available on this version of Windows: {0}u/Quietu
/Image:{0}u/Onlineu/Remove-Capabilityu/CapabilityName:{0}u
/NoRestartucmd.run_all(
RRRRRRRRRR
(R RR#R((s9/usr/lib/python2.7/site-packages/salt/modules/win_dism.pytremove_capability{s"cC@s�tjjjtdd�dkr>tdjtd���ntd|rYdj|�nddg}td	|�}d
}t	j
||t	j�}|j�|S(u)
    List all capabilities on the system

    Args:
        image (Optional[str]): The path to the root directory of an offline
            Windows image. If `None` is passed, the running operating system is
            targeted. Default is None.

    Raises:
        NotImplementedError: For all versions of Windows that are not Windows 10
        and later. Server editions of Windows use ServerManager instead.

    Returns:
        list: A list of capabilities

    CLI Example:

    .. code-block:: bash

        salt '*' dism.get_capabilities
    u	osversionu10i����uI`installed_capabilities` is not available on this version of Windows: {0}u/Englishu
/Image:{0}u/Onlineu/Get-Capabilitiesucmd.runuCapability Identity : (.*)\r\n(
RRRRRRRRR
RRRR(RRRRR((s9/usr/lib/python2.7/site-packages/salt/modules/win_dism.pytget_capabilities�s"	
cC@sNtjjjtdd�dkr>tdjtd���ntddd�S(uC
    List the capabilities installed on the system

    Args:
        image (Optional[str]): The path to the root directory of an offline
            Windows image. If `None` is passed, the running operating system is
            targeted. Default is None.

    Raises:
        NotImplementedError: For all versions of Windows that are not Windows 10
        and later. Server editions of Windows use ServerManager instead.

    Returns:
        list: A list of installed capabilities

    CLI Example:

    .. code-block:: bash

        salt '*' dism.installed_capabilities
    u	osversionu10i����uI`installed_capabilities` is not available on this version of Windows: {0}uCapability IdentityuCapabilitiesu	Installed(RRRRRRRR(R((s9/usr/lib/python2.7/site-packages/salt/modules/win_dism.pytinstalled_capabilities�s
"cC@sNtjjjtdd�dkr>tdjtd���ntddd�S(uC
    List the capabilities available on the system

    Args:
        image (Optional[str]): The path to the root directory of an offline
            Windows image. If `None` is passed, the running operating system is
            targeted. Default is None.

    Raises:
        NotImplementedError: For all versions of Windows that are not Windows 10
        and later. Server editions of Windows use ServerManager instead.

    Returns:
        list: A list of available capabilities

    CLI Example:

    .. code-block:: bash

        salt '*' dism.installed_capabilities
    u	osversionu10i����uI`installed_capabilities` is not available on this version of Windows: {0}uCapability IdentityuCapabilitiesuNot Present(RRRRRRRR(R((s9/usr/lib/python2.7/site-packages/salt/modules/win_dism.pytavailable_capabilities�s
"cC@s�td|rdj|�ndddj|�g}|rR|jdj|��n|rq|jdj|��n|r�|jd�n|r�|jd	�n|s�|jd
�ntd|�S(u|
    Install a feature using DISM

    Args:
        feature (str): The feature to install
        package (Optional[str]): The parent package for the feature. You do not
            have to specify the package if it is the Windows Foundation Package.
            Otherwise, use package to specify the parent package of the feature
        source (Optional[str]): The optional source of the capability. Default
            is set by group policy and can be Windows Update
        limit_access (Optional[bool]): Prevent DISM from contacting Windows
            Update for the source package
        enable_parent (Optional[bool]): True will enable all parent features of
            the specified feature
        image (Optional[str]): 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 (Optional[bool]): Reboot the machine if required by the install

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

    CLI Example:

    .. code-block:: bash

        salt '*' dism.add_feature NetFx3
    u/Quietu
/Image:{0}u/Onlineu/Enable-Featureu/FeatureName:{0}u/PackageName:{0}u/Source:{0}u/LimitAccessu/Allu
/NoRestartucmd.run_all(RRRR
(tfeaturetpackageR!R"t
enable_parentRR#R((s9/usr/lib/python2.7/site-packages/salt/modules/win_dism.pytadd_features #cC@smtd|rdj|�ndddj|�g}|rI|jd�n|s_|jd�ntd|�S(	u�
    Disables the feature.

    Args:
        feature (str): The feature to uninstall
        remove_payload (Optional[bool]): Remove the feature's payload. Must
            supply source when enabling in the future.
        image (Optional[str]): 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 (Optional[bool]): Reboot the machine if required by the install

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

    CLI Example:

    .. code-block:: bash

        salt '*' dism.remove_feature NetFx3
    u/Quietu
/Image:{0}u/Onlineu/Disable-Featureu/FeatureName:{0}u/Removeu
/NoRestartucmd.run_all(RRRR
(R)tremove_payloadRR#R((s9/usr/lib/python2.7/site-packages/salt/modules/win_dism.pytremove_feature<scC@s�td|rdj|�nddg}|rkd|krR|jdj|��qk|jdj|��ntd|�}d	}tj||tj�}|j�|S(
uU
    List features on the system or in a package

    Args:
        package (Optional[str]): The full path to the package. Can be either a
            .cab file or a folder. Should point to the original source of the
            package, not to where the file is installed. You cannot use this
            command to get package information for .msu files

            This can also be the name of a package as listed in
            ``dism.installed_packages``
        image (Optional[str]): The path to the root directory of an offline
            Windows image. If `None` is passed, the running operating system is
            targeted. Default is None.

    Returns:
        list: A list of features

    CLI Example:

        .. code-block:: bash

            # Return all features on the system
            salt '*' dism.get_features

            # Return all features in package.cab
            salt '*' dism.get_features C:\packages\package.cab

            # Return all features in the calc package
            salt '*' dism.get_features Microsoft.Windows.Calc.Demo~6595b6144ccf1df~x86~en~1.0.0.0
    u/Englishu
/Image:{0}u/Onlineu
/Get-Featuresu~u/PackageName:{0}u/PackagePath:{0}ucmd.runuFeature Name : (.*)\r\n(RRRR
RRRR(R*RRRRtfeatures((s9/usr/lib/python2.7/site-packages/salt/modules/win_dism.pytget_features`s 	
cC@stddd�S(u�
    List the features installed on the system

    Args:
        image (Optional[str]): The path to the root directory of an offline
            Windows image. If `None` is passed, the running operating system is
            targeted. Default is None.

    Returns:
        list: A list of installed features

    CLI Example:

    .. code-block:: bash

        salt '*' dism.installed_features
    uFeature NameuFeaturesuEnabled(R(R((s9/usr/lib/python2.7/site-packages/salt/modules/win_dism.pytinstalled_features�scC@stddd�S(u�
    List the features available on the system

    Args:
        image (Optional[str]): The path to the root directory of an offline
            Windows image. If `None` is passed, the running operating system is
            targeted. Default is None.

    Returns:
        list: A list of available features

    CLI Example:

    .. code-block:: bash

        salt '*' dism.available_features
    uFeature NameuFeaturesuDisabled(R(R((s9/usr/lib/python2.7/site-packages/salt/modules/win_dism.pytavailable_features�scC@s�td|rdj|�ndddj|�g}|rI|jd�n|r_|jd�n|su|jd�ntd	|�S(
u
    Install a package using DISM

    Args:
        package (str):
            The package to install. Can be a .cab file, a .msu file, or a folder

            .. note::
                An `.msu` package is supported only when the target image is
                offline, either mounted or applied.

        ignore_check (Optional[bool]):
            Skip installation of the package if the applicability checks fail

        prevent_pending (Optional[bool]):
            Skip the installation of the package if there are pending online
            actions

        image (Optional[str]):
            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 (Optional[bool]):
            Reboot the machine if required by the install

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

    CLI Example:

    .. code-block:: bash

        salt '*' dism.add_package C:\Packages\package.cab
    u/Quietu
/Image:{0}u/Onlineu/Add-Packageu/PackagePath:{0}u/IgnoreChecku/PreventPendingu
/NoRestartucmd.run_all(RRRR
(R*tignore_checktprevent_pendingRR#R((s9/usr/lib/python2.7/site-packages/salt/modules/win_dism.pytadd_package�s(cC@s�td|rdj|�nddg}|s=|jd�nd|krb|jdj|��n|jdj|��td	|�S(
u�
    Uninstall a package

    Args:
        package (str): The full path to the package. Can be either a .cab file
            or a folder. Should point to the original source of the package, not
            to where the file is installed. This can also be the name of a package as listed in
            ``dism.installed_packages``
        image (Optional[str]): 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 (Optional[bool]): Reboot the machine if required by the install

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

    CLI Example:

    .. code-block:: bash

        # Remove the Calc Package
        salt '*' dism.remove_package Microsoft.Windows.Calc.Demo~6595b6144ccf1df~x86~en~1.0.0.0

        # Remove the package.cab (does not remove C:\packages\package.cab)
        salt '*' dism.remove_package C:\packages\package.cab
    u/Quietu
/Image:{0}u/Onlineu/Remove-Packageu
/NoRestartu~u/PackageName:{0}u/PackagePath:{0}ucmd.run_all(RRRR
(R*RR#R((s9/usr/lib/python2.7/site-packages/salt/modules/win_dism.pytremove_package�s	cC@stddd�S(u�
    List the packages installed on the system

    Args:
        image (Optional[str]): The path to the root directory of an offline
            Windows image. If `None` is passed, the running operating system is
            targeted. Default is None.

    Returns:
        list: A list of installed packages

    CLI Example:

    .. code-block:: bash

        salt '*' dism.installed_packages
    uPackage IdentityuPackagesu	Installed(R(R((s9/usr/lib/python2.7/site-packages/salt/modules/win_dism.pytinstalled_packages!scC@std|rdj|�nddg}d|krL|jdj|��n|jdj|��td|�}|d	d
kr�t�}xrtj|d�j�D]N}d|kr�|jd�}t	|�d
kr�q�n|d||d
<q�q�Wn|}|S(u�
    Display information about a package

    Args:
        package (str): The full path to the package. Can be either a .cab file
            or a folder. Should point to the original source of the package, not
            to where the file is installed. You cannot use this command to get
            package information for .msu files
        image (Optional[str]): The path to the root directory of an offline
            Windows image. If `None` is passed, the running operating system is
            targeted. Default is None.

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

    CLI Example:

    .. code-block:: bash

        salt '*' dism. package_info C:\packages\package.cab
    u/Englishu
/Image:{0}u/Onlineu/Get-PackageInfou~u/PackageName:{0}u/PackagePath:{0}ucmd.run_alluretcodeiustdoutu : ii(
RRRR
tdictRt	text_typet
splitlinestsplittlen(R*RRRtrettlinetinfo((s9/usr/lib/python2.7/site-packages/salt/modules/win_dism.pytpackage_info6s$		 (/t__doc__t
__future__RRRtloggingtosRtsalt.utils.platformRtsalt.utils.versionstsalt.extRt	getLoggert__name__tlogR	RRRtOSErrortpathtexiststjointenvirontgettbin_pathRttraceR
tNoneRRR$R%R&R'R(R,R.R0R1R2R5R6R7R@(((s9/usr/lib/python2.7/site-packages/salt/modules/win_dism.pyt<module>s\	-$!


	
1)(0$44+

Zerion Mini Shell 1.0