mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 19:31:26 -07:00
named actions + modules list in utils.py
This commit is contained in:
parent
dfaef8061a
commit
2063e10c00
3 changed files with 16 additions and 10 deletions
|
@ -675,3 +675,17 @@ def import_plugins(directory):
|
|||
if not name.startswith("_"):
|
||||
modules[name] = imp.load_source(name, path)
|
||||
return modules
|
||||
|
||||
def get_available_modules(dirname=None):
|
||||
"""
|
||||
returns a list of modules available based on current directory
|
||||
looks in DEFAULT_MODULE_PATH, all subfolders named library and
|
||||
-M option"""
|
||||
modules_list = set()
|
||||
if dirname is None:
|
||||
dirname = C.DEFAULT_MODULE_PATH
|
||||
for path in dirname.split(os.pathsep):
|
||||
if os.path.exists(path):
|
||||
modules_list.update(os.listdir(path))
|
||||
modules_list = list(modules_list)
|
||||
return modules_list
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue