mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
[rpm_key] Fix to import first key on the system (#31514)
* [rpm_key] Fix to import first key on the system Fixes: #31483 * [rpm_key] removed unsafe_shell and "throwaway" underscore * [rpm_key] adding test to add the first key on system
This commit is contained in:
parent
ada6159ece
commit
5ccc1072ea
2 changed files with 14 additions and 2 deletions
|
@ -170,11 +170,15 @@ class RpmKey(object):
|
|||
return stdout, stderr
|
||||
|
||||
def is_key_imported(self, keyid):
|
||||
cmd=self.rpm + ' -q gpg-pubkey --qf "%{description}" | ' + self.gpg + ' --no-tty --batch --with-colons --fixed-list-mode -'
|
||||
cmd = self.rpm + ' -q gpg-pubkey'
|
||||
rc, stdout, stderr = self.module.run_command(cmd)
|
||||
if rc != 0: # No key is installed on system
|
||||
return False
|
||||
cmd += ' --qf "%{description}" | ' + self.gpg + ' --no-tty --batch --with-colons --fixed-list-mode -'
|
||||
stdout, stderr = self.execute_command(cmd)
|
||||
for line in stdout.splitlines():
|
||||
if keyid in line.split(':')[4]:
|
||||
return True
|
||||
return True
|
||||
return False
|
||||
|
||||
def import_key(self, keyfile):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue