mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00: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:
committed by
Martin Krizek
parent
ada6159ece
commit
5ccc1072ea
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user