summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamie Evans <github@pixelrebel.com>2016-10-18 11:33:51 -0700
committerToshio Kuratomi <a.badger@gmail.com>2016-10-18 11:33:51 -0700
commitb59b5d36e0d770d88787b90d12dea35fbda70b4f (patch)
tree9e52ffa66245211c4a58c976fbd3c37003f46ce5
parentecc40297537e7cf3912710011a09529fa8b53560 (diff)
downloadansible-modules-core-b59b5d36e0d770d88787b90d12dea35fbda70b4f.tar.gz
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.
-rw-r--r--source_control/git.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/source_control/git.py b/source_control/git.py
index 1060ab91..41c29a4c 100644
--- a/source_control/git.py
+++ b/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)