chef icon indicating copy to clipboard operation
chef copied to clipboard

Bug fix for apt_repository when creating a new keyring (#15008)

Open tpowell-progress opened this issue 6 months ago • 1 comments

  • when they keyring does not exists or it empty the key is not valid

The keyring_key_is_valid function will run the following:

$ gpg --no-default-keyring --keyring  /etc/apt/keyrings/ring.gpg --list-public-keys fingerprint
gpg: error reading key: No public key
$ echo $?
2

the stdout none? matcher will return true for this error and the key will be delcared "valid" even though it does not exist. This will cause the not_if block called from install_key_from_keyserver_to_keyring to skip the execute and the key will not be installed.

Description

Related Issue

Types of changes

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [ ] Chore (non-breaking change that does not add functionality or fix an issue)

Checklist:

  • [ ] I have read the CONTRIBUTING document.
  • [ ] I have run the pre-merge tests locally and they pass.
  • [ ] I have updated the documentation accordingly.
  • [ ] I have added tests to cover my changes.
  • [ ] If Gemfile.lock has changed, I have used --conservative to do it and included the full output in the Description above.
  • [ ] All new and existing tests passed.
  • [ ] All commits have been signed-off for the Developer Certificate of Origin.

tpowell-progress avatar Jun 05 '25 21:06 tpowell-progress