Commit Graph

551 Commits

Author SHA1 Message Date
David Wilson 1b93a4f51a issue #141: remove reference to incomplete change 2018-03-19 21:58:34 +05:45
Alex Willmer e3b700b553 tests: Fix no such option -o running FakeSsh.test_okay()
Full output of failed test

```
ERROR: test_okay (__main__.FakeSshTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests/ssh_test.py", line 16, in test_okay
    ssh_path=testlib.data_path('fakessh.py'),
  File "/home/alex/src/mitogen/mitogen/master.py", line 650, in ssh
    return self.connect('ssh', **kwargs)
  File "/home/alex/src/mitogen/mitogen/parent.py", line 463, in connect
    return self._connect(context_id, klass, name=name, **kwargs)
  File "/home/alex/src/mitogen/mitogen/parent.py", line 449, in _connect
    stream.connect()
  File "/home/alex/src/mitogen/mitogen/ssh.py", line 104, in connect
    super(Stream, self).connect()
  File "/home/alex/src/mitogen/mitogen/parent.py", line 395, in connect
    self._connect_bootstrap()
  File "/home/alex/src/mitogen/mitogen/ssh.py", line 116, in
_connect_bootstrap
    time.time() + 10.0):
  File "/home/alex/src/mitogen/mitogen/parent.py", line 207, in
iter_read
    (''.join(bits)[-300:],)
mitogen.core.StreamError: EOF on stream; last 300 bytes received:
'Usage: fakessh.py [options]\n\nfakessh.py: error: no such option: -o\n'
```
2018-03-19 21:58:34 +05:45
Alex Willmer 7063d172e9 tests: Add Tox config for Python 2.6 and 2.7
I could not get Python 2.5 or earlier to work. Too many packages
(critically docker) don't support it.
2018-03-19 21:58:34 +05:45
Alex Willmer 332e3ec5d0 setup: Scan project dir to find packages
This eliminates the possibility of the filesystem and setup.py
diverging, as had happened with ansible_mitogen/connection/ vs
ansible_mitogen/connection.py
2018-03-19 21:58:34 +05:45
David Wilson 88c198ea05 issue #141: copy Ansible's connect_timeout for sudo too. 2018-03-19 21:58:34 +05:45
David Wilson 63c3fc623c docs: note the semantic difference in Mitogen vs. Ansible timeouts
Related to issue #141.
2018-03-19 21:58:34 +05:45
David Wilson 587256bbce issue #141: unify connect deadline handling
Now there is a single deadline calculated by the parent.Stream
constructor, and reused for both SSH and sudo.
2018-03-19 21:58:34 +05:45
David Wilson d58b5ad777 core: prevent creation of unicode Message.data
Was triggering a crash indirectly due to Ansible passing us Unicode
strings. Needs a better fix.
2018-03-19 21:58:34 +05:45
David Wilson 31065ffe4a issue #143: avoid long-form options in sudo.py. 2018-03-19 21:58:34 +05:45
David Wilson 21a8026a63 issue #140: import reproduction 2018-03-19 21:58:34 +05:45
David Wilson 8f85943083 issue #139: mention relating buffering issue 2018-03-19 21:58:34 +05:45
David Wilson 1f1d691a28 docs: update to match @moreati's code golf birdies :) 2018-03-19 21:58:34 +05:45
Alex Willmer f95b37429f parent: Read preamble in first stage with os.fdopen()
SSH command size: 439 (+4 bytes)
Preamble size: 8941 (no change)

This _increases_ the size of the first stage, but
- Eliminates one of the two remaining uses of `sys`
- Reads the preamble as a byte-string, no call `.encode()`
   is needed on Python 3 before calling `_()`
2018-03-19 21:58:34 +05:45
Alex Willmer a62edd0b7e parent: Use os.execl in first stage
SSH command size: 435 (-4 bytes)
Preamble size: 8962 (no change)

os.execl is the same as os.execv, but it take a variable number of
arguments instead of a single sequence.
2018-03-19 21:58:34 +05:45
Alex Willmer 545652c34f parent: Trim whitespace & e variable in first stage
SSH command size: 439 (-4 bytes)
Preamble size: 8962 (no change)
2018-03-19 21:58:34 +05:45
Alex Willmer 0336de6722 parent: Combine first stage imports
SSH command size: 443 (-5 bytes)
Preamble size: 8962
2018-03-19 21:58:34 +05:45
Alex Willmer 48949cd249 parent: Use 'zip' alias of 'zlib' decoder
SSH command size: 448 (-5 bytes)
Preamble size: 8941 (no change)

NB: The 'zip' alias was absent in Python 3.x, until Python 3.4. This
should change be reverted if Python 3.0, 3.2, or 3.3 support is
required.
2018-03-19 21:58:34 +05:45
Alex Willmer 0f82f68fee parent: Precompute preamble sizes for first stage
SSH command size: 453 (no change)
Preamble size: 8941 (-5 bytes)
2018-03-19 21:58:34 +05:45
Alex Willmer dfd7070ceb parent: reuse _=codecs.decode alias in exec'd first stage
SSH command size: 453 (-8 bytes)
Preamble size: 8946 (no change)
2018-03-19 21:58:34 +05:45
Alex Willmer 53a8c59ae5 parent: Remove redudant os.exit() in first stage
SSH command size: 461 (-8 bytes)
Preamble size: 8946 (no change)

Since python has reached the last statement this should occur anyway.
2018-03-19 21:58:34 +05:45
Alex Willmer e051cf0ea0 parent: Unroll os.close() loop in first stage
SSH command size: 469 (-11 bytes)
Preamble size: 8946 (no change)

Although the source is longer, the _compressed_ length is reduced.
2018-03-19 21:58:34 +05:45
Alex Willmer 85f36f4cb1 parent: Prefer "import foo;x=foo" in first stage
SSH command size: 481 (down 1)
Preamble size: 8946 (no change)
2018-03-19 21:58:33 +05:45
Alex Willmer f999b9adbf Crank zlib.compress() upto 9
SSH command size: 482 bytes (no change)
Preamble size: 8946 bytes (down 33)
2018-03-19 21:58:33 +05:45
Alex Willmer 9aa83ef77f docs: First round of Pickle-likes survey 2018-03-19 21:58:33 +05:45
Alex Willmer a1fc21bb06 docs: Maximum size of pencode values 2018-03-19 21:58:33 +05:45
Alex Willmer e24db89f3a docs: Disco comparison 2018-03-19 21:58:33 +05:45
Alex Willmer 04f4851138 docs: multiprocessing comparison
Not strictly a rival, but has enough commonalities to be worth noting
2018-03-19 21:58:33 +05:45
Alex Willmer 8c227b2bdd docs: More detail about Baker 2018-03-19 21:58:33 +05:45
Alex Willmer e06e438228 docs: More detail about execnet 2018-03-19 21:58:33 +05:45
Alex Willmer da58f8595d docs: More detail about chopsticks 2018-03-19 21:58:33 +05:45
Alex Willmer d7fbb9aef6 docs: Link compared projects to their website
All outgoing links checked with

```bash
cd docs
make linkcheck
```
2018-03-19 21:58:33 +05:45
Alex Willmer 4615ab1a8e docs: Enable sphinx-autobuild
```bash
cd docs
make
```

to run a webserver that automatically rerenders whenever the rST is
modified.
2018-03-19 21:58:33 +05:45
David Wilson b243da087c issue #121: fix call_function_test by not raising the dead
A first small mea culpa to all my testing sins of late :)
2018-03-19 21:58:33 +05:45
David Wilson f1009b7502 issue #121: fix breakage caused by a9c6c13
This actually addresses multiple problems:

* Single-file programs were broken, since the fix introduced in
  6931cc10c4 caused builtin_find_module()
  to start indicating __main__ can always be loaded locally. That's
  broken, and there might be more cases where the same problem will crop
  up.

  Since it was indicated __main__ could be loaded locally, the built-in
  import machinery was allowed to attempt that (since we remove __main__
  from sys.modules during bootstrap), which caused a safety check to
  fire in the bowels of Python:

      "Cannot re-init internal module %.200s"

* The check for presence of the whitelist was totally broken, since the
  whitelist is never an empty list. Therefore 'self' was being returned
  for every module, including extension modules like 'termios'.

I have hand-verified this does not break the fix for issue #113. I
looked at writing a test for that, but it requires a Docker container
(or similar) with an ancient version of Ansible installed. Will open a
separate ticket tracking this.
2018-03-19 21:58:33 +05:45
David Wilson f8c85b549f docs: typo 2018-03-19 21:58:33 +05:45
David Wilson dc9dda08e1 Add link to IRC; closes #116 2018-03-19 21:58:33 +05:45
David Wilson 5dddee62ea Revert "issue #121: minimal fix for nested_test."
Mega broken.

This reverts commit a7dbbd96aa.
2018-03-19 21:58:33 +05:45
David Wilson a0c4df72b0 issue #121: minimal fix for nested_test. 2018-03-19 21:58:33 +05:45
David Wilson b2a433dcc4 ssh: CompressionLevel is a v1-only option.
It's ignored by newer SSHes, which only pay attention to Compression.
2018-03-19 21:58:33 +05:45
Alex Willmer b433645d11 tests: Fix import error 2018-03-19 21:58:33 +05:45
Alex Willmer c6f3bfd93a tests: Correct path to apply_mode_spec() 2018-03-19 21:58:33 +05:45
Alex Willmer bbd8b6253b tests: Find all *_test.py scripts and run them
Don't rely on maintaining a list of test files, it's too easy to forget
one and silently fail to run it.
2018-03-19 21:58:33 +05:45
Alex Willmer c34a12369e tests: Rely on unittest2 to print failure messages 2018-03-19 21:58:33 +05:45
Alex Willmer 2c05958ecc docs: Replace google.com as target of get_url()
Probably best to avoid angering the 800 lb gorilla with access to killer
robots.

https://example.org works, this is why it exists.
2018-03-19 21:58:33 +05:45
Alex Willmer 1c20c61605 docs: Convert all URLs that support https://
Excluded: graphml XML namespaces, links to e.g. Fabric homepage

Fixes #128
2018-03-19 21:58:33 +05:45
David Wilson f8738f1c52 issue #122: helper to print environment 2018-03-19 21:58:33 +05:45
David Wilson 7d12154a92 ansible: fix formatting 2018-03-19 21:58:33 +05:45
David Wilson 089f39716e docs: beginnings of testimonials section 2018-03-19 21:58:33 +05:45
David Wilson 8329bee889 parent: log discard_until() input when IOLOG is enabled
Trying to diagnose a Reddit user's problem.
2018-03-19 21:58:33 +05:45
David Wilson 12c6e574fb ansible: disable host key checking for now
Need a better story (perhaps a callback function?) for handling this.
2018-03-19 21:58:33 +05:45