summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFahri Cihan Demirci <femnad@users.noreply.github.com>2016-10-24 18:55:01 -0400
committerToshio Kuratomi <a.badger@gmail.com>2016-10-24 23:18:33 -0700
commit5533afb2135014689e4bd964d8ed290680b903f7 (patch)
tree30a477bd07e3467441161ecca87c3b71512a1885
parente85bcfe5bb84cec333c32a7426513d3029cf634e (diff)
downloadansible-modules-core-5533afb2135014689e4bd964d8ed290680b903f7.tar.gz
Fix String Type for Python 3 Branch Comparison
* Use the `to_native` conversion method to convert a command output to the appropriate form when looking for branch names in the command output, therefore avoiding a `TypeError` in Python 3. (cherry picked from commit 4c020102a9cd6fe908c9a4a326a38f972f63a903)
-rw-r--r--source_control/git.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/source_control/git.py b/source_control/git.py
index a9952172..06965f03 100644
--- a/source_control/git.py
+++ b/source_control/git.py
@@ -223,7 +223,7 @@ from distutils.version import LooseVersion
from ansible.module_utils.basic import AnsibleModule, get_module_path
from ansible.module_utils.known_hosts import add_git_host_key
from ansible.module_utils.six import b, string_types
-from ansible.module_utils._text import to_bytes, to_native
+from ansible.module_utils._text import to_native
def head_splitter(headfile, remote, module=None, fail_on_error=False):
@@ -519,7 +519,7 @@ def get_tags(git_path, module, dest):
def is_remote_branch(git_path, module, dest, remote, version):
cmd = '%s ls-remote %s -h refs/heads/%s' % (git_path, remote, version)
(rc, out, err) = module.run_command(cmd, check_rc=True, cwd=dest)
- if to_bytes(version, errors='surrogate_or_strict') in out:
+ if to_native(version, errors='surrogate_or_strict') in out:
return True
else:
return False