When /etc/sudoers has log_output (or similar) enabled the process spawned by
`ctx.sudo()` via `mitogen.parent.Connection.start_child()` receives a stdin
that is in non-blocking mode. The immediate symptom is that `os.openfd(0,
...).read(n)` sometimes returns `None`, causing the first stage to raise an
unhandled TypeError.
The fix (for now) is to use `select.select()` in a while loop to read stdin.
This increases the command size slightly, but I think it's a reasonable
tradeoff until/unless the cause is more fully understood.
All CI tests are now run with sudoers log_output enabled, in order to catch
regressions. `first_stage_test.CommandLineTest` has been amended, because it
relied on implementation details of the bootstrap process that are no longer
true.
Before
```
SSH command size: 755
Preamble (mitogen.core + econtext) size: 18227 (17.80KiB)
Original Minimized Compressed
mitogen.core 152218 148.7KiB 68437 66.8KiB 45.0% 18124 17.7KiB 11.9%
mitogen.parent 98853 96.5KiB 51103 49.9KiB 51.7% 12881 12.6KiB 13.0%
mitogen.fork 8445 8.2KiB 4139 4.0KiB 49.0% 1652 1.6KiB 19.6%
mitogen.ssh 10827 10.6KiB 6893 6.7KiB 63.7% 2099 2.0KiB 19.4%
mitogen.sudo 12089 11.8KiB 5924 5.8KiB 49.0% 2249 2.2KiB 18.6%
mitogen.select 12325 12.0KiB 2929 2.9KiB 23.8% 964 0.9KiB 7.8%
mitogen.service 41581 40.6KiB 22398 21.9KiB 53.9% 5847 5.7KiB 14.1%
mitogen.fakessh 15767 15.4KiB 8149 8.0KiB 51.7% 2676 2.6KiB 17.0%
mitogen.master 55317 54.0KiB 28846 28.2KiB 52.1% 7528 7.4KiB 13.6%
```
After
```
SSH command size: 798
Preamble (mitogen.core + econtext) size: 18227 (17.80KiB)
Original Minimized Compressed
mitogen.core 152218 148.7KiB 68437 66.8KiB 45.0% 18124 17.7KiB 11.9%
mitogen.parent 98944 96.6KiB 51180 50.0KiB 51.7% 12910 12.6KiB 13.0%
mitogen.fork 8445 8.2KiB 4139 4.0KiB 49.0% 1652 1.6KiB 19.6%
mitogen.ssh 10827 10.6KiB 6893 6.7KiB 63.7% 2099 2.0KiB 19.4%
mitogen.sudo 12089 11.8KiB 5924 5.8KiB 49.0% 2249 2.2KiB 18.6%
mitogen.select 12325 12.0KiB 2929 2.9KiB 23.8% 964 0.9KiB 7.8%
mitogen.service 41581 40.6KiB 22398 21.9KiB 53.9% 5847 5.7KiB 14.1%
mitogen.fakessh 15767 15.4KiB 8149 8.0KiB 51.7% 2676 2.6KiB 17.0%
mitogen.master 55317 54.0KiB 28846 28.2KiB 52.1% 7528 7.4KiB 13.6%
```
|
3 months ago | |
|---|---|---|
| .. | ||
| files | 3 months ago | |
| group_vars | 5 months ago | |
| host_vars | 5 years ago | |
| roles | 4 months ago | |
| README.md | 5 years ago | |
| _container_create.yml | 5 years ago | |
| _container_finalize.yml | 1 year ago | |
| _container_setup.yml | 5 months ago | |
| _user_accounts.yml | 3 months ago | |
| ansible.cfg | 1 year ago | |
| hosts.ini | 5 years ago | |
| macos_localhost.yml | 9 months ago | |
| py24-build.sh | 1 year ago | |
| py24.sh | 7 years ago | |
| setup.yml | 2 years ago | |
| tox.ini | 5 years ago | |
README.md
image_prep
This directory contains Ansible playbooks for building the Docker containers used for testing, or for setting up an OS X laptop so the tests can (mostly) run locally.
The Docker config is more heavily jinxed to trigger adverse conditions in the code, the OS X config just has the user accounts.
See ../README.md for a (mostly) description of the accounts created.
Building the containers
No single version of Ansible supports every Linux distribution that we target. To workaround this Tox is used, to install and run multiple versions of Ansible, in Python virtualenvs.
tox
Preparing an OS X box
WARNING: this creates a ton of accounts with preconfigured passwords. It is generally impossible to restrict remote access to these, so your only option is to disable remote login and sharing.
ansible-playbook -b -c local -i localhost, -l localhost setup.yml