Install a KB from a .msu file.

    Args:

        path (str):
            The full path to the msu file to install

        restart (bool):
            ``True`` to force a restart if required by the installation. Adds
            the ``/forcerestart`` switch to the ``wusa.exe`` command. ``False``
            will add the ``/norestart`` switch instead. Default is ``False``

    Returns:
        bool: ``True`` if successful, otherwise ``False``

    Raise:
        CommandExecutionError: If the package is already installed or an error
            is encountered

    CLI Example:

    .. code-block:: bash

        salt '*' wusa.install C:/temp/KB123456.msu

def install(path, restart=False):
    '''
    Install a KB from a .msu file.

    Args:

        path (str):
            The full path to the msu file to install

        restart (bool):
            ``True`` to force a restart if required by the installation. Adds
            the ``/forcerestart`` switch to the ``wusa.exe`` command. ``False``
            will add the ``/norestart`` switch instead. Default is ``False``

    Returns:
        bool: ``True`` if successful, otherwise ``False``

    Raise:
        CommandExecutionError: If the package is already installed or an error
            is encountered

    CLI Example:

    .. code-block:: bash

        salt '*' wusa.install C:/temp/KB123456.msu
    '''
    # Build the command
    cmd = ['wusa.exe', path, '/quiet']
    if restart:
        cmd.append('/forcerestart')
    else:
        cmd.append('/norestart')

    # Run the command
    ret_code = __salt__['cmd.retcode'](cmd, ignore_retcode=True)

    # Check the ret_code
    file_name = os.path.basename(path)
    errors = {2359302: '{0} is already installed'.format(file_name),
              87: 'Unknown error'}
    if ret_code in errors:
        raise CommandExecutionError(errors[ret_code])
    elif ret_code:
        raise CommandExecutionError('Unknown error: {0}'.format(ret_code))

    return True