Commit Graph

371 Commits (86b86398f0e0c61df615d1fcf7643f01a1084327)

Author SHA1 Message Date
Sloane Hertel 86b86398f0
add ansible_name/ansible_aliases attrs to plugin objects (#78700)
*  new _fqcn attribute to plugin objects
* unbreak plugins in subdirs
* Fix inadventent changes to _load_name and use existing vars
* add plugin aliases and name property, and replace plugin._load_name where incorrect
* Fix listing plugin names

Fix listing legacy and builtin together
test deprecated plugin documentation
fix doc extensions
remove sometimes inaccurate _load_name handling from plugin.name

* Add tests for REJECT_EXTS and doc extensions

Fix unpredictable collection redirects so non-fqcns in the redirect list are guaranteed to be legacy (instead of determined by the collections keyword)

Move aliases and name properties to _update_object so all plugin types, including doc fragments, can use them

* make legacy plugin names internally consistent
* rename attributes to ansible_name and ansible_aliases
2 years ago
Martin Krizek 8090ee3e78
post_validate LoopControl (#75715)
avoid having to template/post_validate each part of the object
2 years ago
Kate Case bf1ef5a1f3
Replace get_persistent_connection_options in task_executor with get_options (#74446)
Replace get_persistent_connection_options with get_options
Remove special case for network sub_plugin in _set_plugin_options
Try to avoid mock connection pretending to be persistent
Rename variables->options to reflect what they actually are
Gather options for ssh_type_conn on network_cli
Drop reliance on sub_plugin["type"]
2 years ago
Matt Clay 09d0df1d87
Fix variable use before definition. (#78500)
* Fix variable use before definition.

* Include mkstemp in exception handler.

Also remove two pointless variable assignments.
2 years ago
Matt Clay 650befed37
Add missing space after keywords. (#78480)
Also remove unnecessary parenthesis.
2 years ago
Matt Davis 0591efd5e6
remove Templar caching (#78419)
* source of templating bugs (and at least one CVE), only applies to single-var values anyway
2 years ago
Brian Coca 1f59bbf4f3
listify_lookup_plugin_terms deprecate dataloader (#78244)
* listify_lookup_plugin_terms deprecate dataloader

  deprecated useless dataloader pass to function
  also removed from callers in core


Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
2 years ago
Matt Martz 18992b7947
Add new `loop_control.extended_allitems` option (#75760)
* Add new `loop_control.extended_allitems` option. Fixes #75216

* Add test for extended_allitems

* docs code block fix
2 years ago
Sloane Hertel 621e782ed0
Add toggle to fix module_defaults with module-as-redirected-action on a per-module basis (#77265)
* If there is a platform specific handler, prefer the resolved module over the resolved action when loading module_defaults

Add a toggle for action plugins to prefer the resolved module when loading module_defaults

Allow moving away from modules intercepted as actions pattern

Fixes #77059
2 years ago
Brian Coca a0dede5458
ansible-connection verboistery (#77509)
* ansible-connection verboistery

  for cli, just use normal parser creation
 this also adds --help, but that seems fine
 also some error cleanup

Co-authored-by: Nathaniel Case <this.is@nathanielca.se>
2 years ago
Brian Coca 3b9592fcaf
Move to display as single source of verbosity (#77498)
* Move to display as single source of verbosity

Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
2 years ago
Brian Coca c9d3518d2f
Fix final fact delegation (#77008)
* fix facts delegation loop overwrite

 partial revert of change to allow facts to be present in each loop iteration
 was not needed in final results as result processing alreayd had the disctiontion
 and ended up breaking the assumptions in the calling code.

 fixes #76676
2 years ago
Brian Coca 6d2d476113
avoid polluting vars with incorrect settings (#76590)
avoid polluting vars with incorrect settings

 simplify variables and templars
  - variables, original, only updated with final results, reset are copies of this
  - tempvars used for preliminary templating
  - cvars used for connection/shell/become plugins, delegation aware
  - vars_copy ignore tempvars updates and use connection plugin to get 
    finalized version per loop item/delegation,  also used to store temp results
    till we are ready to update 'variables'
 - fine tune nolog just cause we are here
 - also fix inventory_hostname_short for IP addresses
2 years ago
Brian Coca be19863e44
ssh connection: use 'correct' host in all cases (#76017)
ssh plugin, use 'correct' information source in all cases
  * still fallback to pc
  * added inventory to new test
  * undef var can still show as parser error on pc
    now task_exectuer has a  more accurate error handling
2 years ago
Martin Krizek 394d216922
add_host/group_by: fix using changed_when in a loop (#71719)
Fixes #71627
Fixes #75971
2 years ago
Matt Martz 96ce4804ee
Resolve perf issue with async callback events (#76783)
* Don't send full task with async callback events. Fixes #76729

* Use args for async_status task, instead of k=v

* Make sure we send back the async task attrs for polling

* Add clog frag

* load is a staticmethod
2 years ago
Brian Coca 7bec196061
loop/fact delegation fix (#75768)
now set_fact and include_vars intermediate results are congruent with delegation
3 years ago
Martin Krizek 0f95371131
Start of moving away from six (#75863)
ci_complete
3 years ago
Yedidyah Bar David aff5e5dfc6
_run_loop: Add the task name to the warning (#76012)
Prepend the task name to the warning "The loop variable 'item' is
already in use", so that you can get some context even if stdout and
stderr go to separate places.
3 years ago
Sloane Hertel 3b861abce1
add action_groups support to collections (#74039)
* Canonicalize module_defaults actions and action_groups pre-fork and cache them on the play

* Call get_action_args_with_defaults with the resolved FQCN plugin and don't pass the redirect list

* Add validation for action_group metadata and a toggle to disable the warnings

* Handle groups recursively referring to each other

* Remove special-casing for non-fqcn actions in module_defaults groups

* Error for actions and groups in module_defaults that can't be resolved

* Error for fully templated module_defaults

* Add integration tests for action_groups

* Changelog
3 years ago
Sam Doran a8de35e131
task_executor - use correct value for ssh connection retries (#75155)
Since the task and connection both have the same 'retries' keyword, the task default
would override the connection value.

Do not pass 'retries' from the task to the connection options.

* Set ssh_connection retries default value back to 0
  It was 0 before the move to config and was changed to 3 by accident.
3 years ago
David Shrewsbury 703cb79442
Implement async callbacks (#74953)
* add changelog and output from default callback
* add test
* add comments about TE task
3 years ago
Matt Martz ffa548503d
Wrap all results, regardless of register, except for actions with clean facts (#73161)
* Wrap all results, regardless of register, except for actions with clean facts. Fixes #21088

* ci_complete

* Add tests

* Add clog frag
3 years ago
Matt Martz ac77911491
Prevent conditional templating errors from masking task output. Fixes #37187 (#74891) 3 years ago
Brian Coca 9c718ccc42
Async status rewrite
-  remove need for module (at least for posix side)
  - adds retry with backoff on fetching file, since
    race is bigger since we don't spend time on module
  - now gives more info on fail
  - also made actionfail/skip handle results if given
3 years ago
Brian Coca b518aabf81
delegation fix (#74685)
*  delegation fix
3 years ago
Brian Coca 173d0a8de7
Skip interpreter discovery for network OSs(#74012)
skip python interpreter discovery on network os being set as this indicates a 'forced local' module and should use sys.executable.
3 years ago
Brian Coca 3cff54d69b
Fix missing delegate display (#74370)
* dont rely on vars, task already gives us info
* ensure we always display delegation in host label
* also added parens with ansible_host to show  target host vs resolved host
* delegating to self is not delegating
* delegated vars restoration for backwards compat
* tests need mock task with delegate_to
3 years ago
Brian Coca f9f839fa08
Fix debug factsetter (#74067)
* prevent debug from setting namespaced facts as tlv
* also added tests
3 years ago
Matt Martz 78f34786dd
Send callbacks directly from the TaskExecutor instead of TaskResults masquerading as callbacks (#73927) 3 years ago
David Shrewsbury 78d3810fdf
Auto cleanup of async cache file (#73760)
* Auto cleanup of async cache file

* Add changelog
3 years ago
Martin Krizek 7f9ac0f364
Consolidate filters/tests handling into JinjaPluginIntercept (#71463)
* Consolidate filters/tests handling into JinjaPluginIntercept

ci_complete

* Postpone loading all ansible plugins

* Do we need to create an overlay?

ci_complete

* Typo

ci_complete

* Add FIXME

* conditional.py: use public Environment.parse() method

* Remove remaining occurrences of shared_loader_obj being passed to Templar

* __UNROLLED__ not needed with this change anymore

* Incorrect rebase at some point?
3 years ago
Brian Coca 07248e5ec1
avoid key errors on environment access (#72620) 4 years ago
Ganesh B Nalawade 5fb6280672 Add verbose log for network action handler information 4 years ago
Felix Fontein da60525610
Fix missing ansible.builtin FQCNs in hardcoded action names (#71824)
* Make sure hard-coded action names also check for FQCN.
* Use _add_internal_fqcn() to avoid hardcoded lists and typoes.
4 years ago
Matt Martz be5fc4e642
Ensure we call action_loader.get with collection_list (#72206)
* Ensure we call action_loader.get with collection_list. Fixes #72170

* Add tests and changelog

* Remove grep, do assertion in playbook. ci_complete

* Skip old jinja2 versions

* ci_complete

* dedupe
4 years ago
Sloane Hertel 7048542199
Fix passing the connection timeout to connection plugins (#71722)
* Fix passing the connection timeout to connection plugins
4 years ago
Martin Krizek d083307e36
Set global skipped result flag for looped tasks (#67847)
This allows for the skipped filter to be used on a registered looped
task results.

Fixes #16949
4 years ago
Martin Krizek 50f221c63e
Fix incorrect msg in the results dict in loops (#71482) 4 years ago
Matt Martz 5821128995
Allow callbacks from forks (#70501)
* POC for supporting callback events that come from the worker

* linting fixes. ci_complete

* fix up units. ci_complete

* Try moving the sentinel put higher. ci_complete

* safeguards. ci_complete

* Move queue killing to terminate

* LINTING. ci_complete

* Subclass Queue, to add helper send_callback method

* Just use _final_q instead of adding another queue and thread

* Revert a few changes

* Add helper for inserting a TaskResult into the _final_q

* Add changelog fragment

* Address rebase issue

* ci_complete

* Add test to assert async poll callback from fork

* Don't use full path

* ci_complete

* Use _results_lock as a context manager

* Add new generic lock decorator, and use it with send_callback
4 years ago
Abhijeet Kasurde 504ef607f3
Misc typo fixes (#71089) 4 years ago
Brian Coca f9af27c631
dont clobber facts in loop (#71032)
* dont clobber facts in loop

	fixes #71031
4 years ago
Jordan Borean 5e1a968983
Do not add connection vars to the output results (#70853)
* Do not add connection vars to the output results

* Also revert the delgated scenario JIC

* Added regression test
4 years ago
Matt Davis 4c0af6c808
fix internal cases of actions calling unqualified module names (#70818)
* fix internal cases of actions calling unqualified module names

* add porting_guide entry
* misc other fixes around action/module resolution broken by redirection

ci_complete

* Update docs/docsite/rst/porting_guides/porting_guide_2.10.rst

Co-authored-by: Rick Elrod <rick@elrod.me>

* Update docs/docsite/rst/porting_guides/porting_guide_2.10.rst

Co-authored-by: Rick Elrod <rick@elrod.me>

* address review feedback

* pep8

* unit test fixes

* win fixes

* gather_facts fix module args ignores

* docs sanity

* pep8

* fix timeout test

* fix win name rewrites

Co-authored-by: Rick Elrod <rick@elrod.me>
4 years ago
Brian Coca 84adaba6f5
Allow hostvars delegation (#70331)
* ensure hostvars are available on delegation
* also inventory_hostname must point to current host and not delegated one
* fix get_connection since it was still mixing original host vars and delegated ones
* also return connection vars for delegation and non delegation alike
* add test to ensure we have expected usage when directly assigning for non delegated host
4 years ago
Abhijeet Kasurde 8915f262b4
misc typo fixes (#70736)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
4 years ago
Sloane Hertel 8c213c9334
template connection variables accessed directly before using (#70657)
* template variables accessed directly when using them instead of FieldAttributes
4 years ago
David Shrewsbury 8aca464b8b
Make sure ansible_become treated as a boolean (#70484)
* Make sure ansible_become treated as a boolean
4 years ago
Sloane Hertel 30e70f4b63
Handle post_validate templating errors and fix tests (#70240)
* Handle unexpected templating errors

* Fixes #70050

Fix up tests that weren't running and add tests for graceful templating error handling
4 years ago
Rick Elrod 9cfc76a221
Nuke with_ squashing, deprecated for 2.11 (#70209)
Change:
Removes with_* loop squashing and tests for 2.11

Test Plan:
CI, and grepped for with_items in package manager integration targets.
There might be some test cases in collections which need to stop testing
this behavior.

Signed-off-by: Rick Elrod <rick@elrod.me>
4 years ago