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 types when evaluating interpreter #36541

Merged
merged 2 commits into from Feb 22, 2018
Merged

Conversation

sivel
Copy link
Member

@sivel sivel commented Feb 21, 2018

SUMMARY

Fix types used in modify_module when evaluating the interpreter. Fixes #36536

Using str inside of shlex.split results in ['b/usr/bin/python']. And passing a byte string to _get_shebang produces an interpreter_config of u"ansible_b'python'_interpreter" which then wouldn't be located in task vars.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

lib/ansible/executor/module_common.py

ANSIBLE VERSION
2.4
2.5
2.6
ADDITIONAL INFORMATION

@sivel sivel requested a review from abadger February 21, 2018 20:16
@sivel sivel changed the title Fix types when evaluating interpreter. Fixes #36536 Fix types when evaluating interpreter Feb 21, 2018
@ansibot ansibot added bugfix_pull_request needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Feb 21, 2018
@sivel sivel removed the needs_triage Needs a first human triage before being processed. label Feb 21, 2018
* One fix: be sure to turn args into text before passing to _get_shebang()
* Rename variables that contain bytes to b_*
* Get rid of to_text() and to_bytes() calls that do nothing (because the
  data is already the proper type)
@abadger
Copy link
Contributor

abadger commented Feb 22, 2018

+1 to merge

@sivel
Copy link
Member Author

sivel commented Feb 22, 2018

@abadger the changes LGTM. Tested against py3 and py2 and get the expected outcome.

@abadger abadger merged commit a4df4d3 into ansible:devel Feb 22, 2018
abadger pushed a commit that referenced this pull request Feb 22, 2018
* Fix types when evaluating interpreter. Fixes #36536
* Rename variables that contain bytes to b_*
* Get rid of to_text() and to_bytes() calls that do nothing (because the
  data is already the proper type)

(cherry picked from commit a4df4d3)
abadger pushed a commit to abadger/ansible that referenced this pull request Feb 22, 2018
* Fix types when evaluating interpreter. Fixes ansible#36536
* Rename variables that contain bytes to b_*
* Get rid of to_text() and to_bytes() calls that do nothing (because the
  data is already the proper type)

(cherry picked from commit a4df4d3)
@abadger
Copy link
Contributor

abadger commented Feb 22, 2018

Merged to devel. cherrypicked for 2.4.4-beta1. PR #36561 opened to cherrypick to stable-2.5 for 2.5.0rc1

abadger added a commit that referenced this pull request Feb 22, 2018
* Fix types when evaluating interpreter (#36541)

* Fix types when evaluating interpreter. Fixes #36536
* Rename variables that contain bytes to b_*
* Get rid of to_text() and to_bytes() calls that do nothing (because the
  data is already the proper type)

(cherry picked from commit a4df4d3)

* Changelog entry for the ansible_*_interpreter fix
@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 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue/PR relates to a bug. 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.

ansible_python_interpreter ignored in Ansible 2.4 for apt module when use async parameter
4 participants