ansible-collections / community.general

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

I can't deactivate a repository with module zypper_repository #8783

Open TobiasZeuch181 opened 2 months ago

TobiasZeuch181 commented 2 months ago

Summary

When I try to deactivate a repository with the module zypper_repository, then this doesn't work. When I look at the code, I think this is because the code that was introduced in https://github.com/ansible-collections/community.general/commit/f0fcb221cd3d279f45bb1b463eb86ed9041324f1 where the fields for e.g. repodata['enabled'] are overwritten, if the repo-path is provided. I tried to use name instead of repo, but that doesn't work because state defaults to present and present required repo to be filled.

Issue Type

Bug Report

Component Name

zypper_repository

Ansible Version

$ ansible --version
ansible [core 2.16.5]
  config file = None
  configured module search path = ['/home/i513463/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/i513463/.local/lib/python3.10/site-packages/ansible
  ansible collection location = /home/i513463/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/i513463/.local/bin/ansible
  python version = 3.10.12 (main, Jul 29 2024, 16:56:48) [GCC 11.4.0] (/usr/bin/python3)
  jinja version = 3.1.3
  libyaml = True

Community.general Version

$ ansible-galaxy collection list community.general

Configuration

$ ansible-config dump --only-changed
CONFIG_FILE() = None

OS / Environment

WSL (Windows subsystem for linux)

Steps to Reproduce

find a repository that is installed on the VM, e.g. packages-microsoft-com-prod-sle15 on a Azure VM

- name: Disable repository for SAP-cloud
      community.general.zypper_repository:
        repo: "/etc/zypp/repos.d/packages-microsoft-com-prod-sle15"
        enabled: false

Expected Results

I expected the repository to be disabled

Actual Results

The task did not change anything and the repository is still enabled

Code of Conduct

ansibullbot commented 2 months 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 2 months ago

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