Commit Graph

54 Commits (2e0bec293ce8b828823cb2a655cd8f55895ea31a)

Author SHA1 Message Date
Matt Davis f497d771c8 win_shell/win_command changes + tests (#17557) 2016-09-15 11:25:56 -07:00
Toshio Kuratomi 4ed88512e4 Move uses of to_bytes, to_text, to_native to use the module_utils version (#17423)
We couldn't copy to_unicode, to_bytes, to_str into module_utils because
of licensing.  So once created it we had two sets of functions that did
the same things but had different implementations.  To remedy that, this
change removes the ansible.utils.unicode versions of those functions.
2016-09-06 22:54:17 -07:00
Brian Coca ff34f5548d Dynamic role include (#17401)
* dynamic role_include

* more fixes for dynamic include roles

* set play yfrom iterator when dynamic

* changes from jimi-c

* avoid modules that break ad hoc

TODO: should really be a config
2016-09-05 20:07:58 -04:00
Brian Coca 85f4c95843 minor optimization 2016-06-03 09:56:56 -04:00
Michael Scherer f07d6b26a7 Show a better error message when there is too much arguments (#16119)
If someone run:

  ansible all -m file state=present

The error message is "Missing target hosts" which is misleading, since
the target hosts is here, the problem is the missing '-a'.
2016-06-03 09:53:41 -04:00
Brian Coca 4c3c294a03 fixed confusing reporting when no hosts are matched
it was hitting 'empty inventory' warning.
2016-05-31 12:16:06 -04:00
Brian Coca 5940d3d45b fixes to vault/copy
rm _del_ as it might leak memory
renamed to tmp file cleanup
added exception handling when traversing file list, even if one fails try rest
added cleanup to finally to ensure removal in most cases
2016-04-14 14:12:48 -04:00
Strahinja Kustudić eed6cf5dad Adds 'ansible_check_mode' boolean magic variable
* Makes it possible to pass any options variable to VariableManager
  by changing `load_options_vars(options)` in `lib/ansible/utils/vars.py`
2016-04-08 00:26:02 +02:00
Toshio Kuratomi 228ad3ca39 Should be errors=strict since we don't want to end up matching hosts like '???' 2016-03-24 09:25:37 -07:00
Toshio Kuratomi 13b295f1ee Fix using non-ascii for inventory hostname patterns with the CLI. 2016-03-24 09:22:35 -07:00
James Cammarata ae21d98955 Properly use check_raw when using parse_kv in cli/ code
Fixes ansible-modules-core#3070
2016-03-21 11:00:44 -04:00
James Cammarata 771f1e31a9 Rework the way ad-hoc filters inventory to match how cli/playbook does it 2016-02-25 12:36:44 -05:00
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.
2016-02-10 15:35:30 -05:00
Brian Coca d9dcb2a427 Revert "centralized TERM signal handling"
This reverts commit 5a88478ccc.
is WIP, not ready for use yet
2016-02-10 09:48:42 -05:00
Brian Coca 5a88478ccc centralized TERM signal handling 2016-02-09 18:21:33 -05:00
Brian Coca 1b8dec9c88 avoid termination message when term is internal 2016-02-09 18:10:36 -05:00
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
2016-02-08 09:51:16 -05:00
Brian Coca ac1d1673be adhoc now respects limit when listing hosts
also removed cruft about localhost as if used it is specified inline
fixes #13848
2016-01-25 17:39:01 -05:00
Charles Paul 6680cc7052 allow custom callbacks with adhoc cli for scripting
missing import of CallbackBase
2015-12-10 09:49:54 -05:00
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
2015-12-09 10:13:50 -08:00
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.
2015-12-09 10:01:21 -08:00
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.
2015-12-08 06:37:57 -08:00
Toshio Kuratomi 4d637e5780 Use self.args when we parse arguments that way the arguments can be constructed manually 2015-12-06 22:17:47 -08:00
Toshio Kuratomi 62979efa14 Finish up plugin porting to global display
Also remove display = display which does nothing
2015-11-11 10:44:23 -08:00
Toshio Kuratomi 318bfbb207 Migrate cli and dependencies to use global display 2015-11-11 10:44:22 -08:00
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
2015-10-27 12:39:42 -07:00
Brian Coca 368f4448dc simplified vault password functions
also fixes #12864
2015-10-24 15:06:43 -04:00
James Cammarata 3eea4e23d5 Manually add plugin directories when running the adhoc command
Fixes #12891
2015-10-23 16:33:51 -04:00
Toshio Kuratomi f34b55ac2b Add python3-compat boilerplate to all .py files in lib/ansible 2015-10-19 18:36:19 -07:00
James Cammarata c860775b5d Another fix for --limit in adhoc 2015-09-28 10:39:33 -04:00
James Cammarata babf47decb Clean up some bugs related to --limit on adhoc commands 2015-09-28 09:02:24 -04:00
James Cammarata e8e1d9f6fb Apply --limit to inventory in adhoc commands
Fixes #12473
2015-09-23 08:28:38 -04:00
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.
2015-09-04 16:41:38 -04:00
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
2015-08-25 18:14:03 -04:00
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
2015-08-18 03:17:58 -04:00
Brian Coca 6058eaa92f removed unused poller 2015-08-16 20:12:06 -04:00
Brian Coca 9b61cf5840 implemented async tasks in adhoc v2 2015-08-16 20:05:10 -04:00
Brian Coca 4d853a5d3c implemented for v2, missing --tree option for adhoc 2015-08-11 19:18:10 -04:00
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
2015-08-02 14:10:45 +05:30
Brian Coca ced93d35ca adjusted list hosts across adhoc and playbook cli 2015-07-29 15:46:13 -04:00
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.
2015-07-27 12:43:21 +05:30
James Cammarata b8b206005c Generalize extra variable parsing and loading
Fixes #11352
2015-07-21 00:18:35 -04:00
Brian Coca 8ad52c2e4f readded oneline output feature to adhoc
fixes #11573
2015-07-13 15:43:31 -04:00
Brian Coca fe91f7b506 moved read_vault_file to CLI from utils and renamed to clearer read_vault_password_file 2015-07-11 14:24:45 -04:00
Brian Coca 51efd765be Merge pull request #11415 from msabramo/remove_unnecessary_imports
Remove unnecessary imports
2015-07-05 01:09:28 -04:00
Marc Abramowitz 0676157897 Remove unnecessary imports 2015-07-04 17:41:36 -07:00
Brian Coca 5f791329ce now verbose mode shows config file used 2015-07-04 10:23:49 -04:00
Matt Martz 1d55e193c1 Expose the TaskQueueManager to self 2015-06-15 13:50:40 -05:00
Matt Martz 670894e2bd Move building the play_ds into a method, that can be overridden 2015-06-15 10:35:26 -05:00
Brian Coca 24b7c353cc readjusted limit opts, makes no sense in adhoc when you already specify selection
changed pull to reflect this
2015-06-09 17:35:19 -04:00