Commit Graph

58 Commits

Author SHA1 Message Date
David Wilson 1f77d24bec Update copyright year everywhere. 2019-02-13 16:16:49 +00:00
David Wilson 97f3cfe4f4 issue #477: target.file_exists() wrapper.
os.path.exists physical module name varies across major Python versions.
2019-01-27 03:03:47 +00:00
David Wilson bcc7bb7128 issue #61: unused import (reported by LGTM) 2019-01-20 19:42:30 +00:00
David Wilson 9401c34f64 issue #461: Ansible 2.3 did not have _load_name. 2019-01-20 10:50:38 +00:00
David Wilson 1b17aa1d1a ansible: fix temp cleanup regression and add test; closes #397. 2018-10-23 14:42:44 +01:00
David Wilson 5521945bd2 ansible: temporary files take 5. 2018-10-02 19:19:30 +01:00
David Wilson 9ff34afafe ansible: fix regression. 2018-09-10 02:28:29 +01:00
David Wilson e241081cae ansible: stop sharing target temp_dir in runner.
This cannot work with delegate_to, since delegate_to permits multiple
concurrent tasks to be executing on the same target.
2018-09-09 23:41:53 +01:00
David Wilson 43d9815f6d ansible: use CallChain everywhere.
This replaces the 'dump to logger' behaviour of pipelined calls from
before with a call chain that returns any exception on next synchronized
call.
2018-09-09 20:29:02 +01:00
David Wilson 084c0ac065 ansible: avoid roundtrip in copy action due to fixup_perms2().
On top of existing temporary files work, this reduces the number of
roundtrips required for "copy" and "template" actions from 6 to 3.
2018-08-20 13:28:45 +01:00
David Wilson ac9b84d237 issue #321: 2.4+ compatibility fixes, disable test on Vanilla. 2018-08-19 19:26:54 +01:00
David Wilson f24f02ba06 issue #321: take remote_tmp and system_tmpdirs into account.
Can't simply ignore these settings as some users may have weird noexec
filesystems.
2018-08-19 18:50:53 +01:00
David Wilson a2686b1a2c issue #321: simplify temp directory handling. 2018-08-19 16:00:35 +01:00
David Wilson 3d588323ff issue #340: use expanded delegate_to hostname, not template.
PlayContext.delegate_to is the unexpanded template, Ansible doesn't keep
a copy of it around anywhere convenient. We either need to re-expand it
or take the expanded version that was stored on the Task, which is what
is done here.
2018-08-18 16:43:59 +01:00
David Wilson b44b823c4a ansible: make _remote_expand_user() pay attention to sudoable=.. 2018-07-25 19:27:25 +00:00
David Wilson a8e4dcc98d issue #301: correct remote_tmp evaluation context.
Vanilla Ansible expands remote_tmp variables in the context of the login
account, not any become_user account.
2018-07-23 21:43:06 -07:00
David Wilson 012745efea issue #297: local actions must execute with fixed directory.
Local actions must execute in the the parent directory of the playbook
that defines the action.
2018-07-10 17:56:05 +01:00
David Wilson 410016ff47 Initial Python 3.x port work.
* ansible: use unicode_literals everywhere since it only needs to be
  compatible back to 2.6.
* compat/collections.py: delete this entirely and rip out the parts of
  functools that require it.
* Introduce serializable Kwargs dict subclass that translates keys to
  Unicode on instantiation.
* enable_debug_logging() must set _v/_vv globals.
* cStringIO does not exist in 3.x.
* Treat IOLogger and LogForwarder input as latin-1.
* Avoid ResourceWarnings in first stage by explicitly closing fps.
* Fix preamble_size.py syntax errors.
2018-07-07 14:55:47 +01:00
David Wilson 3994f1b30a ansible: implment async job time limit. 2018-06-10 02:28:49 +01:00
David Wilson e35694acd5 ansible: flake8 fixes. 2018-06-10 01:22:46 +01:00
David Wilson fdbd954113 ansible: preload built-in modules in ModuleDepScanner.
For "ansible -m setup" over a 25ms link, avoids 65 roundtrips and
reduces runtime from 5.7s to 4.1s (-28%).

For "ansible -m setup" over a simulated 250 ms link, reduces runtime
from m27.015s to 0m8.254s (-69%).
2018-05-29 14:55:01 +01:00
David Wilson ddf28987a0 master: split Select() into new module to reduce wire size.
service.py currently imports master.py(+parent.py) just to get Select().
2018-05-24 23:59:10 +01:00
David Wilson f737ff5276 ansible: stop passing through remote_tmp variable
Ansiballz does not use remote_tmp so neither should we, per #239.
2018-05-04 15:30:51 +01:00
David Wilson dafe12b315 ansible: fix AnsibleUnicode crash when processing "~username". 2018-04-30 15:21:26 +01:00
David Wilson 71057c78f9 ansible: rename helpers.py to target.py, to reflect its purpose 2018-04-08 19:34:03 +01:00
David Wilson 4a823c7a27 issue #164: missing cast() for _remote_file_exists(). 2018-04-05 19:35:03 +01:00
David Wilson d503956493 ansible: Remove duplicate casts already done in Connection 2018-04-05 02:55:27 +01:00
David Wilson 6aeb4e9f05 issue #164: precisely emulate Ansible's stdio behaviour.
* Use identical logic to select when stdout/stderr are merged, so
  'stdout', 'stdout_lines', 'stderr', 'stderr_lines' contain the same
  output before/after the extension.

* When stdout/stderr are merged, synthesize carriage returns just like
  the TTY layer.

* Mimic the SSH connection multiplexing message on stderr. Not really
  for user code, but so compare_output_test.sh needs fewer fixups.
2018-04-05 01:16:34 +01:00
David Wilson 26cc0f2724 issue #164: fix remote_tmp handling on <2.5 2018-04-04 20:19:46 +01:00
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.
2018-04-04 14:05:57 +01:00
David Wilson e5723e4f5f ansible: fix _make_tmp_path() regression on 2.3.x.
Due to issue #177.
2018-04-01 21:59:59 +01:00
David Wilson 16b64392e2 issue #106: support WANT_JSON modules. 2018-04-01 18:19:34 +01:00
David Wilson df6daaf3c4 issue #106: working/semantically compatible binary support. 2018-04-01 16:39:10 +01:00
David Wilson 43e4f5009a issue #106: remove 2 needless Invocation attributes. 2018-04-01 16:39:10 +01:00
David Wilson c891ab078a issue #106: working old-style native module execution
Still abusing Python import mechanism, but one big step closer to
eliminating that.
2018-04-01 16:39:10 +01:00
David Wilson 98c15942f7 issue #177: fix bizarre syntax error in last commit. 2018-04-01 16:38:22 +01:00
David Wilson cf25437019 issue #177: populate Shell.tempdir global on creating a tempdir.
It looks a lot like multiple calls to _make_tmp_path() will result in
multiple temporary directories on the remote machine, only the last of
which will be cleaned up.

We must be bug-for-bug compatible for now, so ignore the problem in the
meantime.
2018-04-01 15:58:44 +01:00
David Wilson 6eed3aa1fa issue #177: fetch and cache HOME value during connection setup.
This ensures only 1 roundtrip is required for every invocation of
_remote_expand_user().
2018-04-01 15:57:46 +01:00
David Wilson 037bed895b issue #110: _transfer_data() must handle dicts and Unicode(!) 2018-03-19 21:58:33 +05:45
David Wilson d34025fae9 ansible: _transfer_data() must return remote_path.
Fixes DebOps bug.
2018-03-19 21:58:33 +05:45
David Wilson a9db27d424 ansible: instrument every ActionMixin override. 2018-03-19 21:58:33 +05:45
David Wilson 9b7991cd45 issue #118: log exceptions for emulated commands, fix AttributeError in helpers.py
Turns out Ansible can't be trusted to actually check the result
dictionary everywhere it expects one, so put the real exception text
into -vvv output too.
2018-03-19 21:58:33 +05:45
David Wilson b63af1de85 ansible: implement _transfer_data for <2.4 template action 2018-03-19 21:58:33 +05:45
David Wilson b527628b17 issue #109: do exactly what Ansible does
Could it be that some empty dict magically gets populated from somewhere
invisible?
2018-03-19 21:58:32 +05:45
David Wilson e0382ab2db ansible: teach ActionModule to disappear for non-Mitogen Connections
Closes #103.
2018-03-19 21:58:32 +05:45
David Wilson 734fb75203 ansible: mixins.py docstrings. 2018-03-19 21:58:32 +05:45
David Wilson 7080751f13 ansible: support environment: too. 2018-03-19 21:58:32 +05:45
David Wilson 7cf2edc3a8 ansible: Support many more common playbook variables. 2018-03-19 21:58:32 +05:45
David Wilson 3183dd4147 ansible: initial support for async jobs
Running in a thread to begin with, but this must change.
2018-03-19 21:58:31 +05:45
David Wilson ff617824a1 ansible: fix some flake8 errors
* Unused imports
* Undefined names in helpers.py
* Copyright header wrapping
2018-03-19 21:58:31 +05:45