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

def package_info(package, image=None):
    '''
    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
    '''
    cmd = ['DISM',
           '/English',
           '/Image:{0}'.format(image) if image else '/Online',
           '/Get-PackageInfo']

    if '~' in package:
        cmd.append('/PackageName:{0}'.format(package))
    else:
        cmd.append('/PackagePath:{0}'.format(package))

    out = __salt__['cmd.run_all'](cmd)

    if out['retcode'] == 0:
        ret = dict()
        for line in six.text_type(out['stdout']).splitlines():
            if ' : ' in line:
                info = line.split(' : ')
                if len(info) < 2:
                    continue
                ret[info[0]] = info[1]
    else:
        ret = out

    return ret