update ActionBase._low_level_execute_command to honor executable (#68315)

* update ActionBase._low_level_execute_command to honor executable

* adding changelog fragment

* renaming changelog fragment to .yml

* noop change to bump shippable

* adding raw_executable integration test

* copying aliases from raw

* removing blank lines

* skipping aix and freebsd

* noop to bump shippable

* moving tests to raw/

* removing become_method: sudo ; it doesn't work on AIX

* removing trailing blank line

* forcing become_method: su to try to get AIX to work

Co-authored-by: Rob Wagner <rob.wagner@sas.com>
(cherry picked from commit 977b58740b)
pull/69271/head
rwagnergit 5 years ago committed by Matt Clay
parent f252494ff2
commit 081ce0e4e1

@ -0,0 +1,2 @@
bugfixes:
- Update ActionBase._low_level_execute_command to honor executable (https://github.com/ansible/ansible/issues/68054)

@ -1045,6 +1045,10 @@ class ActionBase(with_metaclass(ABCMeta, object)):
display.debug("_low_level_execute_command(): changing cwd to %s for this command" % chdir)
cmd = self._connection._shell.append_command('cd %s' % chdir, cmd)
# https://github.com/ansible/ansible/issues/68054
if executable:
self._connection._shell.executable = executable
ruser = self._get_remote_user()
buser = self.get_become_option('become_user')
if (sudoable and self._connection.become and # if sudoable and have become

@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -ux
export ANSIBLE_BECOME_ALLOW_SAME_USER=1
export ANSIBLE_ROLES_PATH=../
ansible-playbook -i ../../inventory runme.yml -e "output_dir=${OUTPUT_DIR}" -v "$@"

@ -0,0 +1,4 @@
- hosts: testhost
gather_facts: no
roles:
- { role: raw }

@ -81,3 +81,27 @@
- 'raw_result2.stdout_lines is defined'
- 'raw_result2.rc == 0'
- 'raw_result2.stdout_lines == ["foobar"]'
# the following five tests added to test https://github.com/ansible/ansible/pull/68315
- name: get the path to sh
shell: which sh
register: sh_path
- name: use sh
raw: echo $0
args:
executable: "{{ sh_path.stdout }}"
become: true
become_method: su
register: sh_output
- name: assert sh
assert:
that: "(sh_output.stdout | trim) == sh_path.stdout"
- name: use bash
raw: echo $0
args:
executable: "{{ bash_path.stdout }}"
become: true
become_method: su
register: bash_output
- name: assert bash
assert:
that: "(bash_output.stdout | trim) == bash_path.stdout"

Loading…
Cancel
Save