ansible-collections / community.general

Ansible Community General Collection
https://galaxy.ansible.com/ui/repo/published/community/general/
GNU General Public License v3.0
830 stars 1.53k forks source link

`zypper_repository` cannot remove old/broken repositories #5769

Open MaPePeR opened 1 year ago

MaPePeR commented 1 year ago

Summary

The repository https://download.opensuse.org/repositories/devel:languages:nodejs/openSUSE_Leap_15.3/devel:languages:nodejs.repo was recently removed.

I tried to remove it using the zypper_repository module, but it fails with error "Error downloading .repo file from provided URL". (That is why I'm removing it....)

The cause is, that these checks also happen for state: absent, which prevents removing of broken repository urls.

I suppose the fix is to either disable these error for state:absent or provide another option that allows to skip these checks or downgrade that error to a warning.

Issue Type

Bug Report

Component Name

zypper_repository

Ansible Version

$ ansible --version
ansible [core 2.14.1]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['~/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.10/site-packages/ansible
  ansible collection location = ~/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.10.8 (main, Nov  1 2022, 14:18:21) [GCC 12.2.0] (/usr/bin/python)
  jinja version = 3.1.2
  libyaml = True

Community.general Version

$ ansible-galaxy collection list community.general

# /usr/lib/python3.10/site-packages/ansible_collections
Collection        Version
----------------- -------
community.general 6.1.0  

Configuration

$ ansible-config dump --only-changed
CONFIG_FILE() = /etc/ansible/ansible.cfg
DEFAULT_VAULT_PASSWORD_FILE(env: ANSIBLE_VAULT_PASSWORD_FILE) = [...]/vault-pass.sh

OS / Environment

Target OS is SLES 15-SP3.

Steps to Reproduce

- name: Remove old nodejs repo
  community.general.zypper_repository:
    state: absent
    repo: https://download.opensuse.org/repositories/devel:languages:nodejs/openSUSE_Leap_15.3/devel:languages:nodejs.repo

Expected Results

I expected it to remove the repository.

Actual Results

FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "auto_import_keys": false,
            "autorefresh": true,
            "description": null,
            "disable_gpg_check": false,
            "enabled": true,
            "name": null,
            "overwrite_multiple": false,
            "priority": null,
            "repo": "https://download.opensuse.org/repositories/devel:languages:nodejs/openSUSE_Leap_15.3/devel:languages:nodejs.repo",
            "runrefresh": false,
            "state": "absent"
        }
    },
    "msg": "Error downloading .repo file from provided URL"
}

Code of Conduct

ansibullbot commented 1 year ago

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibullbot commented 1 year ago

cc @AnderEnder @alxgu @andytom @commel @dcermak @evrardjp @lrupp @sealor @toabctl click here for bot help