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

Correct fail_json call in rpm_key

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde 2017-06-12 17:40:24 +05:30 committed by Brian Coca
parent dd1f5d7acd
commit e160bcf237

View file

@ -161,7 +161,7 @@ class RpmKey(object):
gpg = self.module.get_bin_path('gpg2') gpg = self.module.get_bin_path('gpg2')
if not gpg: if not gpg:
self.json_fail(msg="rpm_key requires a command line gpg or gpg2, none found") self.module.fail_json(msg="rpm_key requires a command line gpg or gpg2, none found")
stdout, stderr = self.execute_command([gpg, '--no-tty', '--batch', '--with-colons', '--fixed-list-mode', '--list-packets', keyfile]) stdout, stderr = self.execute_command([gpg, '--no-tty', '--batch', '--with-colons', '--fixed-list-mode', '--list-packets', keyfile])
for line in stdout.splitlines(): for line in stdout.splitlines():
@ -170,7 +170,7 @@ class RpmKey(object):
# We want just the last 8 characters of the keyid # We want just the last 8 characters of the keyid
keyid = line.split()[-1].strip()[8:] keyid = line.split()[-1].strip()[8:]
return keyid return keyid
self.json_fail(msg="Unexpected gpg output") self.module.fail_json(msg="Unexpected gpg output")
def is_keyid(self, keystr): def is_keyid(self, keystr):
"""Verifies if a key, as provided by the user is a keyid""" """Verifies if a key, as provided by the user is a keyid"""