### Summary

The yum module fails when releasever is used and state=latest

### Issue Type

Bug Report

### Component Name

yum

### Ansible Version

```console
$ ansible --version
ansible [core 2.11.12]
```


### Configuration

```console
# if using a version older than ansible-core 2.12 you should omit the '-t all'
$ ansible-config dump --only-changed -t all
```


### OS / Environment

SL7

### Steps to Reproduce

<!--- Paste example playbooks or commands between quotes below -->
```yaml (paste below)
- name: ww_slurm_4, install slurm and munge packages
  yum:
    name: "{{ item.1 }}"
    state: "latest"
    installroot: "{{ ww_image_root }}/{{ item.0 }}/rootfs"
    # releasever: "{{ ansible_distribution_major_version }}"
    releasever: "7"
    disable_gpg_check: true
  loop: "{{ ww_images | product(['slurm-slurmd', 'slurm-pam_slurm', 'munge'] | list )}}"
  register: ww_import
  notify: build ww container
```


### Expected Results

I expect this to update the package in the chroot environment or stay the same.  Present works, but latest does not.  when releasever is commented both latest and present work.

### Actual Results

```console
failed: [queue] (item=['compute', 'munge']) => {"ansible_loop_var": "item", "changed": false, "item": ["compute", "munge"], "module_stderr": "Shared connection to 10.214.69.133 closed.\r\n", "module_stdout": "\r\nTraceback (most recent call last):\r\n  File \"/home/admin/.ansible/tmp/ansible-tmp-1655242496.2998235-85460-72716949132464/AnsiballZ_yum.py\", line 100, in <module>\r\n    _ansiballz_main()\r\n  File \"/home/admin/.ansible/tmp/ansible-tmp-1655242496.2998235-85460-72716949132464/AnsiballZ_yum.py\", line 92, in _ansiballz_main\r\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n  File \"/home/admin/.ansible/tmp/ansible-tmp-1655242496.2998235-85460-72716949132464/AnsiballZ_yum.py\", line 41, in invoke_module\r\n    run_name='__main__', alter_sys=True)\r\n  File \"/usr/lib64/python2.7/runpy.py\", line 176, in run_module\r\n    fname, loader, pkg_name)\r\n  File \"/usr/lib64/python2.7/runpy.py\", line 82, in _run_module_code\r\n    mod_name, mod_fname, mod_loader, pkg_name)\r\n  File \"/usr/lib64/python2.7/runpy.py\", line 72, in _run_code\r\n    exec code in run_globals\r\n  File \"/tmp/ansible_ansible.legacy.yum_payload_wj2O6u/ansible_ansible.legacy.yum_payload.zip/ansible/modules/yum.py\", line 1728, in <module>\r\n  File \"/tmp/ansible_ansible.legacy.yum_payload_wj2O6u/ansible_ansible.legacy.yum_payload.zip/ansible/modules/yum.py\", line 1724, in main\r\n  File \"/tmp/ansible_ansible.legacy.yum_payload_wj2O6u/ansible_ansible.legacy.yum_payload.zip/ansible/modules/yum.py\", line 1695, in run\r\n  File \"/tmp/ansible_ansible.legacy.yum_payload_wj2O6u/ansible_ansible.legacy.yum_payload.zip/ansible/modules/yum.py\", line 1577, in ensure\r\n  File \"/tmp/ansible_ansible.legacy.yum_payload_wj2O6u/ansible_ansible.legacy.yum_payload.zip/ansible/modules/yum.py\", line 1438, in latest\r\nAttributeError: 'NoneType' object has no attribute 'extend'\r\n", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
```


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct
package = new_package_path
                else:
                    package = spec
                
                envra = self.local_envra(package)
                if envra is None:
                    self.module.fail_json(msg="Failed to get envra information from RPM package: %s" % spec)
                installed_pkgs = self.is_installed(repoq, envra)
                if installed_pkgs:
                    res['results'].append('%s providing %s is already installed' % (installed_pkgs[0], package))
                    continue
                (name, ver, rel, epoch, arch) = splitFilename(envra)
                installed_pkgs = self.is_installed(repoq, name)
                
                if len(installed_pkgs) == 2:
                    (cur_name0, cur_ver0, cur_rel0, cur_epoch0, cur_arch0) = splitFilename(installed_pkgs[0])
                    (cur_name1, cur_ver1, cur_rel1, cur_epoch1, cur_arch1) = splitFilename(installed_pkgs[1])
                    cur_epoch0 = cur_epoch0 or '0'
                    cur_epoch1 = cur_epoch1 or '0'
                    compare = compareEVR((cur_epoch0, cur_ver0, cur_rel0), (cur_epoch1, cur_ver1, cur_rel1))
                    if compare == 0 and cur_arch0 != cur_arch1:
                        for installed_pkg in installed_pkgs:
                            if installed_pkg.endswith(arch):
                                installed_pkgs = [installed_pkg]
                if len(installed_pkgs) == 1:
                    installed_pkg = installed_pkgs[0]
                    (cur_name, cur_ver, cur_rel, cur_epoch, cur_arch) = splitFilename(installed_pkg)
                    cur_epoch = cur_epoch or '0'
                    compare = compareEVR((cur_epoch, cur_ver, cur_rel), (epoch, ver, rel))