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] Using pkgrepo.managed, if keyserver does not return any data, state succeeds anyway #64253

Closed
tqre-mc opened this issue May 8, 2023 · 3 comments
Assignees
Labels
Bug broken, incorrect, or confusing behavior needs-triage package-repo

Comments

@tqre-mc
Copy link

tqre-mc commented May 8, 2023

Description
pkgrepo.managed gives state success even if no data is received from keyserver. Occasionally keyservers might not answer, and if this happens, the state described creates a dummy gpg file into /etc/apt/keyrings, and reports all is well.

Setup

salt-repository:
  pkgrepo.managed:
    - name: deb [signed-by=/etc/apt/keyrings/salt-archive-keyring.gpg arch=amd64] https://repo.saltproject.io/salt/py3/ubuntu/22.04/amd64/latest jammy main
    - file: /etc/apt/sources.list.d/salt.list
    - keyid: 10857FFDD3F91EAE577A21D664CBBC8173D76B3F
    - keyserver: keyserver.ubuntu.com
    - clean_file: True
    - aptkey: False

Expected behavior
State should fail if gpg key is not retrieved correctly.

Salt-master output

          ID: salt-repository
    Function: pkgrepo.managed
        Name: deb [signed-by=/etc/apt/keyrings/salt-archive-keyring.gpg arch=amd64] https://repo.saltproject.io/salt/py3/ubuntu/22.04/amd64/latest jammy main
      Result: True
     Comment: Configured package repo 'deb [signed-by=/etc/apt/keyrings/salt-archive-keyring.gpg arch=amd64] https://repo.saltproject.io/salt/py3/ubuntu/22.04/amd64/latest jammy main'
     Started: 15:48:03.571221
    Duration: 1629.812 ms
     Changes:
              ----------
              repo:
                  deb [signed-by=/etc/apt/keyrings/salt-archive-keyring.gpg arch=amd64] https://repo.saltproject.io/salt/py3/ubuntu/22.04/amd64/latest jammy main

Logs on salt-minion

May 08 15:48:03 test-elk-kibana-01 systemd[1]: Started "salt.loaded.int.module.aptpkg".
May 08 15:48:03 test-elk-kibana-01 systemd[1]: run-rc59c5bfa119c4dcfbfbcf569353597e5.scope: Deactivated successfully.
May 08 15:48:03 test-elk-kibana-01 salt-minion[9767]: [ERROR   ] Command 'systemd-run' failed with return code: 2
May 08 15:48:03 test-elk-kibana-01 salt-minion[9767]: [ERROR   ] stderr: Running scope as unit: run-rc59c5bfa119c4dcfbfbcf569353597e5.scope
May 08 15:48:03 test-elk-kibana-01 salt-minion[9767]: gpg: keybox '/etc/apt/keyrings/salt-archive-keyring.gpg' created
May 08 15:48:03 test-elk-kibana-01 salt-minion[9767]: gpg: keyserver receive failed: No data
May 08 15:48:03 test-elk-kibana-01 salt-minion[9767]: [ERROR   ] retcode: 2
May 08 15:48:03 test-elk-kibana-01 salt-minion[9767]: [ERROR   ] Unable to add repo key: Running scope as unit: run-rc59c5bfa119c4dcfbfbcf569353597e5.scope
May 08 15:48:03 test-elk-kibana-01 salt-minion[9767]: gpg: keybox '/etc/apt/keyrings/salt-archive-keyring.gpg' created
May 08 15:48:03 test-elk-kibana-01 salt-minion[9767]: gpg: keyserver receive failed: No data]

Versions Report
salt-master

Salt Version:
          Salt: 3006.1

Python Version:
        Python: 3.10.11 (main, May  5 2023, 02:31:54) [GCC 11.2.0]

Dependency Versions:
          cffi: 1.14.6
      cherrypy: unknown
      dateutil: 2.8.1
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.1.2
       libgit2: Not Installed
  looseversion: 1.0.2
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     packaging: 22.0
     pycparser: 2.21
      pycrypto: Not Installed
  pycryptodome: 3.9.8
        pygit2: Not Installed
  python-gnupg: 0.4.8
        PyYAML: 5.4.1
         PyZMQ: 23.2.0
        relenv: 0.12.3
         smmap: Not Installed
       timelib: 0.2.4
       Tornado: 4.5.3
           ZMQ: 4.3.4

System Versions:
          dist: ubuntu 20.04.4 jammy
        locale: utf-8
       machine: x86_64
       release: 5.15.0-71-generic
        system: Linux
       version: Ubuntu 20.04.4 jammy

Ubuntu 22.04.4 jammy is the read OS

Minion versions tested: 3006 and 3006.1

@tqre-mc tqre-mc added Bug broken, incorrect, or confusing behavior needs-triage labels May 8, 2023
@anilsil anilsil added this to the Sulfur v3006.2 milestone May 8, 2023
@Ch3LL
Copy link
Contributor

Ch3LL commented May 12, 2023

Thanks for this, we should definitely get this cleaned up so there is proper error output to the user. This has been set to be fixed in 3006.2

@Ch3LL
Copy link
Contributor

Ch3LL commented May 22, 2023

@tqre-mc can you test this fix: #64319

@Ch3LL
Copy link
Contributor

Ch3LL commented May 23, 2023

Closed by #64319

@Ch3LL Ch3LL closed this as completed May 23, 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 package-repo
Projects
None yet
Development

No branches or pull requests

4 participants