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>
This commit is contained in:
parent
1e08bb7a6f
commit
977b58740b
5 changed files with 40 additions and 0 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- Update ActionBase._low_level_execute_command to honor executable (https://github.com/ansible/ansible/issues/68054)
|
|
@ -1053,6 +1053,10 @@ class ActionBase(with_metaclass(ABCMeta, object)):
|
||||||
display.debug("_low_level_execute_command(): changing cwd to %s for this command" % chdir)
|
display.debug("_low_level_execute_command(): changing cwd to %s for this command" % chdir)
|
||||||
cmd = self._connection._shell.append_command('cd %s' % chdir, cmd)
|
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()
|
ruser = self._get_remote_user()
|
||||||
buser = self.get_become_option('become_user')
|
buser = self.get_become_option('become_user')
|
||||||
if (sudoable and self._connection.become and # if sudoable and have become
|
if (sudoable and self._connection.become and # if sudoable and have become
|
||||||
|
|
6
test/integration/targets/raw/runme.sh
Executable file
6
test/integration/targets/raw/runme.sh
Executable file
|
@ -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 "$@"
|
4
test/integration/targets/raw/runme.yml
Normal file
4
test/integration/targets/raw/runme.yml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
- hosts: testhost
|
||||||
|
gather_facts: no
|
||||||
|
roles:
|
||||||
|
- { role: raw }
|
|
@ -81,3 +81,27 @@
|
||||||
- 'raw_result2.stdout_lines is defined'
|
- 'raw_result2.stdout_lines is defined'
|
||||||
- 'raw_result2.rc == 0'
|
- 'raw_result2.rc == 0'
|
||||||
- 'raw_result2.stdout_lines == ["foobar"]'
|
- '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…
Reference in a new issue