ansible/lib/ansible/utils/collection_loader/_collection_meta.py
Matt Davis f7dfa817ae
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
2020-05-26 09:42:06 -07:00

17 lines
566 B
Python

# (c) 2019 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from yaml import safe_load
def _meta_yml_to_dict(yaml_string_data, content_id):
routing_dict = safe_load(yaml_string_data)
if not routing_dict:
routing_dict = {}
# TODO: change this to Mapping abc?
if not isinstance(routing_dict, dict):
raise ValueError('collection metadata must be a dictionary')
return routing_dict