From a8b24699bef6fa84effee8616f6af12c27df53a1 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Mon, 10 Aug 2015 09:34:55 -0400 Subject: [PATCH] added gpg2 as fallback fixes #1796 --- lib/ansible/modules/packaging/os/rpm_key.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/packaging/os/rpm_key.py b/lib/ansible/modules/packaging/os/rpm_key.py index d2d5e684015..b3cb6c99ed7 100644 --- a/lib/ansible/modules/packaging/os/rpm_key.py +++ b/lib/ansible/modules/packaging/os/rpm_key.py @@ -141,7 +141,14 @@ class RpmKey: return ret def getkeyid(self, keyfile): - gpg = self.module.get_bin_path('gpg', True) + + gpg = self.module.get_bin_path('gpg') + if not gpg: + gpg = self.module.get_bin_path('gpg2') + + if not gpg: + self.json_fail(msg="rpm_key requires a command lne gpg or gpg2, none found") + stdout, stderr = self.execute_command([gpg, '--no-tty', '--batch', '--with-colons', '--fixed-list-mode', '--list-packets', keyfile]) for line in stdout.splitlines(): line = line.strip()