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

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.
This commit is contained in:
Jamie Evans 2016-10-18 11:33:51 -07:00 committed by Matt Clay
parent 720574ef77
commit 606ac78a20

View file

@ -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)