Commit Graph

109 Commits

Author SHA1 Message Date
David Wilson d1cadf8ac8 tests/ansible: Spec.password() test, document interactive pw limitation. 2019-02-12 16:04:05 +00:00
David Wilson 604b418412 ansible: fix a crash on 2.3 when mitogen_via= host is missing. 2019-02-12 02:10:32 +00:00
David Wilson b89e53fd70 ansible: raise error with correct exception type. 2019-02-09 22:20:40 +00:00
David Wilson 7badb4a25b ansible: hacky parser to alow bools to be specified on command line 2019-02-09 22:04:19 +00:00
David Wilson b499fbe29b ansible: add mitogen_ssh_compression variable. 2019-02-09 22:04:19 +00:00
David Wilson 7b129e8576 ansible: use Poller for WorkerProcess; closes #491. 2019-02-09 22:04:18 +00:00
David Wilson a1121c5a84 issue #499: respect C.BECOME_ALLOW_SAME_USER. 2019-01-29 02:53:21 +00:00
David Wilson 38a553d42d issue #490: prevent double close() destroying unrelated Connection. 2019-01-27 18:46:03 +00:00
David Wilson 8f5b65f7ec issue #477: introduce subprocess isolation.
Since Python 2.4 fork is so defective, we must use subprocesses for
mitogen_task_isolation=fork. This has plenty of upside, since the long
term goal is to dump forking altogether. This allows a gentle
introduction of its replacement.
2019-01-27 03:01:42 +00:00
David Wilson f52f7f6a62 ansible: merge away unused return values / functions. 2019-01-22 09:20:40 +00:00
David Wilson b5c14cecda docs: docs and docstrings. 2019-01-22 05:25:10 +00:00
David Wilson 115c3c5657 issue #412: add docstrings/boilerplate to transport_config.py. 2019-01-22 01:38:58 +00:00
David Wilson 2ad05f1238 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.
2019-01-22 00:40:32 +00:00
David Wilson 4bdf60326c issue #424: ansible: make put_file() raise AnsibleFileNotFound 2019-01-20 19:01:14 +00:00
David Wilson 1e9f3446c8 issue #426: big hack so reset_connection has task_var access 2019-01-19 05:17:39 +00:00
David Wilson 22de7f0e72 issue #436: fix string parsing of mitogen_ssh_debug_level
It can be a string when specified on the command line.
2018-12-08 16:07:41 +00:00
David Wilson 50241a922f ansible: call on_fork() on broker shutdown; closes #420. 2018-11-05 14:28:19 +00:00
David Wilson 35092c5d35 tests: Unicode/bytes fixes for integration/connection/exec_command.yml 2018-11-05 13:15:40 +00:00
David Wilson 6c71c5bfef issue #369: disable reset_connection on Ansible<2.5.6
https://github.com/ansible/ansible/issues/27520
2018-10-31 18:30:03 +00:00
David Wilson c4aec22a33 issue #369: fix one more _reset() reference. 2018-10-31 16:43:27 +00:00
David Wilson 6107ebdc0d issue #396: fix compatibility with Connection._reset(). 2018-10-31 16:43:27 +00:00
David Wilson 54445470e2 issue #409: add missing path config variables to severa plugins
So every method can be redirected to a stub implementation.
2018-10-31 12:40:08 +00:00
David Wilson 18af1dfb51 ansible: kubectl_path argument appears in wrong connection method
Closes #409.
2018-10-31 00:48:11 +00:00
David Wilson 96f000c5ea ansible: tilde-expand SSH key before passing to SSH; closes #334. 2018-10-30 14:58:35 +00:00
David Wilson 536690760d issue #369: teach CallChain to reset the connection. 2018-10-29 19:41:03 +00:00
David Wilson 33412927f5 issue #369: refactor Connection to support reset()
Now the tests pass.
2018-10-29 19:34:50 +00:00
David Wilson 4c81eba599 Merge commit 'refs/pull/377/head' of github.com:dw/mitogen into dmw
(Pull #377)

Changes:
- additional_parameters -> extra_args
- Merge with kubectl changes from dmw branch
- Update docs
- Remove unused username class member
- Avoid mutable kubectl_args class member
- Use six.iteritems
2018-10-02 20:00:00 +01:00
David Wilson 5521945bd2 ansible: temporary files take 5. 2018-10-02 19:19:30 +01:00
Yannig Perré 17548d1e49 [Enhancement] handle kubectl vars from Ansible connector.
This change allows the kubectl connector to support the same options as
Ansible's original connector.

The playbook sample comes with an example of a pod containing two containers
and checking that moving from one container to another, the version of Python
changes as expected.
2018-10-02 11:54:15 +02:00
Yannig Perré 6828926a36 Kubernetes connection support for mitogen. 2018-09-19 16:52:20 +02:00
David Wilson 638b196a45 ansible: fix put_file() for large temporary files.
Reverts 49736b3a, large file copies can't avoid the RTT.

The parent stack must be blocked while FileService progresses, as unlike
the small file path, it does not make a snapshot of the (possibly
temporary) file passed by the action plug-in. So we need to keep that
file alive while the service runs.

Add a new integration test and a new soak test to cover both.
2018-09-10 19:09:37 +01:00
David Wilson 90f89f95fb ansible: fix exec_command() regression. 2018-09-10 01:31:15 +01:00
David Wilson 49736b3ae8 ansible: fix FileService call, and remove another roundtrip. 2018-09-10 00:31:16 +01:00
David Wilson e241081cae ansible: stop sharing target temp_dir in runner.
This cannot work with delegate_to, since delegate_to permits multiple
concurrent tasks to be executing on the same target.
2018-09-09 23:41:53 +01:00
David Wilson 43d9815f6d ansible: use CallChain everywhere.
This replaces the 'dump to logger' behaviour of pipelined calls from
before with a call chain that returns any exception on next synchronized
call.
2018-09-09 20:29:02 +01:00
David Wilson b254eb3399 ansible: fix non-action connection instantiation.
e.g. by synchronize module.
2018-09-08 22:35:42 +01:00
David Wilson 705d77a9be ansible: remove a bunch more aliasing from connection.py. 2018-09-08 22:31:19 +01:00
David Wilson 66142e7d75 ansible: fork isolated tasks from correct parent.
Closes #355.
2018-09-08 22:17:39 +01:00
David Wilson da8c6b45b0 ansible: remove task_vars aliasing from connection.py.
Crazy spam creep.
2018-09-08 21:59:17 +01:00
David Wilson 86942b6bf9 ansible: add explanatory exception
If disconnection occurs during a Connection.call(), return
AnsibleConnectionFailure.
2018-09-08 20:53:11 +01:00
David Wilson 9792b8b54f ansible: use template-expanded delegate_to hostname in one more location. 2018-09-08 20:53:11 +01:00
David Wilson 90c2ed03d0 ansible: fix synchronize module
Broken by recent connection delegation fixes.
2018-08-20 15:43:56 +01:00
David Wilson 7458dfae85 ansible: avoid roundtrip for small file transfers.
Calls to connect.put_file() where the file is sufficiently small enough
to fit in a single RPC proceed without waiting for an RPC response. If
the write fails the target context will log an exception, and any
subsequent step depending on the written file will fail.

I verified every built-in action plugin for file transfer calls, and
they all depend on the transferred file in the following step, so this
should be safe.

Reduces template/copy actions to 2-RTT, loop-20-templates.yml runtime
reduced from 30 seconds to 10 seconds over a 250ms link compared to
v0.2.2, and from 123 seconds compared to vanilla with pipelining
enabled.
2018-08-20 15:18:03 +01:00
David Wilson bce4f59138 issue #345: disable IdentitiesOnly by default. 2018-08-19 22:13:30 +01:00
David Wilson a2686b1a2c issue #321: simplify temp directory handling. 2018-08-19 16:00:35 +01:00
David Wilson 3d588323ff issue #340: use expanded delegate_to hostname, not template.
PlayContext.delegate_to is the unexpanded template, Ansible doesn't keep
a copy of it around anywhere convenient. We either need to re-expand it
or take the expanded version that was stored on the Task, which is what
is done here.
2018-08-18 16:43:59 +01:00
David Wilson 916e46621b issue #340: add connection delegation tests. 2018-08-18 16:43:59 +01:00
David Wilson 6dcd5f8998 issue #340: split up Connection._connect()
The logic was getting too busy.
2018-08-18 16:43:59 +01:00
David Wilson a1e653978b issue #340: connection delegation used wrong variable name.
When inventory name did not match remote_addr, it would attempt to SSH
to the inventory name.
2018-08-18 16:43:59 +01:00
David Wilson 370b98f960 ansible: tidy up connection.py.
- more docstrings.
- _wrap_or_none -> optional_secret()
2018-08-18 16:43:59 +01:00