require git when trying to use it in ansible-galaxy cli (#49212)

* require git when trying to use it in ansible-galaxy cli

Previously we weren't setting `required=True` when calling
`get_bin_path` and the path would return `None`, this would cause
a traceback when attempting to ' '.join() to create a string
representation of the failed command for error output

Fixes #49200

Signed-off-by: Adam Miller <admiller@redhat.com>

* add changelog

Signed-off-by: Adam Miller <admiller@redhat.com>
(cherry picked from commit 81540bd754)
This commit is contained in:
Adam Miller 2018-11-28 12:28:21 -06:00 committed by Toshio Kuratomi
parent 6dba96c8cc
commit eafc7fc531
2 changed files with 3 additions and 1 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- "ansible-galaxy: properly warn when git isn't found in an installed bin path instead of traceback"

View file

@ -159,7 +159,7 @@ class RoleRequirement(RoleDefinition):
raise AnsibleError("- scm %s is not currently supported" % scm)
try:
scm_path = get_bin_path(scm)
scm_path = get_bin_path(scm, required=True)
except (ValueError, OSError, IOError):
raise AnsibleError("could not find/use %s, it is required to continue with installing %s" % (scm, src))