Commit Graph

16386 Commits (775486c9d6c082cd729951dc9863ce9d4e9f4a87)
 

Author SHA1 Message Date
James Cammarata 4c7843f268 Merge pull request #12532 from fboender/devel
Output proper JSON from vbox dynamic inventory contrib script
9 years ago
James Cammarata abfeb104df Merge pull request #12529 from soarpenguin/bug-fix
fix no self pointer out of class.
9 years ago
Toshio Kuratomi 342bc97322 Port chroot conection plugin to the latest v2 connection API.
Also get pipelining working for people who look to chroot as an example
for their own connection plugins

Note: In the latest v2 API, action handles become but chroot doesn't
reliably handle become.  Maybe we need to add a has_become attribute
that the action can display an appropriate error.
9 years ago
Toshio Kuratomi 056a020357 Do not fail if /proc/uptime is not present
This can happen in chroot environments that don't have all of /proc
available
9 years ago
Toshio Kuratomi ae66d01a33 Document how a command is executed on the remote machine
Helps connection plugin implementors understand how to structure
exec_command()
9 years ago
Ferry Boender c6c3ce6616 Output proper JSON from vbox dynamic inventory contrib script 9 years ago
James Cammarata 6dd38c2a10 Fix parent attribute lookup to be default
Fixes #12526
9 years ago
James Cammarata a1c38a3fda Adding delegate_to to Blocks 9 years ago
Brian Coca bb6141ec41 renamed managed_syslog to no_target_syslog 9 years ago
Brian Coca a591582b24 Merge pull request #12530 from amenonsen/fixups
Update outdated comment
9 years ago
Abhijit Menon-Sen 8251ab2e37 Update outdated comment
Since #12165 was merged, hostnames are properly validated.
9 years ago
Abhijit Menon-Sen 6ff4d40d74 Update outdated comment
We now use "sudo -n" instead of "sudo -k && sudo …"
9 years ago
soarpenguin 1ea66e234f fix logic judgment error. 9 years ago
soarpenguin 2caa52a981 fix no self pointer out of class. 9 years ago
Brian Coca 37a918438b task logging revamp
* allow global no_log setting, no need to set at play or task level, but can be overriden by them
 * allow turning off syslog only on task execution from target host (manage_syslog), overlaps with no_log functionality
 * created log function for task modules to use, now we can remove all syslog references, will use systemd journal if present
 * added debug flag to modules, so they can make it call new log function conditionally
 * added debug logging in module's run_command
9 years ago
Brian Coca b757798f3e Merge pull request #12483 from jeffwidman/patch-2
Clarified that .yml, .yaml, and .json are allowable file extensions for inventory vars files
9 years ago
James Cammarata 60e1a1f8eb Fix bug in nested lookup where pop is called indiscriminately 9 years ago
Brian Coca 191ae0831d fixed syntax error 9 years ago
Brian Coca 48412c13b2 fixed copy n paste typo on future code 9 years ago
James Cammarata bb1101498d Clean up typo from cdc6c52 9 years ago
James Cammarata cdc6c5208e Clean string data run through the template engine
Also strip UnsafeProxy off of low level srings and objects to ensure
they don't cause issues later down the road

Fixes #12513
9 years ago
James Cammarata ae9b34b1d9 Fix for equality checking in Host to make sure things are like types 9 years ago
Toshio Kuratomi fa9ea32a86 Fix test of whether a result has a failed host 9 years ago
Brian Coca 1c49e3b842 draft shared service code for modules, part of spliting service module 9 years ago
Toshio Kuratomi 41756be4d3 Update core module ref 9 years ago
Toshio Kuratomi dcdcd9e9c5 Move is_executable to the toplevel of basic.py so we can utilize it from other code 9 years ago
James Cammarata aedec951be Merge pull request #12521 from mgedmin/patch-1
Typo in shell command in example
9 years ago
Marius Gedminas b57d549e16 Typo in shell command in example 9 years ago
James Cammarata ccddda1ebc Merge pull request #12502 from mgedmin/py3k
Python 3: make test_variable_manager_precedence pass
9 years ago
James Cammarata eb8d7dcd14 Make sure formatted strings don't bomb on tuples
Fixes #12501
9 years ago
James Cammarata 31d5f88a1d Use the task loop to calculate multiple delegated hosts
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 #12499
9 years ago
Toshio Kuratomi a1428d6bed Remove tmp as a parameter to the connection plugins
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.)
9 years ago
James Cammarata 95b371dd60 Use AnsibleFileNotFound instead of AnsibleParsingError when YAML files are not found
And update portions of code to expect the proper error.

Fixes #12512
9 years ago
Toshio Kuratomi 0250beb68a Remove compress option from paramiko connection for now
It's not available on older versions of paramiko such as shipped in RHEL6
9 years ago
James Cammarata 12df9f2e31 Make hostvars more dynamic again to improve performance with large inventories
Fixes #12477
9 years ago
Abhijit Menon-Sen 82b33c381f We don't need even a token timeout here; just poll once
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.
9 years ago
Abhijit Menon-Sen 6e82df451a Clarify select() handling for ssh connections
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.
9 years ago
Toshio Kuratomi 03127dcfae remove the stdin return value from connection plugin exec_command() methods
The value was useless -- unused by the callers and always hardcoded to
the empty string.
9 years ago
James Cammarata 9d47eabfa4 Merge pull request #12506 from hyperized/devel
Add Weekday (0-6) as a number and add weeknumber (00-52)
9 years ago
Toshio Kuratomi 24b9e2e6d1 Update extras submodule ref 9 years ago
Gerben Geijteman 4c20964475 Add Weekday (0-6) as a number and add weeknumber (00-52) 9 years ago
Marius Gedminas 56f2a25bff Python 3: there's no 'unicode' 9 years ago
Marius Gedminas 6d4618f46f Python 3: there's no dict.iteritems() 9 years ago
Marius Gedminas 0624797375 Bugfix: if you define a custom __eq__, you must define a __hash__ too
Also, on Python 3 the stock object.__hash__ raises an error ("unhashable
type"), and we have code that uses Host instances as dict keys.
9 years ago
Marius Gedminas a2bc6b4b26 Bugfix: if you define __eq__, you should define __ne__ too 9 years ago
Marius Gedminas 5d29a2eabd Python 3: shlex.split() wants unicode
On Python 2, shlex.split() raises if you pass it a unicode object with
non-ASCII characters in it.  The Ansible codebase copes by explicitly
converting the string using to_bytes() before passing it to
shlex.split().

On Python 3, shlex.split() raises ('bytes' object has no attribute 'read')
if you pass a bytes object.  Oops.

This commit introduces a new wrapper function, shlex_split, that
transparently performs the to_bytes/to_unicode conversions only on
Python 2.

Currently I've only converted one call site (the one that was causing a
unit test to fail on Python 3).  If this approach is deemed suitable,
I'll convert them all.
9 years ago
Toshio Kuratomi 5d3d9cfe0d Convert to byte strings to avoid UnicodeErrors
Fixes #12488
9 years ago
Brian Coca de18bcb95f correct typo on error reporting
fixes #12495
9 years ago
Brian Coca 6c3813ed37 added win_firewall_rule module 9 years ago
James Cammarata 65f5bed33e Merge pull request #12493 from amenonsen/ssh-fds
Fix typo in checking select results
9 years ago