### Summary

Unable using  `latest` together with `update_only`  option when installing a package using DNF module from an URL.

Tested on [https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm](url) and [https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-x86_64/pgdg-redhat-repo-latest.noarch.rpm](url)

The states `latest`  or `present` without specifying `update_only`  works as expected.

### Issue Type

Bug Report

### Component Name

dnf

### Ansible Version

```console
$ ansible --version
ansible [core 2.14.2]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/zelenya/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.11/site-packages/ansible
  ansible collection location = /home/zelenya/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.11.2 (main, May 24 2023, 00:00:00) [GCC 11.3.1 20221121 (Red Hat 11.3.1-4)] (/usr/bin/python3.11)
  jinja version = 3.1.2
  libyaml = True
```


### 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
CONFIG_FILE() = /etc/ansible/ansible.cfg
```


### OS / Environment

AlmaLinux release 9.2 (Turquoise Kodkod)

### Steps to Reproduce

Cleran setup Alma linux (using Vagrant)
<!--- Paste example playbooks or commands between quotes below -->
```yaml (paste below)
# install certificaters
sudo dnf -y install ca-certificates

# install ansible itself
sudo dnf -y install ansible-core

# install a package form URL
ansible localhost --become -m ansible.builtin.rpm_key -a "key='https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-9' state=present"

# Update the package to the latest version
ansible localhost --become -m ansible.builtin.dnf -a "name='https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm' state=present"
# fails with Error: AttributeError: 'Package' object has no attribute 'rpartition'
```
Based on Ansible-lint [https://ansible.readthedocs.io/projects/lint/rules/package-latest/#correct-code](package-latest) I'd expect that the correct flow is to install a package *state=present* and afterward (if requested) update to the latest version by using *state=present* together with *update_only=true*.
The intention is to be sure, that the package is updated if a playbook is executed after several months from initial installation time.

### Expected Results

I expect package installation with both options *state=latest* and *update_only=true* will work or report a misuse instead of failing with an exception.

### Actual Results

```console
$ ansible localhost --become -m ansible.builtin.dnf -a "name='https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm' state=latest update_only=true"
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'Package' object has no attribute 'rpartition'
localhost | FAILED! => {
    "changed": false,
    "module_stderr": "Traceback (most recent call last):\n  File \"<stdin>\", line 16, in <module>\n  File \"/usr/lib64/python3.9/runpy.py\", line 225, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib64/python3.9/runpy.py\", line 97, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/lib64/python3.9/runpy.py\", line 87, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_ansible.builtin.dnf_payload_t7xrps67/ansible_ansible.builtin.dnf_payload.zip/ansible/modules/dnf.py\", line 1460, in <module>\n  File \"/tmp/ansible_ansible.builtin.dnf_payload_t7xrps67/ansible_ansible.builtin.dnf_payload.zip/ansible/modules/dnf.py\", line 1449, in main\n  File \"/tmp/ansible_ansible.builtin.dnf_payload_t7xrps67/ansible_ansible.builtin.dnf_payload.zip/ansible/modules/dnf.py\", line 1423, in run\n  File \"/tmp/ansible_ansible.builtin.dnf_payload_t7xrps67/ansible_ansible.builtin.dnf_payload.zip/ansible/modules/dnf.py\", line 1134, in ensure\n  File \"/tmp/ansible_ansible.builtin.dnf_payload_t7xrps67/ansible_ansible.builtin.dnf_payload.zip/ansible/modules/dnf.py\", line 982, in _install_remote_rpms\n  File \"/tmp/ansible_ansible.builtin.dnf_payload_t7xrps67/ansible_ansible.builtin.dnf_payload.zip/ansible/modules/dnf.py\", line 949, in _update_only\n  File \"/tmp/ansible_ansible.builtin.dnf_payload_t7xrps67/ansible_ansible.builtin.dnf_payload.zip/ansible/modules/dnf.py\", line 795, in _is_installed\n  File \"/tmp/ansible_ansible.builtin.dnf_payload_t7xrps67/ansible_ansible.builtin.dnf_payload.zip/ansible/modules/dnf.py\", line 481, in _split_package_arch\nAttributeError: 'Package' object has no attribute 'rpartition'\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}


$ ansible -vvvv localhost --become -m ansible.builtin.dnf -a "name='https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm' state=latest update_only=true"
ansible [core 2.14.2]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/zelenya/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.11/site-packages/ansible
  ansible collection location = /home/zelenya/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.11.2 (main, May 24 2023, 00:00:00) [GCC 11.3.1 20221121 (Red Hat 11.3.1-4)] (/usr/bin/python3.11)
  jinja version = 3.1.2
  libyaml = True
Using /etc/ansible/ansible.cfg as config file
setting up inventory plugins
host_list declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
script declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Parsed /etc/ansible/hosts inventory source with ini plugin
Loading callback plugin minimal of type stdout, v2.0 from /usr/lib/python3.11/site-packages/ansible/plugins/callback/minimal.py
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: zelenya
<127.0.0.1> EXEC /bin/sh -c 'echo ~zelenya && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/zelenya/.ansible/tmp `"&& mkdir "` echo /home/zelenya/.ansible/tmp/ansible-tmp-1690820028.8473563-4456-128814682130530 `" && echo ansible-tmp-1690820028.8473563-4456-128814682130530="` echo /home/zelenya/.ansible/tmp/ansible-tmp-1690820028.8473563-4456-128814682130530 `" ) && sleep 0'
Using module file /usr/lib/python3.11/site-packages/ansible/modules/dnf.py
<127.0.0.1> PUT /home/zelenya/.ansible/tmp/ansible-local-4452uveazbbj/tmpl3btemgd TO /home/zelenya/.ansible/tmp/ansible-tmp-1690820028.8473563-4456-128814682130530/AnsiballZ_dnf.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /home/zelenya/.ansible/tmp/ansible-tmp-1690820028.8473563-4456-128814682130530/ /home/zelenya/.ansible/tmp/ansible-tmp-1690820028.8473563-4456-128814682130530/AnsiballZ_dnf.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'sudo -H -S -n  -u root /bin/sh -c '"'"'echo BECOME-SUCCESS-zrmfzgclfrznlmkupsgkhvmruypmywyc ; /usr/bin/python3.11 /home/zelenya/.ansible/tmp/ansible-tmp-1690820028.8473563-4456-128814682130530/AnsiballZ_dnf.py'"'"' && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /home/zelenya/.ansible/tmp/ansible-tmp-1690820028.8473563-4456-128814682130530/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
Traceback (most recent call last):
  File "<stdin>", line 16, in <module>
  File "/usr/lib64/python3.9/runpy.py", line 225, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/lib64/python3.9/runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/usr/lib64/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_ansible.builtin.dnf_payload_qxu1ivin/ansible_ansible.builtin.dnf_payload.zip/ansible/modules/dnf.py", line 1460, in <module>
  File "/tmp/ansible_ansible.builtin.dnf_payload_qxu1ivin/ansible_ansible.builtin.dnf_payload.zip/ansible/modules/dnf.py", line 1449, in main
  File "/tmp/ansible_ansible.builtin.dnf_payload_qxu1ivin/ansible_ansible.builtin.dnf_payload.zip/ansible/modules/dnf.py", line 1423, in run
  File "/tmp/ansible_ansible.builtin.dnf_payload_qxu1ivin/ansible_ansible.builtin.dnf_payload.zip/ansible/modules/dnf.py", line 1134, in ensure
  File "/tmp/ansible_ansible.builtin.dnf_payload_qxu1ivin/ansible_ansible.builtin.dnf_payload.zip/ansible/modules/dnf.py", line 982, in _install_remote_rpms
  File "/tmp/ansible_ansible.builtin.dnf_payload_qxu1ivin/ansible_ansible.builtin.dnf_payload.zip/ansible/modules/dnf.py", line 949, in _update_only
  File "/tmp/ansible_ansible.builtin.dnf_payload_qxu1ivin/ansible_ansible.builtin.dnf_payload.zip/ansible/modules/dnf.py", line 795, in _is_installed
  File "/tmp/ansible_ansible.builtin.dnf_payload_qxu1ivin/ansible_ansible.builtin.dnf_payload.zip/ansible/modules/dnf.py", line 481, in _split_package_arch
AttributeError: 'Package' object has no attribute 'rpartition'
localhost | FAILED! => {
    "changed": false,
    "module_stderr": "Traceback (most recent call last):\n  File \"<stdin>\", line 16, in <module>\n  File \"/usr/lib64/python3.9/runpy.py\", line 225, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib64/python3.9/runpy.py\", line 97, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/lib64/python3.9/runpy.py\", line 87, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_ansible.builtin.dnf_payload_qxu1ivin/ansible_ansible.builtin.dnf_payload.zip/ansible/modules/dnf.py\", line 1460, in <module>\n  File \"/tmp/ansible_ansible.builtin.dnf_payload_qxu1ivin/ansible_ansible.builtin.dnf_payload.zip/ansible/modules/dnf.py\", line 1449, in main\n  File \"/tmp/ansible_ansible.builtin.dnf_payload_qxu1ivin/ansible_ansible.builtin.dnf_payload.zip/ansible/modules/dnf.py\", line 1423, in run\n  File \"/tmp/ansible_ansible.builtin.dnf_payload_qxu1ivin/ansible_ansible.builtin.dnf_payload.zip/ansible/modules/dnf.py\", line 1134, in ensure\n  File \"/tmp/ansible_ansible.builtin.dnf_payload_qxu1ivin/ansible_ansible.builtin.dnf_payload.zip/ansible/modules/dnf.py\", line 982, in _install_remote_rpms\n  File \"/tmp/ansible_ansible.builtin.dnf_payload_qxu1ivin/ansible_ansible.builtin.dnf_payload.zip/ansible/modules/dnf.py\", line 949, in _update_only\n  File \"/tmp/ansible_ansible.builtin.dnf_payload_qxu1ivin/ansible_ansible.builtin.dnf_payload.zip/ansible/modules/dnf.py\", line 795, in _is_installed\n  File \"/tmp/ansible_ansible.builtin.dnf_payload_qxu1ivin/ansible_ansible.builtin.dnf_payload.zip/ansible/modules/dnf.py\", line 481, in _split_package_arch\nAttributeError: 'Package' object has no attribute 'rpartition'\n",
    "module_stdout": "",
    "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
a maybe already installed higher version of that package.
        Note that setting allow_downgrade=True can make this module
        behave in a non-idempotent way. The task could end up with a set
        of packages that does not match the complete list of specified
        packages to install (because dependencies between the downgraded
        package and others can cause changes to the packages which were
        in the earlier transaction).
    type: bool
    default: "no"
    version_added: "2.7"
  install_repoquery:
    description:
      - This is effectively a no-op in DNF as it is not needed with DNF, but is an accepted parameter for feature
        parity/compatibility with the M(ansible.builtin.yum) module.
    type: bool
    default: "yes"
    version_added: "2.7"
  download_only:
    description:
      - Only download the packages, do not install them.
    default: "no"
    type: bool
    version_added: "2.7"
  lock_timeout:
    description:
      - Amount of time to wait for the dnf lockfile to be freed.
    required: false
    default: 30
    type: int
    version_added: "2.8"