Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] State pkgrepo.absent and pkg.del_repo module are unable to delete repositories previously created with pkgrepo.managed #61602

Closed
2 of 6 tasks
javierbertoli opened this issue Feb 8, 2022 · 3 comments
Assignees
Labels
Bug broken, incorrect, or confusing behavior needs-triage

Comments

@javierbertoli
Copy link
Contributor

Description
I think this is a follow-up of #51656.

I hit this is issue today while working on the docker-formula, using salt version 3004:

Setup

  • on-prem machine
  • VM (Virtualbox, KVM, etc. please specify)
  • VM running on a cloud service, please be explicit and add details
  • container (Kubernetes, Docker, containerd, etc. please specify)
  • or a combination, please be explicit
  • jails if it is FreeBSD

Steps to Reproduce the behavior

  1. create the repository with the following sls file
       docker-software-package-repo-managed:
         pkgrepo.managed:
           - comments: ['installed by salt']
           - enabled: 1
           - file: /etc/apt/sources.list.d/docker.list
           - gpgcheck: 1
           - name: deb [signed-by=/usr/share/keyrings/docker-archive-keyring.gpg arch=amd64] https://download.docker.com/linux/debian bullseye stable
           - humanname: Debian Bullseye Docker Package Repository
           - refresh: True
  1. After running the state, the file /etc/apt/sources.list.d/docker.list will be created with the following content
deb [signed-by=/usr/share/keyrings/docker-archive-keyring.gpg arch=amd64] https://download.docker.com/linux/debian bullseye stable
  1. The following state is unable to delete the repo
       docker-software-package-repo-absent:
         pkgrepo.absent:
           - name: deb [signed-by=/usr/share/keyrings/docker-archive-keyring.gpg arch=amd64] https://download.docker.com/linux/debian bullseye stable

As I understand the state is a wrapper of pkg.del_repo, I tried it too, to confirm the issue:

a. pkg.get_repo is able to find the repository correctly:

# salt-call --local pkg.get_repo 'deb [signed-by=/usr/share/keyrings/docker-archive-keyring.gpg arch=amd64] https://download.docker.com/linux/debian bullseye stable'
local:
    ----------
    architectures:
        - amd64
    comps:
        - stable
    disabled:
        False
    dist:
        bullseye
    file:
        /etc/apt/sources.list.d/docker.list
    line:
        deb [signed-by=/usr/share/keyrings/docker-archive-keyring.gpg arch=amd64] https://download.docker.com/linux/debian bullseye stable
    type:
        deb
    uri:
        https://download.docker.com/linux/debian

b. del_repo is unable to find the entry and delete it

# salt-call --local pkg.del_repo 'deb [signed-by=/usr/share/keyrings/docker-archive-keyring.gpg arch=amd64] https://download.docker.com/linux/debian bullseye stable'
Error running 'pkg.del_repo': Repo deb [signed-by=/usr/share/keyrings/docker-archive-keyring.gpg arch=amd64] https://download.docker.com/linux/debian bullseye stable doesn't exist in the sources.list(s)

Expected behavior
Both the state pkgrepo.absent and the module pkg.del_repo should be able to delete a repository that exists.

Screenshots
If applicable, add screenshots to help explain your problem.

Versions Report

salt --versions-report

(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)

Salt Version:
          Salt: 3004
 
Dependency Versions:
          cffi: Not Installed
      cherrypy: Not Installed
      dateutil: 2.8.1
     docker-py: 4.1.0
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 2.11.3
       libgit2: Not Installed
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.0
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: Not Installed
      pycrypto: Not Installed
  pycryptodome: 3.9.7
        pygit2: Not Installed
        Python: 3.9.2 (default, Feb 28 2021, 17:03:44)
  python-gnupg: Not Installed
        PyYAML: 5.3.1
         PyZMQ: 20.0.0
         smmap: Not Installed
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.3.4
 
System Versions:
          dist: debian 11 bullseye
        locale: utf-8
       machine: x86_64
       release: 5.10.0-10-amd64
        system: Linux
       version: Debian GNU/Linux 11 bullseye
@javierbertoli javierbertoli added Bug broken, incorrect, or confusing behavior needs-triage labels Feb 8, 2022
javierbertoli added a commit to netmanagers/docker-formula that referenced this issue Feb 8, 2022
@garethgreenaway
Copy link
Contributor

@javierbertoli There were quite a few changes and fixes that went into the 3005.1 release for the pkgrepo module, Are you able to upgrade and see if the issues you're seeing are resolved? Thanks!

@garethgreenaway
Copy link
Contributor

Closing this one out due to lack of activity, if the issue persists please feel free to open a new issue. Thanks!

@votdev
Copy link
Contributor

votdev commented Jun 20, 2023

This bug still exists in 3005.1.

remove_apt_sources_list_security_0:
  module.run:
    - pkg.del_repo:
      - repo: "deb-src [signed-by=/etc/apt/trusted.gpg.d/debian-archive-bullseye-security-automatic.gpg] http://security.debian.org/debian-security bullseye-security main contrib non-free"
[ERROR   ] An exception occurred in this state: Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/salt/state.py", line 2276, in call
    ret = self.states[cdata["full"]](
  File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 149, in __call__
    return self.loader.run(run_func, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 1228, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 1243, in _run_as
    return _func_or_method(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 1276, in wrapper
    return f(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/salt/states/module.py", line 394, in run
    return _run(**kwargs)
  File "/usr/lib/python3/dist-packages/salt/states/module.py", line 449, in _run
    func_ret = _call_function(
  File "/usr/lib/python3/dist-packages/salt/states/module.py", line 495, in _call_function
    mret = salt.utils.functools.call_function(__salt__[name], *func_args, **func_kwargs)
  File "/usr/lib/python3/dist-packages/salt/utils/functools.py", line 174, in call_function
    return salt_function(*function_args, **function_kwargs)
  File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 149, in __call__
    return self.loader.run(run_func, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 1228, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/salt/loader/lazy.py", line 1243, in _run_as
    return _func_or_method(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/salt/modules/aptpkg.py", line 2138, in del_repo
    raise CommandExecutionError(
salt.exceptions.CommandExecutionError: Repo deb-src [signed-by=/etc/apt/trusted.gpg.d/debian-archive-bullseye-security-automatic.gpg] http://security.debian.org/debian-security bullseye-security main contrib non-free doesn't exist in the sources.list(s)

votdev added a commit to openmediavault/openmediavault that referenced this issue Jun 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior needs-triage
Projects
None yet
Development

No branches or pull requests

4 participants