Commit Graph

63 Commits (73a0c485cf7480ee528ef49d900b86a236a96631)

Author SHA1 Message Date
David Wilson e0381606af Ensure remote_tmp is respected everywhere.
Logic is still somewhat different from Ansible: we don't have to care
about sudo/non-sudo cases, etc.
7 years ago
David Wilson a731be32a2 ansible: use _ansible_shell_executable in ScriptRunner.
Now we match Ansible error output and exit status. Ansible:

    $ ansible localhost -e end=2 -m custom_binary_single_null
    localhost | FAILED! => {
        "changed": false,
        "module_stderr": "Shared connection to localhost closed.\r\n",
        "module_stdout": "/bin/sh: /Users/dmw/.ansible/tmp/ansible-tmp-1522661797.42-158833651208060/custom_binary_single_null: cannot execute binary file\r\n",
        "msg": "MODULE FAILURE",
        "rc": 126
    }

Mitogen now:

    localhost | FAILED! => {
        "changed": false,
        "module_stderr": "/bin/sh: /var/folders/gw/f6w3dgy16fsg5y4kdthbqycw0000gn/T/ansible_mitogenAYF8LM-binary: cannot execute binary file\n",
        "module_stdout": "",
        "msg": "MODULE FAILURE",
        "rc": 126
    }

Previously:

    localhost | FAILED! => {
        "changed": false,
        "module_stderr": "<type 'exceptions.OSError'>: [Errno 8] Exec format error",
        "module_stdout": "",
        "msg": "MODULE FAILURE",
        "rc": 1
    }
7 years ago
David Wilson 1fab6d9c25 ansible: permit execve() of temporary files on Linux. 7 years ago
David Wilson a5e4a6f346 issue #106: move helpers.get_bytecode() into NewStyleRunner 7 years ago
David Wilson a98a51a328 issue #106: handle JSONARGS modules too. 7 years ago
David Wilson 8cc20856a8 issue #106: support custom new-style modules + 'reexec by default'
Rather than assume any structure about the Python code:

* Delete the exit_json/fail_json monkeypatches.
* Patch SystemExit rather than a magic monkeypatch-thrown exception
* Setup fake cStringIO stdin, stdout, stderr and return those along with
  SystemExit exit status
* Setup _ANSIBLE_ARGS as we used to, since we still want to override
  that with '{}' to prevent accidental import hangs, but also provide
  the same string via sys.stdin.
* Compile the module bytecode once and re-execute it for every
  invocation. May change this back again later, once some benchmarks are
  done.
* Remove the fixups stuff for now, it's handled by ^ above.

Should support any "somewhat new style" Python module, including those
that just give up and dump stuff to stdout directly.
7 years ago
David Wilson a954d54644 issue #106: support old-style too. 7 years ago
David Wilson 16b64392e2 issue #106: support WANT_JSON modules. 7 years ago
David Wilson df6daaf3c4 issue #106: working/semantically compatible binary support. 7 years ago
David Wilson 0dd5e04eae issue #106: partially working BinaryRunner/Planner.
Refactor planner.py to look a lot more like runner.py. This 'structural
cutpaste' looks messy -- probably we can simplify this code, even though
it's pretty simple already.
7 years ago
David Wilson dbaca05ac8 issue #106: Runner module docstring 7 years ago
David Wilson c891ab078a issue #106: working old-style native module execution
Still abusing Python import mechanism, but one big step closer to
eliminating that.
7 years ago
David Wilson 34a37a0ba5 issue #106: ansible: rename and significant pad out runners.py
Aiming to have working NativeRunner and BinaryRunner to begin with.
7 years ago