From 606ac78a20f813b702c4b84da9e009b88f1f0900 Mon Sep 17 00:00:00 2001 From: Jamie Evans Date: Tue, 18 Oct 2016 11:33:51 -0700 Subject: [PATCH] verify both tags and commits (#2654) This fixes a bug where the module fails to verify tags. I added a conditional statement in `verify_commit_sign()` that checks if `version` argument is a tag, if so, use `git verify-tag` instead. --- lib/ansible/modules/source_control/git.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/source_control/git.py b/lib/ansible/modules/source_control/git.py index 1060ab91acd..41c29a4ca4c 100644 --- a/lib/ansible/modules/source_control/git.py +++ b/lib/ansible/modules/source_control/git.py @@ -786,7 +786,11 @@ def switch_version(git_path, module, dest, remote, version, verify_commit, depth def verify_commit_sign(git_path, module, dest, version): - cmd = "%s verify-commit %s" % (git_path, version) + if version in get_tags(git_path, module, dest): + git_sub = "verify-tag" + else: + git_sub = "verify-commit" + cmd = "%s %s %s" % (git_path, git_sub, version) (rc, out, err) = module.run_command(cmd, cwd=dest) if rc != 0: module.fail_json(msg='Failed to verify GPG signature of commit/tag "%s"' % version, stdout=out, stderr=err, rc=rc)