Remove a specific version of the kernel.

    release
        The release number of an installed kernel. This must be the entire release
        number as returned by :py:func:`~salt.modules.kernelpkg_linux_yum.list_installed`,
        not the package name.

    CLI Example:

    .. code-block:: bash

        salt '*' kernelpkg.remove 3.10.0-327.el7

def remove(release):
    '''
    Remove a specific version of the kernel.

    release
        The release number of an installed kernel. This must be the entire release
        number as returned by :py:func:`~salt.modules.kernelpkg_linux_yum.list_installed`,
        not the package name.

    CLI Example:

    .. code-block:: bash

        salt '*' kernelpkg.remove 3.10.0-327.el7
    '''
    if release not in list_installed():
        raise CommandExecutionError('Kernel release \'{0}\' is not installed'.format(release))

    if release == active():
        raise CommandExecutionError('Active kernel cannot be removed')

    target = '{0}-{1}'.format(_package_name(), release)
    log.info('Removing kernel package %s', target)
    old = __salt__['pkg.list_pkgs']()

    # Build the command string
    cmd = []
    if salt.utils.systemd.has_scope(__context__) \
            and __salt__['config.get']('systemd.scope', True):
        cmd.extend(['systemd-run', '--scope'])
    cmd.extend([_yum(), '-y', 'remove', target])

    # Execute the command
    out = __salt__['cmd.run_all'](
        cmd,
        output_loglevel='trace',
        python_shell=False
    )

    # Look for the changes in installed packages
    __context__.pop('pkg.list_pkgs', None)
    new = __salt__['pkg.list_pkgs']()
    ret = salt.utils.data.compare_dicts(old, new)

    # Look for command execution errors
    if out['retcode'] != 0:
        raise CommandExecutionError(
            'Error occurred removing package(s)',
            info={'errors': [out['stderr']], 'changes': ret}
        )

    return {'removed': [target]}