Commit Graph

366 Commits (0b0ae5c971bb0d968604ad660adc588151964635)

Author SHA1 Message Date
David Wilson 256628c149 issue #477: backport ansible_mitogen/target.py to Python2.4 6 years ago
David Wilson a48ee3a536 issue #477: vendorize the last 2.4-compatible simplejson
This is in part so image_prep can run against an ancient CentOS 5 image
without any upfront help, and in part simply because it's very easy to
support.
6 years ago
David Wilson 59dd0dc814 issue #477: serve up junk ansible/__init__.py just like Ansible. 6 years ago
David Wilson f52f7f6a62 ansible: merge away unused return values / functions. 6 years ago
David Wilson b5c14cecda docs: docs and docstrings. 6 years ago
David Wilson e767de3f15 issue #412: force-verbose output for mitogen_get_stack. 6 years ago
David Wilson 23866084d7 issue #412: promote "mitogen_get_stack" to the main extension.
This is to make it easier for users to diagnose their own problems.
6 years ago
David Wilson 115c3c5657 issue #412: add docstrings/boilerplate to transport_config.py. 6 years ago
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.
6 years ago
David Wilson 6ca2677de5 ansible: fix test failure during process exit.
======================================================================
ERROR: tests.connection_test (unittest2.loader._FailedTest)
----------------------------------------------------------------------
Traceback (most recent call last):
ImportError: Failed to import test module: tests.connection_test
Traceback (most recent call last):
  File "/home/dmw/src/mitogen/.venv/local/lib/python2.7/site-packages/unittest2/loader.py", line 456, in _find_test_path
    module = self._get_module_from_name(name)
  File "/home/dmw/src/mitogen/.venv/local/lib/python2.7/site-packages/unittest2/loader.py", line 395, in _get_module_from_name
    __import__(name)
RuntimeError: not holding the import lock
6 years ago
David Wilson 6915af502e issue #61: unused import (reported by LGTM) 6 years ago
David Wilson 907c4556c8 issue #61: unused variable (reported by LGTM) 6 years ago
David Wilson f67960848b issue #61: unused import (reported by LGTM) 6 years ago
David Wilson b8ca015b83 issue #61: unused variable (reported by LGTM) 6 years ago
David Wilson bcc7bb7128 issue #61: unused import (reported by LGTM) 6 years ago
David Wilson 4bdf60326c issue #424: ansible: make put_file() raise AnsibleFileNotFound 6 years ago
David Wilson 3f31b166f6 issue #461: Ansible 2.3-compatible _get_candidate_temp_dirs(). 6 years ago
David Wilson 9401c34f64 issue #461: Ansible 2.3 did not have _load_name. 6 years ago
David Wilson 04755c3321 issue #426: tighten up PushFileService types.
Bytes/Unicode mixing caused a hang, so prevent bytes entirely.
6 years ago
David Wilson 1e9f3446c8 issue #426: big hack so reset_connection has task_var access 6 years ago
David Wilson ca9ae4590c issue #426: TemporaryEnvironment must coerce to Unicode. 6 years ago
David Wilson 4bc0d0ec13 issue #426: apply_mode_spec() must handle bytes. 6 years ago
David Wilson 3179951f5c issue #454: fix AttributeError and atexit.yml test. 6 years ago
David Wilson cd01957995 issue #397, #454: pick out only shutil.rmtree() calls from atexit. 6 years ago
David Wilson 09aa27a6a7 ansible: initial mitogen_host_pinned strategy. 6 years ago
David Wilson 22de7f0e72 issue #436: fix string parsing of mitogen_ssh_debug_level
It can be a string when specified on the command line.
6 years ago
David Wilson 87ddead0b2 issue #435, #362: ansible: avoid touching setrlimit() on target.
This replaces the previous method for capping poorly Popen()
performance, instead entirely monkey-patching the problem function
rather than simply working around it.
6 years ago
David Wilson b599253291 issue #435: increase file descriptor limit by 8x.
This is a temporary solution at best.
6 years ago
David Wilson 16911c9464 ansible: fix 3.x TypeError regression. 6 years ago
David Wilson 50241a922f ansible: call on_fork() on broker shutdown; closes #420. 6 years ago
David Wilson 35092c5d35 tests: Unicode/bytes fixes for integration/connection/exec_command.yml 6 years ago
David Wilson 76ec4f201c issue #413: paper over harmless duplicate del_route()
Ideally it would only be called once, and in future maybe it can, but
right now we need to cope with these cases:

* Downstream parent notifies us of disconnection (DEL_ROUTE)
* We notify ourself of disconnection
* We notify ourself and so does downstream parent

It's case 3 that causes the error.
6 years ago
David Wilson bac28bc5ca issue #76, #370: add fix for disconnect cleanup test
Simply listen to RouteMonitor's Context "disconnect"  and forget
contexts according to RouteMonitor's rules, rather than duplicate them
(and screw it up).
6 years ago
David Wilson c148c869e6 issue #76, #370: add disconnect cleanup test 6 years ago
David Wilson 58c0e45661 issue #400: rework the monkeypatch. 6 years ago
David Wilson c9ecc82f85 issue #400: add logic to work around AWX callback bug. 6 years ago
David Wilson 6c71c5bfef issue #369: disable reset_connection on Ansible<2.5.6
https://github.com/ansible/ansible/issues/27520
6 years ago
David Wilson c4aec22a33 issue #369: fix one more _reset() reference. 6 years ago
David Wilson 6107ebdc0d issue #396: fix compatibility with Connection._reset(). 6 years ago
David Wilson d280bba02b issue #369: fix KeyError during new context start.
Update _via_by_context earlier; fixes:

    Traceback (most recent call last):
      File "/Users/dmw/src/mitogen/mitogen/service.py", line 519, in _on_service_call
	return invoker.invoke(method_name, kwargs, msg)
      File "/Users/dmw/src/mitogen/mitogen/service.py", line 253, in invoke
	response = self._invoke(method_name, kwargs, msg)
      File "/Users/dmw/src/mitogen/mitogen/service.py", line 239, in _invoke
	ret = method(**kwargs)
      File "/Users/dmw/src/mitogen/ansible_mitogen/services.py", line 454, in get
	reraise(*result)
      File "/Users/dmw/src/mitogen/ansible_mitogen/services.py", line 412, in _wait_or_start
	response = self._connect(key, spec, via=via)
      File "/Users/dmw/src/mitogen/ansible_mitogen/services.py", line 363, in _connect
	self._update_lru(context, spec, via)
      File "/Users/dmw/src/mitogen/ansible_mitogen/services.py", line 266, in _update_lru
	self._update_lru_unlocked(new_context, spec, via)
      File "/Users/dmw/src/mitogen/ansible_mitogen/services.py", line 253, in _update_lru_unlocked
	if self._refs_by_context[context] == 0:
    KeyError: Context(1008, u'ssh.localhost.sudo.mitogen__user3')
6 years ago
David Wilson 54445470e2 issue #409: add missing path config variables to severa plugins
So every method can be redirected to a stub implementation.
6 years ago
David Wilson a68675af8b issue #409: fix reference error in kubectl.py. 6 years ago
David Wilson 05f9fb4dd8 issue #409: don't run kubectl test in <2.5. 6 years ago
David Wilson 18af1dfb51 ansible: kubectl_path argument appears in wrong connection method
Closes #409.
6 years ago
David Wilson 96f000c5ea ansible: tilde-expand SSH key before passing to SSH; closes #334. 6 years ago
David Wilson 536690760d issue #369: teach CallChain to reset the connection. 6 years ago
David Wilson 33412927f5 issue #369: refactor Connection to support reset()
Now the tests pass.
6 years ago
David Wilson 9b7c958e2e issue #369: refactor ContextService to support reset(). 6 years ago
David Wilson d0f5671887 ansible: split key_from_dict() out into free function. 6 years ago
David Wilson 0dc3f8accf ansible: fix another target.py format string. 6 years ago