Commit Graph

28 Commits (f078946ed3bf5baa353d298158b325ce9ab9f313)

Author SHA1 Message Date
James Cammarata 5b87951d6c Don't copy the parent block of TaskIncludes when loading statically
When loading an include statically, we previously were simply doing a
copy() of the TaskInclude object, which recurses up the parents creating
a new lineage of objects. This caused problems when used inside load_list_of_blocks
as the new parent Block of the new TaskInclude was not actually in the list
of blocks being operated on. In most circumstances, this did not cause a
problem as the new parent block was a proper copy, however when used in
combination with PlaybookInclude (which copies conditionals to the list of
blocks loaded) this untracked parent was not being properly updated, leading
to tasks being run improperly.

Fixes #18206
2016-11-11 08:09:43 -06:00
James Cammarata 7ff9942ec6 Correctly reassign implicit block parents when an include is involved 2016-11-03 11:57:23 -05:00
James Cammarata d12475c98b Correctly assign parent when squashing adjacent implict Blocks
Related to: #18315
Related to: #18206
Related to: #17810
2016-11-03 09:27:24 -05:00
Strahinja Kustudic 9962245b92 Moves 'statically included' messages to -vv verbosity (#17918) 2016-10-06 08:55:24 -05: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 bd9094c925 include_role (role revamp implementation) (#17232)
* attempt #11 to role_include

* fixes from jimi-c

* do not override load_data, move all to load

* removed debugging

* implemented tasks_from parameter, must break cache

* fixed issue with cache and tasks_from

* make resolution of from_tasks prioritize literal

* avoid role dependency dedupe when include_role

* fixed role deps and handlers are now loaded

* simplified code, enabled k=v parsing

used example from jimi-c

* load role defaults for task when include_role

* fixed issue with from_Tasks overriding all subdirs

* corrected priority order of main candidates

* made tasks_from a more generic interface to roles

* fix block inheritance and handler order

* allow vars: clause into included role

* pull vars already processed vs from raw data

* fix from jimi-c blocks i broke

* added back append for dynamic includes

* only allow for basename in from parameter

* fix for docs when no default

* fixed notes

* added include_role to changelog
2016-08-26 13:42:13 -04:00
Michael Scherer a942758a07 Fix wrong error class (#17259)
AnsibleError is not imported in that file, and since that's
a parsing time issue, better raise AnsibleParserError like the
rest of the file.

Issue signaled on irc by gordon`
2016-08-26 08:53:28 -04:00
James Cammarata daf6eb97d3 Make sure includes for handlers in roles look in the correct subdir 2016-08-15 10:08:11 -05:00
James Cammarata 1c7e0c73c9 Several fixes for includes
* when including statically, make sure that all parents were also included
  statically (issue #16990)
* properly resolve nested static include paths
* print a message when a file is statically included

Fixes #16990
2016-08-11 14:07:49 -05:00
James Cammarata 06d4f4ad0e Move tasks/blocks to a single parent model 2016-08-08 15:58:46 -05:00
jctanner 02e52c319c Force an include to be a static task if no vars or loops are being used. (#16192)
Fixes #15735
2016-06-08 19:23:48 -04:00
James Cammarata e36b4014f5 Merge pull request #15958 from Schnitzel/taskinclude_handler
new HandlerTaskInclude Class which can run TaskIncludes inside Handlers
2016-06-06 14:01:57 -07:00
James Cammarata 72b29d122e When adding nested blocks, don't pass in any parent includes
We previously changed block behavior to prefer includes over parent
blocks, which broke inheritence in nested blocks.

Fixes #15926
2016-05-23 10:08:29 -04:00
Michael Schmid 566690a44a Fixes #15915: New HandlerTaskInclude Class which can run TaskIncludes inside Handlers 2016-05-22 15:45:55 +02:00
Martin Matuska 5ee38617b9 Treat "static: yes/no" with higher priority than "task_includes_static" in ansible.cfg 2016-05-03 12:15:13 +02:00
Martin Matuska 438ed70a43 Restore Ansible 2.0 compatibility for includes 2016-05-02 17:50:42 +02:00
James Cammarata 8ef564176b Handle includes which may have been created in the flow of the playbook
Since 2.0 made all includes dynamic, it is now possible to create and
include a file in the course of executing a playbook. However, with the
introduction of implicit static includes this can cause problems if an
include is thought to be static but does not yet exist. For now, we're
handling missing implicit static includes as a potential dynamic include
but also adding a deprecation message to show includes like this will
need to be marked as `static: no` in the future.

Fixes #15342
2016-04-12 09:33:58 -04:00
James Cammarata 2be1726350 Don't remove _raw_params from static include args 2016-03-29 21:40:29 -04:00
James Cammarata 2c20579a06 Add options to make includes 'static'
* Can be configured in the ansible.cfg for tasks/handlers individually
* If an included filename contains no vars or loops, it will be expanded
  in-place as if it were marked as static
2016-03-24 10:12:51 -04:00
Matt Martz ce54a59cdc Catch additional assertion errors for load_list_of_blocks 2015-12-02 10:35:20 -06:00
Brian Coca 53cd802251 better error on invalid task lists 2015-12-02 08:14:20 -08:00
James Cammarata c9a004227e Improve error catching from malformed playbook data
Fixes #12478
2015-09-23 08:56:36 -04:00
James Cammarata 1cb4e0be1c Fix bug in implicit block squashing where block is not reassigned
Fixes #12333
2015-09-12 11:27:30 -04:00
Marius Gedminas df1b41d3d3 Avoid types.NoneType
types.NoneType was removed in Python 3.

None is a singleton in Python, so 'x is None' is equivalent to
'isinstance(x, NoneType)'.
2015-08-27 22:15:56 +03: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
James Cammarata 8279557e8f Allow role names to be templated
Fixes #10858
2015-08-03 16:26:13 -04:00
Matt Martz 6a1c175991 Raise AnsibleParserError instead of AssertionError 2015-06-06 09:16:38 -05:00
James Cammarata ce3ef7f4c1 Making the switch to v2 2015-05-03 21:47:26 -05:00