Commit Graph

210 Commits (ab701726515611c03618f1376d1feaf806b06036)

Author SHA1 Message Date
Brian Coca 7f1e6ca005 updated docs to reflect new feature 2016-12-08 11:24:45 -05:00
Brian Coca d579dab0a0 deprecated accelerate 2016-12-08 11:24:45 -05:00
Brian Coca 498dc61154 documenting behaviour as clear as possible 2016-12-08 11:24:44 -05:00
James Cammarata 2aad8bd882 Removing erroneous import from async_status 2016-12-08 11:24:42 -05:00
James Cammarata 204e83aeed Ensure async wrapper and status return consistent fields 2016-12-08 11:24:42 -05:00
Brian Coca b55fd5f67a updated set_fact docs with note about typing 2016-12-08 11:24:41 -05:00
Brian Coca c59510aaf4 updated docs in pause to reflect 0 value behaviour 2016-12-08 11:24:40 -05:00
David Shrewsbury 88122e0f72 Use os.rename() in async_wrapper
Because the async_status module will read from the same file that
the async_wrapper module is writing, it's possible that the file
may not be fully synced during a read, causing spurious failures.
Use a temp file to do an atomic operation on the file. We can't
use atomic_move() here as that doesn't work properly under async.

Also, let's not read concurrently from the same file the subprocess
is writing to. Instead, capture stdout/stderr via PIPE and write to
the file to avoid nasty races.
2016-12-08 11:24:40 -05:00
Stanislav Antic 4c92652e7b Fix wait_for on python < 2.6 (#3790) (#3973) 2016-12-08 11:24:38 -05:00
Brian Coca f595b27e47 reverted need for module utils imports 2016-12-08 11:24:38 -05:00
Brian Coca 0c82db9cda added missing import
readded raise
2016-12-08 11:24:38 -05:00
Brian Coca 51c3eda259 exception ans sys.exit fixes 2016-12-08 11:24:38 -05:00
Toshio Kuratomi 1b88df0bda Fix exception handling in async_wrapper 2016-12-08 11:24:38 -05:00
Brano Zarnovican 9fd52ac40e Py2.4: SystemExit in async_wrapper is not an error - compatibility fix
Prior to Python 2.5, SystemExit was a subclass of Exception.
In Py2.4, this is causing extra error output on valid sys.exit(0).

(Toshio) Call sys.exit from inside of the SystemExit exception handler so py2.4 and py2.5+ behaviour matches
2016-12-08 11:24:37 -05:00
@ c901b70a01 Fixing compile time errors irt (, e => as e, print(), ocat now 0o not 0) exception handling for Python 3 (#3851)
* Fixing compile time errors irt a) exception handling for Python 3 in util, also: b) problem octal usage (fixed) and c) print json_dump -> print(json_dump(xyz) ... et al

* This code was not Python 2.4 compliant. Octal codes and exception handling is now working with Py 2.4, 2.6, & 3.5.

* Fixing formating (or rather reverting an non 2.4 compatible change). Works in compile & runtime checking.

* a) revert to use print sys.stderr not fail_json; b) fixed var name in exception

* Python 3 compatible print (print >>sys.stderr will generate a TypeError - now uses sys.stderr.write instead).
2016-12-08 11:24:37 -05:00
Dag Wieers 6bcf88ef54 Adapt module to use new module._name property (#3918)
This is in line with the change from ansible/ansible#16087
2016-12-08 11:24:36 -05:00
Mike Mars eb4813f1ca a) fail_json uses kwargs, b) outside the fork, log instead of returning json on stdout. 2016-12-08 11:24:35 -05:00
Mike Mars 1426a99cc0 data type fix on format string 2016-12-08 11:24:35 -05:00
Mike Mars a406ec30df corrected the string formatting (format isn't in 2.4 and even in some later versions of python 2.x requires an index). Tested for both compile ***& runtime exceptions*** against 2.4, 2.6, and 3.5. 2016-12-08 11:24:35 -05:00
Mike Mars 097f57d327 Missed umask octal conversion. 2016-12-08 11:24:35 -05:00
Mike Mars f592e92177 Corrected string of text... 2016-12-08 11:24:35 -05:00
Mike Mars 7af767f435 1) Modified error handling to work with Python 2.4. 2) Fixed octal codes to fall in line with the ansible guide, "Porting Modules to Python 3" 3) updated the requirements. All changes have been verified against Python 2.4, 2.6, & 3.5. 2016-12-08 11:24:35 -05:00
Mike Mars b30f6e02f6 Fixing compile time errors irt exception handling for Python 3. This particular diff fixes problems with Exception handling and the use/misues IRT Python 3 of octal numbers (InvalidToken exceptions). 2016-12-08 11:24:35 -05:00
Michael Scherer fefc0cdd50 Fix wait_for to compile on python3 (#3722) 2016-12-08 11:24:30 -05:00
Michael Scherer 73a33c02a9 Do not use a tuple as argument for _create_connection (#3655) 2016-12-08 11:24:28 -05:00
vaupelt ae464c5b5e exclude_hosts does not work as expected with state=drained
There are established connections for a service. The service is bound to a ipv4-mapped ipv6 address. Wait_for wrongly waits for clients listed in exclude_hosts.
2016-12-08 11:24:20 -05:00
Toshio Kuratomi 708d49777d Allow async to not need an args file since new-style modules have args embedded 2016-12-08 11:24:15 -05:00
Geoff Wright 7b93cd7db2 Fixes: #3232. Use of datetime consistent with module_utils/basic.py 2016-12-08 11:24:12 -05:00
nitzmahone 3abdfb1712 mark failed async_status as finished
Running async_status in an "until: result.finished" loop will mask a module failure (eg, traceback) with a
template failure, because the fail dict doesn't include "finished" (eg, you'll see "ERROR! The conditional check 'bogus_out.finished' failed. The error was: ERROR! error while evaluating conditional: bogus_out.finished ({% if bogus_out.finished %} True {% else %} False {% endif %}"). Because the failure dict still includes "failed: true",
this change has no effect on stoppage/failure reporting, it just prevents the common usage pattern from masking the underlying error message.
2016-12-08 11:24:09 -05:00
Toshio Kuratomi 47e9a06784 Specify types in argument_spec instead of code so that checking type vs default value does not trigger 2016-12-08 11:24:08 -05:00
Brian Coca 453d267489 documented new verbosity option 2016-12-08 11:24:06 -05:00
Toshio Kuratomi 65a96f5a5d Re-add version_added to fireball docs 2016-12-08 11:24:03 -05:00
Toshio Kuratomi 288b26a732 Fireball was removed in 2.0 (action plugin is gone).
This commit removes the helper module that wouldn't work without the
action module and tells users what to use instead.
2016-12-08 11:24:03 -05:00
Brian Coca e1d0f3ff59 clarified set_fact function 2016-12-08 11:23:48 -05:00
Lars Larsson 542eb2e09c total_seconds not present on timedelta on python2.6 2016-12-08 11:23:47 -05:00
Brian Coca c8a7c25468 code cleanup and reoorg, renamed vars and functions to actual purpose reneabled logging of steps 2016-12-08 11:23:44 -05:00
Toshio Kuratomi fda9eeaa89 Use select in wait_for so that we don't get stuck in cornercases:
* reading from a socket that gave some data we weren't looking for and
  then closed.
* read from a socket that stays open and never sends data.
* reading from a socket that sends data but not the data we're looking
  for.

Fixes #2051
2016-12-08 11:23:44 -05:00
Evan Carter 956fe4c709 add documentation stating that JSON files can be loaded with include_vars 2016-12-08 11:23:43 -05:00
James Cammarata 395253c581 A few bug fixes and tweaks for the accelerate module 2016-12-08 11:23:38 -05:00
Toshio Kuratomi e7d9d86ec9 No longer check for tmp_path being sent as we don't use it here anyway 2016-12-08 11:23:37 -05:00
Mike Putnam 9623cd570c Add missing GPLv3 License header
Fixes #1643
2016-12-08 11:23:25 -05:00
Andrey Trubachev b93633d7c2 Fix python-2.4 compatibility 2016-12-08 11:23:25 -05:00
Andrey Trubachev c55187ff42 Fix 'wait_for' doesn't work with ipv6only host 2016-12-08 11:23:25 -05:00
Greg DeKoenigsberg eb881d7d5d Proper author info for all remaining modules 2016-12-08 11:23:07 -05:00
Brian Coca 7ccc2143fd sleep when only doing a time delay to avoid cpu churn 2016-12-08 11:23:01 -05:00
Brian Coca 18e16a16b7 fixed try/except/finally to be 2.4 compatible 2016-12-08 11:22:59 -05:00
Toshio Kuratomi 5336217649 Several cleanups to many modules:
* Fix docs to specify when python2.6+ is required (due to a library
  dep).  This helps us know when it is okay to use python2.6+ syntax in
  the file.
* remove BabyJson returns.  See #1211  This commit fixes all but the
  openstack modules.
* Use if __name__ == '__main__' to only run the main part of the module
  if the module is run as a program.  This allows for the potential to
  unittest the code later.
2016-12-08 11:22:58 -05:00
Nathaniel 935550d20d Update set_fact.py
Context: I recently discovered that when setting a fact, key=value pairs and complex arguments differ in how the fact is stored. For example, when attempting to use complex arguments using key=values, the result can be stored as a unicode string as opposed to an object/list/etc.

I'm hoping the above example update will better demonstrate to and instruct people to use complex arguments instead of key=value pairs in certain situations.
2016-12-08 11:22:58 -05:00
Brian Coca 00a327bdaa added docs to show wait_for default timeout settings
Fixes #400
2016-12-08 11:22:54 -05:00
Gerard Lynch 1fcc1a7374 wait_for: updated docs, must be resolvable hostname, updated example 2016-12-08 11:22:45 -05:00
Brian Coca 8f197aed48 added missing docs on connection_timeout for wait_for 2016-12-08 11:22:44 -05:00
Brian Coca ba040784b8 let implied type do the spliting 2016-12-08 11:22:25 -05:00
Brian Coca 7d577e4447 minor fixes to wait_for to avoid tracebacks as per ansible core issue #9244 2016-12-08 11:22:25 -05:00
Brian Coca a091d8c59a added missing init.py for utilities modules 2016-12-08 11:22:25 -05:00
Michael DeHaan d31ac79269 Move internal category to utilities to remove one more category from the left hand menu, keeping it concise. 2016-12-08 11:22:25 -05:00
Michael DeHaan 677ed39cb4 Renames. 2016-12-08 11:22:25 -05:00
Ashish Ranjan 57ce7b1ea1 fields in /proc/net/tcp* are not always delimited by single space 2016-12-08 11:22:24 -05:00
Michael DeHaan ef2a2b9093 package files 2016-12-08 11:22:22 -05:00
Michael DeHaan 213e518165 file extensions! 2016-12-08 11:22:22 -05:00
Michael DeHaan c7eec45b73 Restructuring. 2016-12-08 11:22:22 -05:00