2018-11-14 07:52:36 +01:00
|
|
|
#!/usr/bin/env python
|
|
|
|
"""Test to verify action plugins have an associated module to provide documentation."""
|
2019-07-12 08:46:20 +02:00
|
|
|
from __future__ import (absolute_import, division, print_function)
|
|
|
|
__metaclass__ = type
|
2018-11-14 07:52:36 +01:00
|
|
|
|
|
|
|
import os
|
2019-02-05 23:56:04 +01:00
|
|
|
import sys
|
2018-11-14 07:52:36 +01:00
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
"""Main entry point."""
|
2019-02-05 23:56:04 +01:00
|
|
|
paths = sys.argv[1:] or sys.stdin.read().splitlines()
|
|
|
|
|
2018-11-14 07:52:36 +01:00
|
|
|
module_names = set()
|
|
|
|
|
2019-02-05 23:56:04 +01:00
|
|
|
for path in paths:
|
|
|
|
if not path.startswith('lib/ansible/modules/'):
|
|
|
|
continue
|
|
|
|
|
|
|
|
name = os.path.splitext(os.path.basename(path))[0]
|
2018-11-14 07:52:36 +01:00
|
|
|
|
2019-02-05 23:56:04 +01:00
|
|
|
if name != '__init__':
|
|
|
|
if name.startswith('_'):
|
|
|
|
name = name[1:]
|
2018-11-14 07:52:36 +01:00
|
|
|
|
2019-02-05 23:56:04 +01:00
|
|
|
module_names.add(name)
|
2018-11-14 07:52:36 +01:00
|
|
|
|
2019-02-05 23:56:04 +01:00
|
|
|
for path in paths:
|
|
|
|
if not path.startswith('lib/ansible/plugins/action/'):
|
|
|
|
continue
|
2018-11-14 07:52:36 +01:00
|
|
|
|
2019-02-05 23:56:04 +01:00
|
|
|
name = os.path.splitext(os.path.basename(path))[0]
|
|
|
|
|
|
|
|
if name not in module_names:
|
2018-11-14 07:52:36 +01:00
|
|
|
print('%s: action plugin has no matching module to provide documentation' % path)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|