- 25 Sep, 2015 2 commits
-
-
Fixes #12501
James Cammarata committed -
Due to the way we're now calculating delegate_to, if that value is based on a loop variable ('item') we need to calculate all of the possible delegated_to variables for that loop. Fixes #12499James Cammarata committed
-
- 24 Sep, 2015 10 commits
-
-
There doesn't appear to be anything that actually uses tmp_path in the connection plugins so we don't need to pass that in to exec_command. That change also means that we don't need to pass tmp_path around in many places in the action plugins any more. there may be more cleanup that can be done there as well (the action plugin's public run() method takes tmp as a keyword arg but that may not be necessary). As a sideeffect of this patch, some potential problems with chmod and the patch, assemble, copy, and template modules has been fixed (those modules called _remote_chmod() with the wrong order for their parameters. Removing the tmp parameter fixed them.)
Toshio Kuratomi committed -
And update portions of code to expect the proper error. Fixes #12512
James Cammarata committed -
It's not available on older versions of paramiko such as shipped in RHEL6
Toshio Kuratomi committed -
Fixes #12477
James Cammarata committed -
The process is already gone, so there's not going to be any new data showing up on its stderr; we only want to make sure that we haven't missed something that was already written. So polling once is enough.
Abhijit Menon-Sen committed -
This change is motivated by an ssh oddity: when ControlPersist is enabled, the first (i.e. master) connection goes into the background; we see EOF on its stdout and the process exits, but we never see EOF on its stderr. So if we ran a command like this: ANSIBLE_SSH_PIPELINING=1 ansible -T 30 -vvv somehost -u someuser -m command -a whoami We would first do select([stdout,stderr], timeout) and read the command module output, then select([stdout,stderr], timeout) again and read EOF on stdout, then select([stderr], timeout) AGAIN (though the process has exited), and select() would wait for the full timeout before returning rfd=[], and then we would exit. The use of a very short timeout in the code masked the underlying problem (that we don't see EOF on stderr). It's always preferable to call select() with a long timeout so that the process doesn't use any CPU until one of the events it's interested in happens (and then select will return independent of elapsed time). (A long timeout value means "if nothing happens, sleep for up to <x>"; omitting the timeout value means "if nothing happens, sleep forever"; specifying a zero timeout means "don't sleep at all", i.e. poll for events and return immediately.) This commit uses a long timeout, but explicitly detects the condition where we've seen EOF on stdout and the process has exited, but we have not seen EOF on stderr. If and only if that happens, it reruns select() with a short timeout (in practice it could just exit at that point, but I chose to be extra cautious). As a result, we end up calling select() far less often, and use less CPU while waiting, but don't sleep for a long time waiting for something that will never happen. Note that we don't omit the timeout to select() altogether because if we're waiting for an escalation prompt, we DO want to give up with an error after some time. We also don't set exceptfds, because we're not actually acting on any notifications of exceptional conditions.Abhijit Menon-Sen committed -
The value was useless -- unused by the callers and always hardcoded to the empty string.
Toshio Kuratomi committed -
Add Weekday (0-6) as a number and add weeknumber (00-52)
James Cammarata committed -
Toshio Kuratomi committed
-
Gerben Geijteman committed
-
- 23 Sep, 2015 26 commits
-
-
Fixes #12488
Toshio Kuratomi committed -
fixes #12495
Brian Coca committed -
Brian Coca committed
-
Fix typo in checking select results
James Cammarata committed -
We used to display input chunks earlier anyway, so this isn't making things more verbose.
Abhijit Menon-Sen committed -
It's possible for more than one fd to be set, so 'elif' is obviously not the right thing to use.
Abhijit Menon-Sen committed -
James Cammarata committed
-
Toshio Kuratomi committed
-
James Cammarata committed
-
Fix one more failing test on Python 3
Toshio Kuratomi committed -
James Cammarata committed
-
James Cammarata committed
-
Without this, we could execute «ssh -q ...» and call select(), which would timeout after the default 10s, and only then send initial data. (This is a relic of the earlier change where we always ran ssh with -vvv, so the situation where it would sit quietly never happened in practice; but this would have been the right thing to do even then.)
Abhijit Menon-Sen committed -
Fixes #12478
James Cammarata committed -
Fixes #12473
James Cammarata committed -
Fixes one failing test. The long series of module_utils/basic.py fixes were all because module_utils/basic is imported in ansible/inventory/script.py.
Marius Gedminas committed -
Because the builtin map() acts like an iterator already.
Marius Gedminas committed -
Even Python 2.4 automatically promotes int to long.
Marius Gedminas committed -
NB: we can't use 'from __future__ import print_function', but luckily print(one_thing) works fine on both Python 2 and Python 3 without that.
Marius Gedminas committed -
Marius Gedminas committed
-
Make the code compatible with Pythons 2.4 through 3.5 by using sys.exc_info()[1] instead. This is necessary but not sufficient for Python 3 compatibility.
Marius Gedminas committed -
James Cammarata committed
-
James Cammarata committed
-
The event loop (even after it was brought into one place in _run in the previous commit) was hard to follow. The states and transitions weren't clear or documented, and the privilege escalation code was non-blocking while the rest was blocking. Now we have a state machine with four states: awaiting_prompt, awaiting_escalation, ready_to_send (initial data), and awaiting_exit. The actions in each state and the transitions between then are clearly documented. The check_incorrect_password() method no longer checks for empty strings (since they will always match), and check_become_success() uses equality rather than a substring match to avoid thinking an echoed command is an indication of successful escalation. Also adds a check_missing_password connection method to detect the error from sudo -n/doas -n.
Abhijit Menon-Sen committed -
The main exec_command/put_file/fetch_file methods now _build_command and call _run to handle input from/output to the ssh process. The purpose is to bring connection handling together in one place so that the locking doesn't have to be split across functions. Note that this doesn't change the privilege escalation and connection IO code at all—just puts it all into one function. Most of the changes are just moving code from one place to another (e.g. from _connect to _build_command, from _exec_command and _communicate to _run), but there are some other notable changes: 1. We test for the existence of sshpass the first time we need to use password authentication, and remember the result. 2. We set _persistent in _build_command if we're using ControlPersist, for later use in close(). (The detection could be smarter.) 3. Some apparently inadvertent inconsistencies between put_file and fetch_file (e.g. argument quoting, sftp -b use) have been removed. Also reorders functions into a logical sequence, removes unused imports and functions, etc. Aside: the high-level EXEC/PUT/FETCH description should really be logged from ConnectionBase, while individual subclasses log transport-specific details.
Abhijit Menon-Sen committed -
Fixes #12484
James Cammarata committed
-
- 22 Sep, 2015 2 commits
-
-
* Make LookupBase an abc with required methods (run()) marked as an abstractmethod * Mark methods that don't use self as @staticmethod * Document how to implement the run method of a lookup plugin.
Toshio Kuratomi committed -
Add mention of roles_path parameter to `ansible-galaxy install` command
James Cammarata committed
-