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] gpg.receive_keys returns success on failed import #63144

Closed
5 tasks done
lkubb opened this issue Nov 30, 2022 · 0 comments · Fixed by #63162
Closed
5 tasks done

[BUG] gpg.receive_keys returns success on failed import #63144

lkubb opened this issue Nov 30, 2022 · 0 comments · Fixed by #63162
Labels
Bug broken, incorrect, or confusing behavior needs-triage State-Module

Comments

@lkubb
Copy link
Contributor

lkubb commented Nov 30, 2022

Description
In some circumstances, the gpg.present state reports success even though the requested key is not present. This always happens when a result does not contain a user ID, not sure about other cases.

Setup

  • on-prem machine
  • VM (Virtualbox, KVM, etc. please specify)
  • classic packaging
  • onedir packaging
  • used bootstrap to install

Steps to Reproduce the behavior

# /srv/salt/gpgtest.sls
Receive key:
  gpg.present:
    - name: B9B7A108373276BF3C0406F9FC8A7D14C3CD543A
    - keyserver: keys.openpgp.org

Show shiny new key:
  module.run:
    - gpg.get_key:
      - fingerprint: B9B7A108373276BF3C0406F9FC8A7D14C3CD543A
    - require:
      - gpg: B9B7A108373276BF3C0406F9FC8A7D14C3CD543A
$ salt-call state.apply gpgtest
[ERROR   ] 'gpg.get_key': False
local:
----------
          ID: Receive key
    Function: gpg.present
        Name: B9B7A108373276BF3C0406F9FC8A7D14C3CD543A
      Result: True
     Comment: Adding B9B7A108373276BF3C0406F9FC8A7D14C3CD543A to GPG keychain
     Started: 01:03:12.679780
    Duration: 333.338 ms
     Changes:
----------
          ID: Show shiny new key
    Function: module.run
      Result: False
     Comment: 'gpg.get_key': False
     Started: 01:03:13.014473
    Duration: 8.633 ms
     Changes:

Summary for local
------------
Succeeded: 1
Failed:    1
------------
Total states run:     2
Total run time: 341.971 ms

Expected behavior
The key to actually be present or reported failure.

Versions Report

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

Dependency Versions:
          cffi: 1.14.6
      cherrypy: unknown
      dateutil: 2.8.1
     docker-py: Not Installed
         gitdb: 4.0.9
     gitpython: 3.1.29
        Jinja2: 3.1.0
       libgit2: Not Installed
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: 2.21
      pycrypto: Not Installed
  pycryptodome: 3.9.8
        pygit2: Not Installed
        Python: 3.9.14 (main, Sep 27 2022, 00:00:00)
  python-gnupg: 0.4.8
        PyYAML: 5.4.1
         PyZMQ: 23.2.0
         smmap: 5.0.0
       timelib: 0.2.4
       Tornado: 4.5.3
           ZMQ: 4.3.4

System Versions:
          dist: rocky 9.0 Blue Onyx
        locale: utf-8
       machine: x86_64
       release: 5.14.0-70.26.1.el9_0.x86_64
        system: Linux
       version: Rocky Linux 9.0 Blue Onyx

Additional context
gpg.present does not ensure presence turned out to be multiple problems:

I repurposed this issue for the latter one.

@lkubb lkubb added Bug broken, incorrect, or confusing behavior needs-triage labels Nov 30, 2022
@lkubb lkubb changed the title [BUG] gpg.present does not ensure presence [BUG] gpg.receive_keys returns success on failed import Nov 30, 2022
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 State-Module
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants