Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix encoding error on grp.gr_name, which can contain non-ascii chars at domain PCs #25804

Merged
merged 2 commits into from
Aug 31, 2017

Conversation

flare-ws
Copy link
Contributor

@flare-ws flare-ws commented Jun 16, 2017

SUMMARY

Default callback plugin fails on decoding non-ascii characters comes from lookup.filetree plugin.
For example, if with_filetree applied on directory with group name DOMAIN\{cyrillic characters} (see reproduction below)

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

filetree lookup plugin (plugins/lookup/filetree.py)

ANSIBLE VERSION
ansible 2.4.0 (fix_filetree_grp_encoding fde1f4d08e) last updated 2017/06/16 18:45:50 (GMT +300)

forked from devel:3aa41ed https://github.com/ansible/ansible/commit/3aa41eda0bfbd7eef2b327c61e44521b3587b0f8
ADDITIONAL INFORMATION

To reproduce:

Create a directory owned by domain group:

scherbakov@jellyfish:~# ls -lah
drwxr-xr-x   4 scherbakov  YAMONEY\Пользователи домена   136B 16 июн 19:00 .
drwx------  26 scherbakov  YAMONEY\Пользователи домена   884B 16 июн 17:48 ..
drwxr-xr-x   2 scherbakov  YAMONEY\Пользователи домена    68B 16 июн 19:00 some_another_directory
drwxr-xr-x   2 scherbakov  YAMONEY\Пользователи домена    68B 16 июн 19:00 some_directory

Run playbook contains with_filetree against this directory:

- hosts: all
  gather_facts: no
  tasks:
  - debug:
      msg: "{{ item }}"
    with_filetree:
      - "/home/scherbakov/"

Playbook output will contain this warning instead of normal output:

 [WARNING]: Failure using method (v2_runner_item_on_ok) in callback plugin (<... .CallbackModule object at 0x10f3d2c90>): 'ascii'
codec can't encode characters in position 102-113: ordinal not in range(128)

If task fails, error wont be displayed either

@ansibot ansibot added affects_2.4 This issue/PR affects Ansible v2.4 bugfix_pull_request c:plugins/lookup needs_triage Needs a first human triage before being processed. labels Jun 16, 2017
@s-hertel s-hertel removed the needs_triage Needs a first human triage before being processed. label Jun 16, 2017
@flare-ws flare-ws changed the title Fix encoding on grp.gr_name, which can contain non-ascii chars at domain PCs Fix encoding error on grp.gr_name, which can contain non-ascii chars at domain PCs Jun 20, 2017
@ansibot ansibot added the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Jun 21, 2017
@bcoca bcoca removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Jun 21, 2017
@ansibot ansibot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Jun 21, 2017
@ansibot ansibot added support:core This issue/PR relates to code supported by the Ansible Engineering Team. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. labels Jun 29, 2017
@calfonso calfonso requested a review from abadger August 30, 2017 18:24
@calfonso
Copy link
Contributor

rebuild_merge

@ansibot ansibot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Aug 30, 2017
@ansibot ansibot merged commit c16d258 into ansible:devel Aug 31, 2017
abadger pushed a commit that referenced this pull request Sep 1, 2017
…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 c16d258)
@abadger
Copy link
Contributor

abadger commented Sep 1, 2017

Merged to devel and cherry-picked to stable-2.3.

prasadkatti pushed a commit to prasadkatti/ansible that referenced this pull request Oct 1, 2017
…at domain PCs (ansible#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
@ansibot ansibot added bug This issue/PR relates to a bug. and removed bugfix_pull_request labels Mar 6, 2018
@ansible ansible locked and limited conversation to collaborators Apr 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.4 This issue/PR affects Ansible v2.4 bug This issue/PR relates to a bug. c:plugins/lookup support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants