cli.build.role_include package¶
Module contents¶
Compatibility wrapper.
- This package was migrated from a flat module (role_include/__main__.py) to a package layout:
role_include/__main__.py contains the original implementation.
We re-export the public API so existing imports keep working.
- cli.build.role_include.build_dependency_graph(roles_dir, prefixes=None)¶
Build a dependency graph where each key is a role name and its value is a list of roles that depend on it. Also return in_degree counts and the roles metadata map.
- class cli.build.role_include.defaultdict¶
Bases:
dictdefaultdict(default_factory=None, /, […]) –> dict with default factory
The default factory is called without arguments to produce a new value when a key is not present, in __getitem__ only. A defaultdict compares equal to a dict with the same items. All remaining arguments are treated the same as if they were passed to the dict constructor, including keyword arguments.
- copy() a shallow copy of D.¶
- default_factory¶
Factory for default value called by __missing__().
- class cli.build.role_include.deque¶
Bases:
objectdeque([iterable[, maxlen]]) –> deque object
A list-like sequence optimized for data accesses near its endpoints.
- append()¶
Add an element to the right side of the deque.
- appendleft()¶
Add an element to the left side of the deque.
- clear()¶
Remove all elements from the deque.
- copy()¶
Return a shallow copy of a deque.
- count()¶
D.count(value) – return number of occurrences of value
- extend()¶
Extend the right side of the deque with elements from the iterable
- extendleft()¶
Extend the left side of the deque with elements from the iterable
- index()¶
D.index(value, [start, [stop]]) – return first index of value. Raises ValueError if the value is not present.
- insert()¶
D.insert(index, object) – insert object before index
- maxlen¶
maximum size of a deque or None if unbounded
- pop()¶
Remove and return the rightmost element.
- popleft()¶
Remove and return the leftmost element.
- remove()¶
D.remove(value) – remove first occurrence of value.
- reverse()¶
D.reverse() – reverse IN PLACE
- rotate()¶
Rotate the deque n steps to the right (default n=1). If n is negative, rotates left.
- cli.build.role_include.find_cycle(roles)¶
- Detect a cycle in the run_after relations:
roles: dict mapping role_name -> { ‘run_after’: […], … }
Returns a list of role_names forming the cycle (with the start repeated at end), or None.
- cli.build.role_include.find_roles(roles_dir, prefixes=None)¶
Find all roles in the given directory whose names start with any of the provided prefixes. If prefixes is empty or None, include all roles.
- cli.build.role_include.gen_condi_role_incl(roles_dir, prefixes=None)¶
Generate playbook entries based on the sorted order. Raises a ValueError if application_id is missing.
- cli.build.role_include.load_application_id(role_path)¶
Load the application_id from the vars/main.yml of the role.
- cli.build.role_include.load_run_after(meta_file)¶
Load the ‘run_after’ from the meta/main.yml of a role.
- cli.build.role_include.main()¶
- cli.build.role_include.print_dependency_tree(graph)¶
Print the dependency tree visually on the console.
- cli.build.role_include.topological_sort(graph, in_degree, roles=None)¶
Perform topological sort on the dependency graph. If a cycle is detected, raise an Exception with detailed debug info.