summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Scherbakov <flare@flare.ws>2017-08-31 10:39:24 +0300
committerToshio Kuratomi <a.badger@gmail.com>2017-09-01 08:34:22 -0700
commit0ba2fb1b47e821f4619b8bacb9aee5f1200b8f95 (patch)
tree4f0f64d0144dff366ac4aa5b84506b830d4854c4
parent20e47b6132260467efe3328750209f6fa060432a (diff)
downloadansible-0ba2fb1b47e821f4619b8bacb9aee5f1200b8f95.tar.gz
Fix encoding error on grp.gr_name, which can contain non-ascii chars at domain PCs (#25804)
* Fix encoding errors on grp.gr_name, which can contain non-ascii character at LDAP/AD domain workstations * fix: utils.to_text() is now used instead of py3-incompatible unicode() method (cherry picked from commit c16d258a27d73a31a577f02fdcbcdadd78fb2d95)
-rw-r--r--lib/ansible/plugins/lookup/filetree.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/ansible/plugins/lookup/filetree.py b/lib/ansible/plugins/lookup/filetree.py
index 3cc6796f0c..f3ba6382fb 100644
--- a/lib/ansible/plugins/lookup/filetree.py
+++ b/lib/ansible/plugins/lookup/filetree.py
@@ -30,7 +30,7 @@ except ImportError:
pass
from ansible.plugins.lookup import LookupBase
-from ansible.module_utils._text import to_native
+from ansible.module_utils._text import to_native, to_text
try:
from __main__ import display
@@ -86,7 +86,7 @@ def file_props(root, path):
except KeyError:
ret['owner'] = st.st_uid
try:
- ret['group'] = grp.getgrgid(st.st_gid).gr_name
+ ret['group'] = to_text(grp.getgrgid(st.st_gid).gr_name)
except KeyError:
ret['group'] = st.st_gid
ret['mode'] = '0%03o' % (stat.S_IMODE(st.st_mode))