mirror of https://github.com/ansible/ansible.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
984 B
Python
40 lines
984 B
Python
6 years ago
|
#!/usr/bin/env python
|
||
|
"""Test to verify action plugins have an associated module to provide documentation."""
|
||
5 years ago
|
from __future__ import (absolute_import, division, print_function)
|
||
|
__metaclass__ = type
|
||
6 years ago
|
|
||
|
import os
|
||
6 years ago
|
import sys
|
||
6 years ago
|
|
||
|
|
||
|
def main():
|
||
|
"""Main entry point."""
|
||
6 years ago
|
paths = sys.argv[1:] or sys.stdin.read().splitlines()
|
||
|
|
||
6 years ago
|
module_names = set()
|
||
|
|
||
6 years ago
|
for path in paths:
|
||
|
if not path.startswith('lib/ansible/modules/'):
|
||
|
continue
|
||
|
|
||
|
name = os.path.splitext(os.path.basename(path))[0]
|
||
6 years ago
|
|
||
6 years ago
|
if name != '__init__':
|
||
|
if name.startswith('_'):
|
||
|
name = name[1:]
|
||
6 years ago
|
|
||
6 years ago
|
module_names.add(name)
|
||
6 years ago
|
|
||
6 years ago
|
for path in paths:
|
||
|
if not path.startswith('lib/ansible/plugins/action/'):
|
||
|
continue
|
||
6 years ago
|
|
||
6 years ago
|
name = os.path.splitext(os.path.basename(path))[0]
|
||
|
|
||
|
if name not in module_names:
|
||
6 years ago
|
print('%s: action plugin has no matching module to provide documentation' % path)
|
||
|
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
main()
|