Commit Graph

11 Commits

Author SHA1 Message Date
David Wilson 1eb5c20f57 ansible: add dummy init.pys so setup.py find_packages() DTRT. 2018-05-15 21:29:00 +01:00
David Wilson 9cc8b21a07 ansible: missing mitogen_su module. 2018-05-02 16:41:35 +01:00
David Wilson 90f7b4baea ansible: stub plugin documentation. 2018-04-29 02:18:26 +01:00
David Wilson bba2a42e44 ansible: add mitogen_sudo method, split out connection subclasses.
Slowly moving towards real implementations in those files.
2018-04-29 01:45:52 +01:00
David Wilson 0a9126c510 ansible: connection plugins missing from previous commit. 2018-04-29 01:22:01 +01:00
David Wilson 098995539d ansible: implement FreeBSD jail support. 2018-04-27 06:21:10 +01:00
David Wilson b1563cd8c1 ansible: hijack lxd connections too. 2018-04-27 04:45:40 +01:00
David Wilson 131bc768c7 ansible: implement LXC support. 2018-04-27 04:40:56 +01:00
David Wilson 3fab8a3af5 ansible: connection delegation v1
This implements the first edition of Connection Delegation, where
delegating connection establishment is initially single-threaded.

ansible_mitogen/strategy.py:
ansible_mitogen/plugins/connection/*:

  Begin splitting connection.Connection into subclasses, exposing them
  directly as "mitogen_ssh", "mitogen_local", etc. connection types.

  This is far from removing strategy.py, but it's a tiny start.

ansible_mitogen/connection.py:

  * config_from_play_context() and config_from_host_vars() build up a
    huge dictionary containing either more or less PlayContext contents,
    or our best attempt at reconstructing a host's connection config
    from its hostvars, where that config is not the current
    WorkerProcess target.

    They both produce the same format with the same keys, allowing
    remaining code to have a single input format.

    These dicts contain fields named after how Ansible refers to them,
    e.g. "sudo_exe".

  * _config_from_via() parses a basic connection specification like
    "username@inventory_name" into one of the aforementioned dicts.

  * _stack_from_config() produces a list of dicts describing the order
    in which (Mitogen) connections should be established, such that each
    element is proxied via= the previous element. The dicts produced by
    this function use Mitogen keyword arguments, the former di.

    These dicts contain fields named after how Mitogen refers to them,
    e.g. "sudo_path".

  * Pass the stack to ContextService, which is responsible for actual
    setup of the full chain.

ansible_mitogen/services.py:

  Teach get() to walk the supplied stack, establishing each connection
  in turn, creating refounts for it before continuing.

  TODO: refcounting is broken in a variety of cases.
2018-04-27 01:23:23 +01:00
David Wilson 485e489aa2 ansible: correct sys.path fixup. 2018-03-19 21:58:32 +05:45
David Wilson bde6f888a0 ansible: restructure package to avoid yet more madness
Ansible's PluginLoader makes up bullshit when it imports a module
(mostly because it has to make up something), therefore we ended up with
duplicate copies of ansible_mitogen loaded: one under
ansible.plugins.*.mitogen, and one under the canonical namespace.

Which broke isinstance().
2018-03-19 21:58:32 +05:45