summaryrefslogtreecommitdiff
path: root/lib/ansible/playbook
diff options
context:
space:
mode:
authorMatt Davis <nitzmahone@users.noreply.github.com>2020-05-26 09:42:06 -0700
committerGitHub <noreply@github.com>2020-05-26 09:42:06 -0700
commitf7dfa817ae6542509e0c6eb437ea7bcc51242ca2 (patch)
tree54279745ec63a4da6de54a59a18041d6de76b072 /lib/ansible/playbook
parentfdfa6fec75da14d7e145eccf7c092fba684ee1e2 (diff)
downloadansible-f7dfa817ae6542509e0c6eb437ea7bcc51242ca2.tar.gz
collection routing (#67684)
* `meta/` directory in collections * runtime metadata for redirection/deprecation/removal of plugin loads * a compatibility layer to keep existing content working on ansible-base + collections * a Python import redirection layer to keep collections-hosted (and otherwise moved) content importable by things that don't know better * supported Ansible version validation on collection loads
Diffstat (limited to 'lib/ansible/playbook')
-rw-r--r--lib/ansible/playbook/collectionsearch.py4
-rw-r--r--lib/ansible/playbook/helpers.py1
-rw-r--r--lib/ansible/playbook/role/__init__.py4
-rw-r--r--lib/ansible/playbook/role/definition.py5
-rw-r--r--lib/ansible/playbook/task.py6
5 files changed, 10 insertions, 10 deletions
diff --git a/lib/ansible/playbook/collectionsearch.py b/lib/ansible/playbook/collectionsearch.py
index d80b6a1c6a..fb69519b40 100644
--- a/lib/ansible/playbook/collectionsearch.py
+++ b/lib/ansible/playbook/collectionsearch.py
@@ -6,7 +6,7 @@ __metaclass__ = type
from ansible.module_utils.six import string_types
from ansible.playbook.attribute import FieldAttribute
-from ansible.utils.collection_loader import AnsibleCollectionLoader
+from ansible.utils.collection_loader import AnsibleCollectionConfig
from ansible.template import is_template, Environment
from ansible.utils.display import Display
@@ -14,7 +14,7 @@ display = Display()
def _ensure_default_collection(collection_list=None):
- default_collection = AnsibleCollectionLoader().default_collection
+ default_collection = AnsibleCollectionConfig.default_collection
# Will be None when used as the default
if collection_list is None:
diff --git a/lib/ansible/playbook/helpers.py b/lib/ansible/playbook/helpers.py
index 4eff569943..2a8c5aecbe 100644
--- a/lib/ansible/playbook/helpers.py
+++ b/lib/ansible/playbook/helpers.py
@@ -25,7 +25,6 @@ from ansible.errors import AnsibleParserError, AnsibleUndefinedVariable, Ansible
from ansible.module_utils._text import to_native
from ansible.module_utils.six import string_types
from ansible.parsing.mod_args import ModuleArgsParser
-from ansible.utils.collection_loader import AnsibleCollectionLoader
from ansible.utils.display import Display
display = Display()
diff --git a/lib/ansible/playbook/role/__init__.py b/lib/ansible/playbook/role/__init__.py
index 4b43b3eb64..b7456afcf7 100644
--- a/lib/ansible/playbook/role/__init__.py
+++ b/lib/ansible/playbook/role/__init__.py
@@ -32,7 +32,7 @@ from ansible.playbook.helpers import load_list_of_blocks
from ansible.playbook.role.metadata import RoleMetadata
from ansible.playbook.taggable import Taggable
from ansible.plugins.loader import add_all_plugin_dirs
-from ansible.utils.collection_loader import AnsibleCollectionLoader
+from ansible.utils.collection_loader import AnsibleCollectionConfig
from ansible.utils.vars import combine_vars
@@ -234,7 +234,7 @@ class Role(Base, Conditional, Taggable, CollectionSearch):
if self._role_collection: # this is a collection-hosted role
self.collections.insert(0, self._role_collection)
else: # this is a legacy role, but set the default collection if there is one
- default_collection = AnsibleCollectionLoader().default_collection
+ default_collection = AnsibleCollectionConfig.default_collection
if default_collection:
self.collections.insert(0, default_collection)
# legacy role, ensure all plugin dirs under the role are added to plugin search path
diff --git a/lib/ansible/playbook/role/definition.py b/lib/ansible/playbook/role/definition.py
index b859f63a95..20d69ebd6b 100644
--- a/lib/ansible/playbook/role/definition.py
+++ b/lib/ansible/playbook/role/definition.py
@@ -31,7 +31,8 @@ from ansible.playbook.collectionsearch import CollectionSearch
from ansible.playbook.conditional import Conditional
from ansible.playbook.taggable import Taggable
from ansible.template import Templar
-from ansible.utils.collection_loader import get_collection_role_path, AnsibleCollectionRef
+from ansible.utils.collection_loader import AnsibleCollectionRef
+from ansible.utils.collection_loader._collection_finder import _get_collection_role_path
from ansible.utils.path import unfrackpath
from ansible.utils.display import Display
@@ -155,7 +156,7 @@ class RoleDefinition(Base, Conditional, Taggable, CollectionSearch):
# try to load as a collection-based role first
if self._collection_list or AnsibleCollectionRef.is_valid_fqcr(role_name):
- role_tuple = get_collection_role_path(role_name, self._collection_list)
+ role_tuple = _get_collection_role_path(role_name, self._collection_list)
if role_tuple:
# we found it, stash collection data and return the name/path tuple
diff --git a/lib/ansible/playbook/task.py b/lib/ansible/playbook/task.py
index 972707f5cf..e9e5d876ef 100644
--- a/lib/ansible/playbook/task.py
+++ b/lib/ansible/playbook/task.py
@@ -36,7 +36,7 @@ from ansible.playbook.conditional import Conditional
from ansible.playbook.loop_control import LoopControl
from ansible.playbook.role import Role
from ansible.playbook.taggable import Taggable
-from ansible.utils.collection_loader import AnsibleCollectionLoader
+from ansible.utils.collection_loader import AnsibleCollectionConfig
from ansible.utils.display import Display
from ansible.utils.sentinel import Sentinel
@@ -182,7 +182,7 @@ class Task(Base, Conditional, Taggable, CollectionSearch):
new_ds.ansible_pos = ds.ansible_pos
# since this affects the task action parsing, we have to resolve in preprocess instead of in typical validator
- default_collection = AnsibleCollectionLoader().default_collection
+ default_collection = AnsibleCollectionConfig.default_collection
collections_list = ds.get('collections')
if collections_list is None:
@@ -293,7 +293,7 @@ class Task(Base, Conditional, Taggable, CollectionSearch):
if self._parent:
self._parent.post_validate(templar)
- if AnsibleCollectionLoader().default_collection:
+ if AnsibleCollectionConfig.default_collection:
pass
super(Task, self).post_validate(templar)