Commit Graph

92 Commits (66a83314b9d30c6a139de960e6da8d5554c28544)

Author SHA1 Message Date
Brian Coca 38120c1075 termination handling
- moved to base cli class to handle centrally and duplicate less code
- now avoids duplication and reiteration of signal handler by reassigning it
- left note on how to do non-graceful in case we add in future
  as I won't remember everything i did here and don't want to 'relearn' it.
8 years ago
Brian Coca d9dcb2a427 Revert "centralized TERM signal handling"
This reverts commit 5a88478ccc.
is WIP, not ready for use yet
8 years ago
Brian Coca 5a88478ccc centralized TERM signal handling 8 years ago
Brian Coca 1b8dec9c88 avoid termination message when term is internal 8 years ago
Brian Coca 5a1887cc76 correctly handle term signals
- adhoc now terminates gracefully
- avoid race condition on terminations by ignoring errors if
  worker might have been reaped between checking if active and termination call
- ansible-playbook now properly exits on sigint/term
- adhoc and playbook now give exceptions that we should not normally capture
  and rely on top level finally to reap children
- handle systemexit breaks in workers
- added debug to see at which frame we exit
partial fix for #14346
8 years ago
Brian Coca ac1d1673be adhoc now respects limit when listing hosts
also removed cruft about localhost as if used it is specified inline
fixes #13848
9 years ago
Charles Paul 6680cc7052 allow custom callbacks with adhoc cli for scripting
missing import of CallbackBase
9 years ago
Brian Coca 04d74fd680 reenabled --tree for ansible adhoc command
previous fix to avoid callbacks now conflicted with tree optoin
which is implemented as a callback in 2.0
9 years ago
Brian Coca 7936a4687e adhoc avoids callbacks by default as it did before
Previous emptying of whitelist only affected callbacks that were
constructed for need whitelist. This now works for all callbacks.
9 years ago
Brian Coca 9ae1dede03 adhoc does not load plugins by default
reimplemented feature from 1.x which kept additional callbacks from
poluting adhoc unless specifically asked for through configuration.
9 years ago
Toshio Kuratomi 4d637e5780 Use self.args when we parse arguments that way the arguments can be constructed manually 9 years ago
Toshio Kuratomi 62979efa14 Finish up plugin porting to global display
Also remove display = display which does nothing
9 years ago
Toshio Kuratomi 318bfbb207 Migrate cli and dependencies to use global display 9 years ago
Toshio Kuratomi 4203850d1a Break apart a looped dependency to show a warning when parsing playbooks
Display a warning when a dict key is overwritten by pyyaml
Fixes #12888
9 years ago
Brian Coca 368f4448dc simplified vault password functions
also fixes #12864
9 years ago
James Cammarata 3eea4e23d5 Manually add plugin directories when running the adhoc command
Fixes #12891
9 years ago
Toshio Kuratomi f34b55ac2b Add python3-compat boilerplate to all .py files in lib/ansible 9 years ago
James Cammarata c860775b5d Another fix for --limit in adhoc 9 years ago
James Cammarata babf47decb Clean up some bugs related to --limit on adhoc commands 9 years ago
James Cammarata e8e1d9f6fb Apply --limit to inventory in adhoc commands
Fixes #12473
9 years ago
James Cammarata ff9f5d7dc8 Starting to add additional unit tests for VariableManager
Required some rewiring in inventory code to make sure we're using
the DataLoader class for some data file operations, which makes mocking
them much easier.

Also identified two corner cases not currently handled by the code, related
to inventory variable sources and which one "wins". Also noticed we weren't
properly merging variables from multiple group/host_var file locations
(inventory directory vs. playbook directory locations) so fixed as well.
9 years ago
Brian Coca 154754ae50 pushed module_loader to task_queue_manager so all cli's can benefit from it
also normalized -M option across all cli
fixes #12016
9 years ago
Brian Coca 17b4b1f85c added ability to limit in ansilbe pull
refactored the options a bit, new inventory_opts made sense to always group
fixes #7917
9 years ago
Brian Coca 6058eaa92f removed unused poller 9 years ago
Brian Coca 9b61cf5840 implemented async tasks in adhoc v2 9 years ago
Brian Coca 4d853a5d3c implemented for v2, missing --tree option for adhoc 9 years ago
Abhijit Menon-Sen 8de70fa657 Disallow --forks 0
Without at least one worker process, things break:

Traceback (most recent call last):
  File "/home/ams/extern/ansible/ansible/lib/ansible/executor/process/result.py", line 103, in run
    result = self._read_worker_result()
  File "/home/ams/extern/ansible/ansible/lib/ansible/executor/process/result.py", line 69, in _read_worker_result
    (worker_prc, main_q, rslt_q) = self._workers[self._cur_worker]
IndexError: list index out of range
9 years ago
Brian Coca ced93d35ca adjusted list hosts across adhoc and playbook cli 9 years ago
Abhijit Menon-Sen 65d62090c2 A better error message for «ansible playbook.yml»
This is a very conservative change: we add the hint only if we're
definitely going to die already.
9 years ago
James Cammarata b8b206005c Generalize extra variable parsing and loading
Fixes #11352
9 years ago
Brian Coca 8ad52c2e4f readded oneline output feature to adhoc
fixes #11573
9 years ago
Brian Coca fe91f7b506 moved read_vault_file to CLI from utils and renamed to clearer read_vault_password_file 9 years ago
Brian Coca 51efd765be Merge pull request #11415 from msabramo/remove_unnecessary_imports
Remove unnecessary imports
9 years ago
Marc Abramowitz 0676157897 Remove unnecessary imports 9 years ago
Brian Coca 5f791329ce now verbose mode shows config file used 9 years ago
Matt Martz 1d55e193c1 Expose the TaskQueueManager to self 9 years ago
Matt Martz 670894e2bd Move building the play_ds into a method, that can be overridden 9 years ago
Brian Coca 24b7c353cc readjusted limit opts, makes no sense in adhoc when you already specify selection
changed pull to reflect this
9 years ago
Brian Coca 5aec5e5eb0 fixed ansible pull, reorged validate function for cli to be function specific like parser
added missing cmd_functions with run_cmd, mostly for ansible pull
9 years ago
Brian Coca b85ce38834 slight changes to error handling to align with v1 9 years ago
James Cammarata 8db21f99b7 Set the inventory on the variable manager for the adhoc cli usage (v2) 9 years ago
James Cammarata ce3ef7f4c1 Making the switch to v2 9 years ago