1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix rpm_key on system with no gpg keys imported

Without the -a option, rpm command will fail (exit code 1) and execute_command() will fail causing an initial key import to not work.

[root@test ~]# rpm -q gpg-pubkey
package gpg-pubkey is not installed
[root@test ~]# echo $?
1
[root@test ~]# rpm -qa gpg-pubkey
[root@test ~]# echo $?
0
This commit is contained in:
aresch 2014-03-06 16:12:11 -08:00
parent 4d80019ac8
commit a45bfbe06e

View file

@ -161,7 +161,7 @@ class RpmKey:
return stdout, stderr return stdout, stderr
def is_key_imported(self, keyid): def is_key_imported(self, keyid):
stdout, stderr = self.execute_command([self.rpm, '-q', 'gpg-pubkey']) stdout, stderr = self.execute_command([self.rpm, '-qa', 'gpg-pubkey'])
for line in stdout.splitlines(): for line in stdout.splitlines():
line = line.strip() line = line.strip()
if not line: if not line: