|
|
|
# issue #409.
|
|
|
|
# setns is hard -- it wants to do superuser syscalls, so we must run it in a
|
|
|
|
# child Ansible via sudo. But that only works if sudo works.
|
|
|
|
|
|
|
|
- name: integration/stub_connections/setns_lxd.yml
|
|
|
|
hosts: test-targets
|
|
|
|
gather_facts: false
|
|
|
|
any_errors_fatal: false
|
|
|
|
connection: local
|
|
|
|
tasks:
|
|
|
|
- include_tasks: ../_mitogen_only.yml
|
|
|
|
- include_tasks: _end_play_if_not_sudo_linux.yml
|
|
|
|
|
|
|
|
- name: Run ansible stub-lxc.py
|
|
|
|
environment:
|
|
|
|
ANSIBLE_VERBOSITY: "{{ ansible_verbosity }}"
|
|
|
|
command: |
|
|
|
|
sudo -nE "{{lookup('env', 'VIRTUAL_ENV')}}/bin/ansible"
|
|
|
|
-i localhost,
|
|
|
|
-c setns
|
|
|
|
-e mitogen_kind=lxd
|
Use virtualenv Python for stub connections to workaround problem
../data/stubs/stub-kubectl.py exec -it localhost -- /usr/bin/python -c "...":
Traceback (most recent call last):
File "<string>", line 1, in <module>
LookupError: unknown encoding: base64
It's not clear why this is happening. "stub-kubectl.py" is executed with
the 2.7 virtualenv, while the exec() that happens inside stub-kubectl
was for "/usr/bin/python".
That second Python can't find chunks of its stdlib:
stat("/usr/lib/python2.7/encodings/base64", 0x7ffde8744c60) = -1 ENOENT (No such file or directory)
open("/usr/lib/python2.7/encodings/base64.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/python2.7/encodings/base64module.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/python2.7/encodings/base64.py", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/python2.7/encodings/base64.pyc", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, "Traceback (most recent call last):\n", 35) = 35
write(2, " File \"<string>\", line 1, in <module>\n", 39) = 39
5 years ago
|
|
|
-e ansible_python_interpreter=python
|
|
|
|
-e mitogen_lxc_path={{git_basedir}}/tests/data/stubs/stub-lxc.py
|
|
|
|
-m shell
|
|
|
|
-a "echo hi"
|
issue #251, #412, #434: fix connection configuration brainwrong
This refactors connection.py to pull the two huge dict-building
functions out into new transport_transport_config.PlayContextSpec and
MitogenViaSpec classes, leaving a lot more room to breath in both files
to figure out exactly how connection configuration should work.
The changes made in 1f21a30 / 3d58832 are updated or completely removed,
the original change was misguided, in a bid to fix connection delegation
taking variables from the wrong place when delegate_to was active.
The Python path no longer defaults to '/usr/bin/python', this does not
appear to be Ansible's normal behaviour. This has changed several times,
so it may have to change again, and it may cause breakage after release.
Connection delegation respects the c.DEFAULT_REMOTE_USER whereas the
previous version simply tried to fetch whatever was in the
'ansible_user' hostvar. Many more connection delegation variables closer
match vanilla's handling, but this still requires more work. Some of the
variables need access to the command line, and upstream are in the
process of changing all that stuff around.
6 years ago
|
|
|
-u root
|
|
|
|
localhost
|
|
|
|
args:
|
|
|
|
chdir: ../..
|
|
|
|
warn: "{{ False if ansible_version.full is version('2.10', '<=', strict=True) else omit }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that: result.rc == 0
|
|
|
|
fail_msg: result={{result}}
|
|
|
|
tags:
|
|
|
|
- mitogen_only
|
|
|
|
- sens_lxd
|