Closed
Description
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