You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mitogen/tests/ansible
David Wilson 3613162bc0 ansible: enable forking when requested and for async jobs.
Closes #105.
References #155.

mitogen/service.py:
    Refactor services to support individually exposed methods with
    different security policies for each method.

    - @mitogen.service.expose() to expose a method and set its policy
    - @mitogen.service.arg_spec() to validate input.
    - Require basic service message format to be a tuple of
      `(method, kwargs)`, where kwargs is always a dict.
    - Update DeduplicatingService to match the new scheme.

ansible_mitogen/connection.py:
    - Rename 'method' to 'method_name' to disambiguate it from the
      service.call()'s method= argument.

ansible_mitogen/planner.py:
    - Generate an ID for every job, sync or not, and fetch job results
      from JobResultService rather than via the initiating function
      call's return value.
    - Planner subclasses now get to select whether their Runner should
      run in a forked process. The base implementation requests this if
      the 'mitogen_isolation_mode=fork' task variable is present.

ansible_mitogen/runner.py:
    Teach runners to deliver their result via JobResultService executing
    in their indirect parent mux process.

ansible_mitogen/plugins/actions/mitogen_async_status.py:
    Split the implementation up into methods, and more compatibly
    emulate Ansible's existing output.

ansible_mitogen/process.py:
    Mux processes now host JobResultService.

ansible_mitogen/services.py:
    Update existing services to the new mitogen.service scheme, and
    implement JobResultService:

    * listen() method for synchronous jobs. planner.invoke() registers a
      Sender with the service prior to invoking the job, then sleeps
      waiting for the service to write the job result to the
      corresponding Receiver.

    * Non-blocking get() method for implementing mitogen_async_status
      action.

    * Child-accessible push() method for delivering task results.

ansible_mitogen/target.py:
    New helpers for spawning a virginal subprocess on startup, from
    which asynchronous and mitogen_task_isolation=fork jobs are forked.
    Necessary to avoid a task inheriting potentially
    polluted/monkey-patched parent environment, since remaining jobs
    continue to run in the original child process.

docs/ansible.rst:
    Add/merge/remove some behaviours/risks.

tests/ansible/integration:
    New tests for forking/async.
8 years ago
..
integration ansible: enable forking when requested and for async jobs. 8 years ago
lib ansible: enable forking when requested and for async jobs. 8 years ago
regression issue #164: rename tests for clarity 8 years ago
tests issue #164: dir structure is gross, but at least tab completion works :> 8 years ago
.gitignore issue #164: whups, delete checked in binaries. 8 years ago
Makefile issue #164: fix makefile 8 years ago
README.md issue #164: import run_ansible_playbook.sh. 8 years ago
all.yml issue #164: rearrange playbooks a little more 8 years ago
ansible.cfg issue #164: add action module to return active strategy. 8 years ago
compare_output_test.py issue #164: split "examples" out into regression/integration tests. 8 years ago
gcloud-ansible-playbook.py issue #164: split "examples" out into regression/integration tests. 8 years ago
hosts issue #164: split "examples" out into regression/integration tests. 8 years ago
hosts.docker issue #164: split "examples" out into regression/integration tests. 8 years ago
run_ansible_playbook.sh ansible: enable forking when requested and for async jobs. 8 years ago

README.md

tests/ansible Directory

This is an an organically growing collection of integration and regression tests used for development and end-user bug reports.

It will be tidied up over time, meanwhile, the playbooks here are a useful demonstrator for what does and doesn't work.

run_ansible_playbook.sh

This is necessary to set some environment variables used by future tests, as there appears to be no better way to inject them into the top-level process environment before the Mitogen connection process forks.

Running Everything

ANSIBLE_STRATEGY=mitogen_linear ./run_ansible_playbook.sh all.yml