handle non strings in requirements version for ansible-galaxy (#52109)

This commit is contained in:
Veaceslav Mindru 2019-02-20 20:28:05 +01:00 committed by Sam Doran
parent 90a199a0ee
commit 6f91bccf78
2 changed files with 4 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- handle non strings in requirements version for ansible-galaxy

View file

@ -32,6 +32,7 @@ from ansible.module_utils.common.process import get_bin_path
from ansible.module_utils.six import string_types from ansible.module_utils.six import string_types
from ansible.playbook.role.definition import RoleDefinition from ansible.playbook.role.definition import RoleDefinition
from ansible.utils.display import Display from ansible.utils.display import Display
from ansible.module_utils._text import to_text
__all__ = ['RoleRequirement'] __all__ = ['RoleRequirement']
@ -163,7 +164,7 @@ class RoleRequirement(RoleDefinition):
run_scm_cmd(clone_cmd, tempdir) run_scm_cmd(clone_cmd, tempdir)
if scm == 'git' and version: if scm == 'git' and version:
checkout_cmd = [scm_path, 'checkout', version] checkout_cmd = [scm_path, 'checkout', to_text(version)]
run_scm_cmd(checkout_cmd, os.path.join(tempdir, name)) run_scm_cmd(checkout_cmd, os.path.join(tempdir, name))
temp_file = tempfile.NamedTemporaryFile(delete=False, suffix='.tar', dir=C.DEFAULT_LOCAL_TMP) temp_file = tempfile.NamedTemporaryFile(delete=False, suffix='.tar', dir=C.DEFAULT_LOCAL_TMP)