Commit Graph

428 Commits (f4bd38a153694665686ecbe73995548e1594c15b)

Author SHA1 Message Date
Brian Coca 87fe32319f ensure stdout callback alwasy is loaded first
it is now called for every event prior to any other callbacks
fixes #14114
2016-01-25 17:11:36 -05:00
James Cammarata fb797a9e77 Fixing role dependency chain creation
The dep chain for roles created during the compile step had bugs, in
which the dep chain was overwriten and the original tasks in the role
were not assigned a dep chain. This lead to problems in determining
whether roles had already run when in a "diamond" structure, and in
some cases roles were not correctly getting variables from parents.

Fixes #14046
2016-01-22 12:54:00 -05:00
James Cammarata 1f7492171e Don't clear start at task flag until all hosts are advanced
Clearing the flag after the first host was advanced caused all other
hosts to not advance at all.

Fixes #13864
2016-01-18 22:56:10 -05:00
James Cammarata 1733d434d1 Fix with loop + delegate issues
* Don't re-use the existing connection if the remote_addr field of
  the play context has changed
* When overriding variables in PlayContext (from task/variables),
  don't set the same attribute based on a different variable name
  if we had already previously set it from another variable name

Fixes #13880
2016-01-18 17:35:00 -05:00
James Cammarata c42484a029 Minor cleanup when reassigning play context to reused connections
* Relocate the assignment of the host address to the remote_addr field
  in the play context, which was only done when the connection was created
  (it's now done after the post_validate() is called on the play context)
* Make the assignment of the play context to the connection an else, since
  it's not required if the connection is not reused
2016-01-18 13:36:40 -05:00
James Cammarata bc1bcc3419 Merge branch 'patch-1' of https://github.com/ktaragorn/ansible into ktaragorn-patch-1 2016-01-18 13:12:01 -05:00
James Cammarata 1825b4a9c7 Fix any_errors_fatal incorrect implementation in 2.0
Also adds that flag to blocks.

Fixes #13744
2016-01-15 13:15:10 -05:00
James Cammarata abc82fee13 Fix typo in 0b86aa6 2016-01-14 11:57:12 -05:00
James Cammarata 0b86aa62e1 Hack to work around callback API change for v2_playbook_on_start 2016-01-14 11:54:44 -05:00
Toshio Kuratomi 8068f23bad do_encrypt import needed to move as well
Fixes #13861
2016-01-13 13:08:33 -08:00
Brian Coca a196c7d737 only send event if tqm exists
fixes #13843
2016-01-13 10:18:36 -05:00
James Cammarata 6ec4d98764 When setting fail state skip RESCUE/ALWAYS if cur_block doesn't have them
Fixes #13749
2016-01-11 12:51:04 -05:00
Karthik T c4cbeeffa8 Fixes #13763 Update connections _play_context on every iteration
If this isnt updated, the _connection is reused, and thus has an outdated _play_context
This results in outdated `success_key` and `prompt` causing issues if sudo is run in a loop
Refer to the issue #13763 for more debugging and details
2016-01-11 16:30:52 +08:00
Brian Coca 1cc5ac06e7 restructure vars_prompt and fix regression
pushed it to use the existing propmpt from display and moved the vars prompt code there also for uniformity
changed vars_prompt to check extra vars vs the empty play.vars to restore 1.9 behaviour
sipmlified the code as it didn't need to check for syntax again (tqm is made none prior based on that)
fixes #13770
2016-01-08 11:46:04 -05:00
Brian Coca 737090dd13 now show full callback stacktrace when vvv+
Still is a warning as we don't want to repeat it multiple times nor additional callbacks to stop ansible execution.
hopefully we can avoid shipping w/o exceptions in the default/minimal callbacks...

Also added feature that now allows for 'preformated' strings passed to warning
2016-01-08 10:42:12 -05:00
Brian Coca 095790ac5c Merge pull request #13691 from bcoca/colors
output color is now configurable
2016-01-05 14:33:01 -05:00
James Cammarata 210cf06d9a Tweak how strategies evaluate failed hosts via the iterator and bug fixes
* Added additional methods to the iterator code to assess host failures
  while also taking into account the block rescue/always states
* Fixed bugs in the free strategy, where results were not always being
  processed after being collected
* Added some prettier printing to the state output from iterator

Fixes #13699
2016-01-02 01:00:12 -05:00
Brian Coca d3deb24ead output color is now configurable 2015-12-29 17:40:47 -05:00
James Cammarata 6ae04c1e4f Fix logic in PlayIterator when inserting tasks during rescue/always
Because the fail_state is potentially non-zero in these block sections,
the prior logic led to included tasks not being inserted at all.

Related issue: #13605
2015-12-20 12:39:08 -05:00
James Cammarata 3ec0104128 Fixing bugs in conditional testing with until and some integration runner tweaks 2015-12-19 21:14:48 -05:00
James Cammarata a3dcb910b8 Fixing bugs with {changed,failed}_when and until with registered vars
* Saving of the registered variable was occuring after the tests for
  changed/failed_when.
* Each of the above fields and until were being post_validated too early,
  so variables which were not defined at that time were causing task
  failures.

Fixes #13591
2015-12-18 10:58:55 -05:00
James Cammarata e546219426 Revert "Enable host_key checking at the strategy level"
This reverts commit 1a6d660d7e285cceec474952a33af4d8dffd0a8d.
2015-12-17 12:43:47 -05:00
James Cammarata e5c2c03dea Enable host_key checking at the strategy level
Implements a new method in the ssh connection plugin (fetch_and_store_key)
which is used to prefetch the key using ssh-keyscan.
2015-12-16 21:41:07 -05:00
James Cammarata 6312e38133 Fixing up some non-py3 things for unit tests 2015-12-14 10:35:58 -05:00
James Cammarata 120b9a7ac6 Changing the way workers are forked 2015-12-11 23:35:07 -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
Toshio Kuratomi 0434644d12 Transform exceptions into ansible messages via to_unicode instead of str to avoid tracebacks.
Fixes #13385
2015-12-04 11:50:39 -08:00
James Cammarata a183972477 Don't use play vars in HostVars
Fixes #13398
2015-12-02 14:16:47 -05:00
Matt Martz 384b2e0234 Get v2_playbook_on_start working
* Move self._tqm.load_callbacks() earlier to ensure that v2_on_playbook_start can fire
* Pass the playbook instance to v2_on_playbook_start
* Add a _file_name instance attribute to the playbook
2015-12-02 11:29:51 -06:00
James Cammarata f7dc5a9515 Minor tweak and comment addition to 974a0ce3 2015-12-02 09:11:08 -05:00
Christoph Dittmann 9a6ae1d62a Let PlayIterator.add_tasks accept empty task lists
PlayIterator.add_tasks raised an error when trying to add an empty task
list.  This was the root cause of ansible issue #13370.
2015-12-02 11:17:24 +01:00
James Cammarata 80db6bacc4 Make sure run_once tasks properly set variables for all active hosts
Fixes #13267
2015-11-30 11:27:05 -05:00
James Cammarata dfa576b037 Merge pull request #13307 from Yannig/devel_fix_big_include_vars
Fix for https://github.com/ansible/ansible/issues/13221
2015-11-29 23:14:03 -05:00
James Cammarata 6671d78f95 Tweak location of stats callback execution and properly relocate stats output code 2015-11-28 14:03:21 -05:00
James Cammarata 800811a15f Trigger on_stats just once, not once for each play
Fixes #13271
2015-11-28 13:37:43 -05:00
Yannig Perré 5227c6bb52 Do not copy variable_manager each time. Instead, keep host and local variable_manager sync.
Fix https://github.com/ansible/ansible/issues/13221
2015-11-28 14:58:33 +01:00
Brian Coca fa358d9d61 avoids prompting for vars during syntax check
fixes #13319
2015-11-27 11:41:00 -08:00
James Cammarata 65747285a4 Properly check for prompting state when re-using ssh connection
Fixes #13278
2015-11-24 09:09:54 -05:00
Chris Church 272778f732 Modify task executor to reuse connection inside a loop. Fix WinRM connection to set _connected properly and display when remote shell is opened/closed. Add integration test using raw + with_items. 2015-11-23 11:53:05 -05:00
Brian Coca 478c6c756a marked spot that should send per item reulsts 2015-11-22 14:44:51 -08:00
James Cammarata 78e4f176e6 Return skipped/failed async results directly
Fixes #13205
2015-11-19 08:30:00 -05:00
Marius Gedminas 66347c9449 Fix NameError when using loops
vars_copy disappeared in 3d1255d190.

Fixes #13213.
2015-11-19 09:21:06 +02:00
James Cammarata 3d1255d190 Don't update job vars too early when getting loop items in TaskExecutor
Fixes #13113
2015-11-18 19:12:38 -05:00
James Cammarata 25807f5404 Don't modify things we've put on the queue
Fixes #12937
2015-11-17 14:22:52 -05:00
James Cammarata 9f31c073fe Fixing a few bugs in the HostVars performance areas
* Also refresh inventory in the HostVars manager process when things
  are changed via add_host/group_by
* Raise j2undefined rather than return it
2015-11-17 09:15:10 -05:00
James Cammarata 5cbeab5a3c Performance improvements for HostVars and some bugfixes 2015-11-16 17:15:52 -05:00
Dann Bohn 7f2cae5405 add REPLACER_SELINUX back into module_common 2015-11-16 16:35:55 -05:00
James Cammarata 2b25b7974c Remove unnecessary sleep from result process 2015-11-13 16:45:45 -05:00
James Cammarata 13750f68ee Reduce spinning while waiting on queues 2015-11-12 14:41:09 -05:00
James Cammarata b2b0fa8d13 Changed do/until failed color
Fixes #13130
2015-11-11 14:43:15 -05:00
James Cammarata 94c20c9ac6 Cleanup failed/changed logic in TaskExecutor
Fixes #12980
2015-11-11 14:23:37 -05: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 186e034515 Move the rest of executor code to global display 2015-11-11 10:44:22 -08:00
Toshio Kuratomi 318bfbb207 Migrate cli and dependencies to use global display 2015-11-11 10:44:22 -08:00
Toshio Kuratomi e45ce871a7 Fix for traceback when neither name nor pkg are in the module params 2015-11-11 07:32:21 -08:00
Toshio Kuratomi 4737305837 Remove dead code as this was moved to another class 2015-11-10 12:18:20 -08:00
James Cammarata a99f2fd52f Save delegated vars in result for use in callback methods
Fixes #13014
2015-11-10 10:14:30 -05:00
Yannig Perré 0c360d17cb New parameter for template method.
We do not compute hash when we know that the result does not need to be cached (like with_items loop).
It also result in a small speed improvement.
2015-11-10 07:19:19 +01:00
Toshio Kuratomi 1a04f354f3 For with_first_found loops, set undefined variables to fall through rather than failing the task 2015-11-09 10:51:54 -08:00
James Cammarata 59b67a2f68 Reset workers list when recreating processes
Also renames some things to be more accurate
2015-11-06 12:10:15 -05:00
Brian Coca 9c24f88eca updated forks comment 2015-11-06 08:31:56 -05:00
James Cammarata 1027abd596 Cleaning up bugs related to perf improvement changes 2015-11-05 16:42:12 -05:00
James Cammarata efbc6054a4 Add variable compression option 2015-11-05 16:22:37 -05:00
James Cammarata 63c47fb271 Fixing up performance 2015-11-05 16:22:37 -05:00
Brian Coca f4912dd88a added callback fallback to v1 methods for backwards compat with existing callbacks 2015-11-05 13:04:50 -05:00
Brian Coca e2c56efca6 Merge pull request #12867 from bcoca/callback_whitelist_tweak
make callbacks declare needing whitelisting
2015-11-05 12:58:05 -05:00
Toshio Kuratomi 4f6d4c6bf6 Set task_action when the action does not need to be templated
Fixes #13042
2015-11-05 08:38:21 -08:00
Brian Coca 9753de35a7 Merge pull request #13038 from bcoca/min_forks_to_play
use minimal number of forks
2015-11-05 11:22:15 -05:00
Toshio Kuratomi 483491ddfb template the task_action before checking whether to optimize with_item loops for it.
Fixes the second problem discovered in #12976
2015-11-04 19:41:55 -08:00
Toshio Kuratomi 9e758d3d97 Do not optimize with_items loop if the items are not strings
The code isn't sophisticated enough to understand lists and dicts yet.
This mirrors how 1.9.x handled non-string items so its not a regression.

One portion of a fix for #12976
2015-11-04 18:48:41 -08:00
Brian Coca 931eb16e55 clearer selection of min value
cleanup workers at each run to avoid stragglers
2015-11-04 17:28:08 -05:00
Brian Coca b44f1428d0 use minimal number of forks taking serial, forks and play patterns into account 2015-11-04 15:16:20 -05:00
Brian Coca 3c35655b52 removed serial as it is not avialable for fork control
fixes #13037
2015-11-04 14:04:47 -05:00
Brian Coca 0abeff4511 better limiting of forks to lowest actual restriction 2015-11-04 12:47:10 -05:00
Lars Larsson 3289670a04 treat forks config parameter as max value instead of always creating that number of workers 2015-11-04 17:13:26 +01:00
Brian Coca f5b095f6c8 properly sanitize registered vars 2015-10-30 16:42:06 -04:00
Brian Coca b6c92dacb5 removed key striping as they are read up the chain 2015-10-30 14:03:37 -04:00
James Cammarata a5bd92ca4b Merge branch 'devel_fix_debug_var' of https://github.com/Yannig/ansible into Yannig-devel_fix_debug_var 2015-10-30 08:37:03 -04:00
James Cammarata 479cbfc63c Don't immediately fail on PlayContext setup
As we may end up skipping the task due to conditionals.

Fixes #12774
2015-10-29 19:23:42 -04:00
Yannig Perré 1febf7cb88 Fix for issue #12952: this code interfere with debug+var and seems to be unnecessary. 2015-10-28 22:09:13 +01:00
James Cammarata 5d92b00d9c Cleanup some include logic
* Properly mark hosts with failures in includes as failed
* Don't send callbacks until we're sure we're done, and also fix how
  we increment stats so failures don't show up as ok's
* Fix a bug in the include file logic where a failed include could lead
  to an infinite loop in the task iteration logic

Fixes #12933
2015-10-28 14:02:24 -04:00
James Cammarata 87269599a0 Also consider the full role name when searching for --start-at-task 2015-10-27 16:31:23 -04:00
Toshio Kuratomi 7334389de6 Merge pull request #12930 from ansible/dict-key-overwrite-warning
Break apart a looped dependency to show a warning when parsing playbooks
2015-10-27 12:44:01 -07: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
James Cammarata 3fc2209ca0 Fixing retry/until logic and default value for retries
Fixes #12928
Fixes #12929
2015-10-27 15:37:48 -04:00
Brian Coca 8ce864db6f sanatize results 2015-10-24 15:23:12 -04:00
Toshio Kuratomi 92dd563a75 Fix invocation from bad merge and note where it would need to go to keep
it out of registered vars as well.
2015-10-24 07:29:42 -07:00
Brian Coca 5017a96948 Revert "make callbacks declare needing whitelisting"
another premature merge
This reverts commit df8ff85787.
2015-10-22 16:34:51 -04:00
James Cammarata 86de1429e5 Cleaning up FIXMEs 2015-10-22 16:03:50 -04:00
Brian Coca df8ff85787 make callbacks declare needing whitelisting
this will allow for custom or v1 callbacks locally loaded to automatically be triggered as they were in 1.x
2015-10-22 12:30:23 -04:00
Brian Coca c267c23020 make callbacks declare needing whitelisting
this will allow for custom or v1 callbacks locally loaded to automatically be triggered as they were in 1.x
2015-10-22 08:27:32 -04:00
Brian Coca fc3a44485b skip errors on conditional if task is include
fixes #12843
2015-10-22 07:50:43 -04:00
James Cammarata ec56b29ba4 Fix setting of interpreter values for delegated hosts
Fixes #12772
2015-10-21 11:05:45 -04:00
Victor Salgado c5c5f3bf7a Revert back to copying self._task.args 2015-10-20 16:21:25 -02:00
Victor Salgado 0e671baa33 Fix typo 2015-10-20 16:18:01 -02:00
James Cammarata 1fa975d81a Simplify group_by by removing BYPASS_HOST_LOOP from the action
Fixes #12825
2015-10-19 14:57:07 -04:00
Toshio Kuratomi a526eae543 Clean up a few more pyflakes warnings 2015-10-19 11:20:21 -07:00
James Cammarata 892d9b8dfb Move post_validate for tasks after checking for an include
Simplifies logic and prevents us from accidentally post_validating
an include that would otherwise be skipped due to tags causing a
problem because of potentially missing variables.

Fixes #12793
2015-10-19 13:42:17 -04:00
James Cammarata a88c59f451 Reset basedir for plays that are not from a PlaybookInclude
Fixes #12524 (again)
2015-10-17 12:44:28 -04:00
Toshio Kuratomi baa309309d Bundle a new version of python-six for compatibility along with some code to make it easy for distributions to override the bunndled copy if they have a new enough version. 2015-10-16 08:21:28 -07:00
Marius Gedminas 4fb6f62f1b Fix Unexpected Exception: global name 'os' is not defined
I inadvertently introduced it in
ca826508d9 and didn't notice, because
there are no unit tests for playbook_executor.py.  Sorry!

(The "from ansible.errors import *" was used *only* to get the 'os'
module, which makes go "what?")
2015-10-15 10:41:00 +03:00
Marius Gedminas 9ba6c087d3 Python 3: there's no basestring 2015-10-13 09:56:12 +03:00
James Cammarata 82e76e42e5 Tweak to the way serial percentages are handled 2015-10-12 09:00:43 -04:00
Toshio Kuratomi 01ba2e94c0 Wait until later to convert to byte strings for output
Also some pre-emptive python3 compat and a code simplification
2015-10-08 08:22:17 -07:00
Brian Coca 76feba00c4 avoid callbacks during syntax check and listing
fixes #12682
2015-10-08 10:15:48 -04:00
James Cammarata d91b3c6b9d Make sure magic variables are available when templating vars_files
Also does some reorganization/cleanup on the magic vars/delegated
variable generation portions of VariableManager to make the above
possible.

Fixes #12633
2015-10-05 16:32:58 -04:00
Brian Coca e2ae3215f6 corrected no_log for items and skipped tasks
corrected output from default callback
added new tests for no_log loops
updated makefile test to check for both positive and negative occurrences of no_log
2015-10-02 14:35:33 -04:00
Brian Coca ba4afcbbb6 added no_log to results
normalized outputs to use display class
cleaned up unused imports
2015-10-02 09:11:41 -04:00
James Cammarata 8ef78b1cf8 Fixing accelerated connection plugin 2015-10-02 00:50:02 -04:00
James Cammarata deff045aa9 Fix bug caused by options not having start_at_task when used through adhoc
Fixes #12590
2015-10-01 10:09:58 -04:00
James Cammarata dcb8caf9e8 Remember if we already skipped tasks via --start-at-task
Fixes #12482
2015-09-30 14:12:38 -04:00
James Cammarata a3e913da62 Don't assume handlers exist in the same role (if any)
Fixes #12536
2015-09-29 14:52:43 -04:00
James Cammarata ffdba96668 Save the included directory for playbook includes for use as the basedir
Fixes #12524
2015-09-29 00:28:45 -04:00
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
2015-09-25 01:41:09 -04:00
Brian Coca de18bcb95f correct typo on error reporting
fixes #12495
2015-09-23 10:11:52 -04:00
Toshio Kuratomi 2a614c1c0f Close module file once we're done reading from it 2015-09-21 01:46:29 -07:00
James Cammarata 88e1aa94fa Add play context vars to list of variables before post validation
Fixes #12437
2015-09-19 21:51:24 -04:00
James Cammarata 1f5584aa5b Refactoring delegate_to code
Now, instead of relying on hostvars on the executor side, we compile
the vars for the delegated to host in a special internal variable and
have the PlayContext object look for things there when applying task/
var overrides, which is much cleaner and takes advantage of the code
already dealing with all of the magic variable variations.

Fixes #12127
Fixes #12079
2015-09-18 15:25:10 -04:00
James Cammarata fa69e8ebb8 Fixing some bugs in _compute_delegate() in TaskExecutor
* Clearing interpreter settings from variables, so those set for the
  original host aren't incorrectly applied to the delegated to host
* Fixed incorrect string for remote user in delegated hosts hostvars
* Properly looking for multiple possiblities in the delegated-to hosts
  hostvars (ansible_ssh_host vs. ansible_host)
2015-09-18 15:25:10 -04:00
James Cammarata cc6627cdd6 Remove custom json encoder cleaner and strip proxy var stuff out before encoding
Fixes #12349
2015-09-17 16:04:47 -04:00
James Cammarata bde5ed9672 Catch worker errors that may be subclassed on others that lead to incorrect exits 2015-09-17 14:46:53 -04:00
Abhijit Menon-Sen 575a8b8c77 Merge Host.ipv[46]_address into .address
The earlier distinction was never used; .ipv6_address was always a copy
of .ipv4_address, and the latter was always used to set the remote_addr
field in the PlayContext.

Also uses the canonical ansible_host/ansible_port names when setting the
address and port from variables.
2015-09-17 23:03:48 +05:30
James Cammarata a7e1113b26 Removing FIXME comment which is no longer required 2015-09-15 14:47:49 -04:00
James Cammarata 60c139e482 Fix logic for changed/failed_when + retry/until loops
Fixes #11809
2015-09-15 13:37:35 -04:00
James Cammarata 8e664ad226 Fix delegate_to localhost vs. 127.0.0.1 (and ::1) 2015-09-15 13:08:54 -04:00
James Cammarata 4156bcedf5 Fix typo in 049a48f 2015-09-11 15:54:24 -04:00
Abhijit Menon-Sen 049a48f3d3 Test state.tasks_child_state before dereferencing
I hit a traceback in the FAILED_TASKS case, but it seemed prudent to add
guards in the other similar branches.
2015-09-11 21:59:08 +05:30
Thomas Quinot 0bc9223826 Test for Python must be against basename of interpreter
Followup on issue #12076
2015-09-11 13:29:34 +02:00
James Cammarata 441a8af671 Merge pull request #12267 from h-hirokawa/add_replacer_jsonargs
Add the new module replacer <<INCLUDE_ANSIBLE_MODULE_JSON_ARGS>>.
2015-09-11 02:44:50 -04:00
James Cammarata 0c5bbe3c32 Use the original (un-templated) args for include params
Fixes #12314
2015-09-11 00:53:27 -04:00
James Cammarata aa3b290efd Fix indent on line in playbook executor 2015-09-09 18:10:38 -04:00
James Cammarata e81947c3b4 Fix vars_prompt short form support (and mark deprecated) 2015-09-09 17:52:44 -04:00
James Cammarata be7bd392cb Fix unreachable host detection and have plays continue after unreachable failures
Fixes #12284
2015-09-09 15:27:26 -04:00
Brian Coca 0dbebfddaa Revert "remove closing connections after every task, this goes against conneciton caching and was not expected behaviuor nor inhertited from v1"
needed for winrm, disabled closing connections in ssh to avoid issues with that persistance, need to normalize all this in future

This reverts commit 23a22397bf.
2015-09-09 14:21:56 -04:00
James Cammarata 926f127245 set_fact should put facts in the fact_cache, not vars_cache
Also fixes a template path lookup issue when using an include

Fixes #12277
2015-09-09 11:10:18 -04:00
James Cammarata 30399edada Use UnsafeProxy for lookup results too
Also fixes a couple of bugs that popped up when using the proxy class
2015-09-08 12:19:39 -04:00
h-hirokawa cd478a76fc Add the new module replacer <<INCLUDE_ANSIBLE_MODULE_JSON_ARGS>>.
Fixes #12266
2015-09-07 12:01:26 +09:00
Brian Coca 23a22397bf remove closing connections after every task, this goes against conneciton caching and was not expected behaviuor nor inhertited from v1 2015-09-04 10:11:25 -04:00
Marius Gedminas 37be9539ff Python 3: use six.text_type instead of unicode
Replace 'unicode' with six.text_type, everywhere but in module_utils.
2015-09-04 08:40:10 +03:00
James Cammarata 4ac2bafc4b Set hosts fact gathering flag based on fact cache entries
Fixes #12213
2015-09-03 14:11:19 -04:00
James Cammarata 8774ff5f57 Make sure PlayContext is copied when iterating in a with_ loop 2015-09-03 08:11:30 -04:00
James Cammarata c16961db60 Fix two PlayIterator bugs
* When iterating over a child state, a failure should be propagated
  up so parent blocks don't continue iterating
* Make sure a child state exists before trying to search it

Fixes #12210
2015-09-03 07:48:42 -04:00
Toshio Kuratomi 1ae28f606b Refactor to replace filter and lambda with a generator expression 2015-09-03 00:06:34 -07:00
Marius Gedminas 823677b490 Replace .iteritems() with six.iteritems()
Replace .iteritems() with six.iteritems() everywhere except in
module_utils (because there's no 'six' on the remote host).  And except
in lib/ansible/galaxy/data/metadata_template.j2, because I'm not sure
six is available there.
2015-09-03 09:23:27 +03:00
James Cammarata 9e1bc434c7 Further cleanup from locking changes 2015-09-03 01:07:29 -04:00
James Cammarata b93f27e260 Move the lockfile back to tqm to make sure it stays unique 2015-09-03 00:45:42 -04:00
James Cammarata 5adcd7054b Allow setup to run when using --start-at-task
Fixes #12147
2015-08-31 22:10:34 -04:00
James Cammarata 057712c129 Also move action/connection plugins to shared plugin loader code
Fixes #12099
2015-08-28 16:32:09 -04:00
James Cammarata 266a069a73 Merge pull request #12107 from TravisPaul/devel
Update "smart" transport to handle Sun_SSH_1.5 on SmartOS
2015-08-28 10:43:48 -04:00
Marius Gedminas 0c6ce31f76 Use 'except ... as' syntax
This syntax works on Python 2.6 through 3.x.  lib/ansible/module_utils
(and lib/ansible/modules) need to support Python 2.4, so I didn't touch
those.
2015-08-27 22:15:04 +03:00
James Cammarata 50448d68e1 Implement max_fail_percentage and any_errors_fatal support
Fixes #11997
2015-08-26 12:03:47 -04:00
Travis Paul 604f825a8e Update "smart" transport to handle Sun_SSH_1.5 on SmartOS 2015-08-26 15:00:45 +00:00
James Cammarata 601a1cc6d9 Multiple fixes for include statements and blocks in general
Fixes #11981
Fixes #11995
Fixes #12039
Fixes #12077
2015-08-26 02:23:22 -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
Toshio Kuratomi 1f7b0fee0a Fixes #12076 2015-08-24 19:07:04 -07:00
Toshio Kuratomi 6e107d2f22 Comments pointing the way towards substituting cryptography for pycrypto 2015-08-24 15:50:37 -07:00
Brian Coca a4ffa09414 Merge pull request #11880 from bcoca/configurable_squash
made squashable with_ plugin list configurable
2015-08-23 13:32:15 -04:00
Brian Coca e8b86f448d fix issue with improper connection override in delegation 2015-08-19 20:36:08 -04:00
Brian Coca 22a69e2498 fixes to delegation code 2015-08-19 15:49:37 -04:00
Brian Coca 2198f48f54 changed check to avoid OS X broken sem_getvalue()
fixes #11988
2015-08-18 03:46:20 -04:00
James Cammarata e7b2308b66 Performance improvements
* Speed up serialization of hostvars by simply using the internal
  dictionary used for cached lookups
* Use blocking gets/puts on queues instead of spin locking
* Merge sequential implicitly created blocks
2015-08-17 13:46:57 -04:00
Brian Coca ee2e31b37a now passes the test of skipping list when dict attribute is undefined, added deprecation warning as this seems like bad behaviour 2015-08-16 10:16:02 -04:00
Brian Coca 245e0dd4b7 made returns from next task consistent to avoid typeerrors, also linear now checks for none
fixes #11965
2015-08-14 18:07:14 -04:00
Brian Coca 6e825e8c22 fixed listify for lookups, made sure convert_bare is only on with_ 2015-08-11 16:42:09 -04:00
James Cammarata adb9d7e461 Track role execution per-host, not overall in the role
Fixes #11863
Fixes #11878
2015-08-11 16:34:58 -04:00
Brian Coca 7e7b546c34 reinstated listify 2015-08-10 17:38:20 -04:00
Brian Coca 3e5dbd045f fixed ref to removed var 2015-08-10 14:02:42 -04:00
Toshio Kuratomi d35b956900 listify lookup plugin terms when they're specified as "{{ lookup(terms) }}"
Before this, they were not listified there but they were listified when
specified like this:

with_lookup: terms
2015-08-10 09:07:37 -07:00
Brian Coca a555a0652e allow for vars_prompt and pause prompt to be skipped in non interactive settings
ansible-pull users rejoice
2015-08-06 19:20:45 -04:00
James Cammarata 5266679964 Use templar all the way down
Fixes bugs related to creating Templar() objects on the fly, where
the shared loader objects (serialized to TaskExecutor) aren't used
so information loaded into plugin loaders after forking is lost.

Fixes #11815
2015-08-04 12:25:53 -04:00
James Cammarata c2435fab7e Inject the play context vars into the variables used for loop item templating 2015-08-03 12:12:45 -04:00
James Cammarata 2673eb0afb Add option to fail on undefined variables to listify
And use it in the call to get the loop items for a task.
2015-08-03 12:04:31 -04:00
Abhijit Menon-Sen 2cb7cd8379 Remove outdated FIXME; _compute_delegate is called below 2015-08-01 09:35:32 +05:30
Chris Church e87cf4a3cc Fixes for WinRM/PowerShell support in v2.
- Add support for inserting module args into PowerShell modules.  Fixes #11661.
- Support Windows paths containing spaces.  Applies changes from #10727 to v2.  Fixes #9999.  Should also fix ansible/ansible-modules-core#944 and ansible/ansible-modules-core#1007.
- Change how execution policy is set for running remote scripts.  Applies changes from #11092 to v2.  Also fixes ansible/ansible-modules-core#1776.
- Use codepage 65001 (UTF-8) for WinRM connection instead of default (CP437), convert command to UTF-8 and results from UTF-8.  Replaces changes from #10024.  Fixes #11198.
- Close WinRM connection when task completes.
- Use win_stat, win_file and win_copy modules instead of stat, file and copy when called from within other action plugins (only when using WinRM+PowerShell).
- Unquote Windows path arguments before passing to win_stat, win_file, win_copy and slurp modules (only when using WinRM/PowerShell).
- Check for win_ping module to determine if core modules are missing (only when using WinRM/PowerShell).
- Add stdout_lines to result from running low level commands (so stdout_lines is available when using raw/script).
- Update copy action plugin to use shell functions for joining paths and checking for trailing slash.
- Update fetch action plugin to unquote source path when using Windows paths.
- Add win_copy and win_template action plugins that inherit from copy and template.
- Support running .bat and .cmd scripts using default system encoding instead of UTF-8.
- Always send PowerShell commands as base64-encoded blobs to allow for running simple PowerShell commands via raw.
- Support running modules on Windows with interpreters other than PowerShell.
- Update integration tests to support above changes and test unicode fixes.
- Add test for win_user error from ansible/ansible-modules-core#1241 (fixed by ansible/ansible-modules-core#1774).
- Add test for additional win_stat output values (implemented by ansible/ansible-modules-core#1473).
- Add test for OS architecture and name from setup.ps1 (implemented by ansible/ansible-modules-core#1100).

All WinRM integration tests pass for me with these changes.
2015-07-31 14:38:31 -04:00
Abhijit Menon-Sen 1541e331c9 Also fix UTF-8 handling in vars_prompt 2015-07-30 23:27:39 +05:30
Abhijit Menon-Sen ff2d160fff Correct invalid reference to global display 2015-07-30 22:52:47 +05:30
Abhijit Menon-Sen 10def3aa54 Uncomment encrypt handling for vars_prompt 2015-07-30 22:42:21 +05:30
Brian Coca 056602c424 rearranged --list- options, now they are consolidated when used toghether, less loops, more concise output
list-hosts works
list-tasks works, but needs better task naming (missing role info)
list-tags only shows play tags
2015-07-28 22:05:49 -04:00
James Cammarata 42cfacf83b Switch up the task/host overrides for PlayContext to use the compiled vars dict
Fixes #11436
2015-07-28 16:25:44 -04:00
James Cammarata 2d90cbf78b Properly fail results with rc != 0
Fixes #11769
2015-07-28 10:15:14 -04:00
James Cammarata cb262449c7 Reworking internal result flags and making sure include_vars hides vault data
Fixes #10194
2015-07-27 14:04:31 -04:00
Brian Coca 0858d97c44 also captures typeerrors for when not getting a proper string in output 2015-07-24 18:43:40 -04:00
James Cammarata eccfb7e0b5 Adding initial support for includes in handlers
Fixes #11694
2015-07-24 16:22:02 -04:00
James Cammarata ff49c5adac Make sure we're actually looping before looking at 'results' in TaskResult
Fixes #11696
2015-07-24 11:55:22 -04:00
James Cammarata e526743b4f Allowing `args: "{{some_var}}"` for task params again
This is unsafe and we debated re-adding it to the v2/2.0 codebase,
however it is a common-enough feature that we will simply mark it
as deprecated for now and remove it at some point in the future.

Fixes #11718
2015-07-24 10:33:12 -04:00
Brian Coca 851ed45bbf adding display to plugins and start moving debug to display 2015-07-23 10:26:12 -04:00
Andrew Hamilton 7254b22bf4 Fixing delegate_to when using a variable 2015-07-22 17:12:00 -07:00
James Cammarata d412bc72ef Fall back to paramiko if the smart detection fails to run ssh
Fixes #11695
2015-07-22 16:14:17 -04:00
James Cammarata 135404738e Fix a couple start-at-task issues
* added pattern matching to match v1 functionality
* check the task name, not the task+role name for matches
* make sure the input is unicode

Fixes #11692
2015-07-22 07:45:03 -04:00
ZviRackover 628925a77d Fix: add missing import 'locale' 2015-07-22 01:09:31 +03:00
James Cammarata 4c733fe4b7 Fix issues with vars_prompt and vars_files
* Prompt had to be moved up, as it needed to be done before the first
  templating of the play occurs, otherwise vars_files won't be templated
  properly
* Fixed a bug related to an earlier fix of vars_files incorporating
  extra vars to do the templating of the file name

Fixes #11404
2015-07-21 14:52:57 -04:00
James Cammarata e64989beb4 Moving ConnectionInformation -> PlayContext
Also making PlayContext a child class of the Playbook Base class,
which gives it access to all of the FieldAttribute code to ensure
field values are correctly typed after post_validation

Fixes #11381
2015-07-21 12:13:50 -04:00
James Cammarata dca36c1d16 Reestablishing the use of tags/when for role duplication detection
Not figuring these in can cause problems with "diamond" pattern relationships,
even though this is still not quite optimal.
2015-07-20 14:37:20 -04:00
Brian Coca 171c95672e fixed gathering expression as it was triggering when gather_facts was no 2015-07-19 23:16:54 -04:00
James Cammarata 3d77723e3d Cleaning up some stuff related to the connection info/become/executable change 2015-07-19 01:12:23 -04:00
James Cammarata 1c185b68be Rearranging some become stuff in relation to action/connection plugins
Moving the make_sudo_cmd() calls back up to the action level so that connection
plugins don't have to know about it at all, and moving some of the become data
(prompt and success_key) into the ConnectionInformation object so they don't
need to be passed around needlessly.
2015-07-19 01:12:23 -04:00
James Cammarata 271a7f3281 Cleaning up some of the notify/facts logic added earlier to fix problems 2015-07-17 14:44:19 -04:00
James Cammarata 5abdd3b821 Handle notifications when coupled with a loop
Fixes #11606
2015-07-17 12:03:04 -04:00