diff --git a/hacking/report.py b/hacking/report.py index ae4b3fb96d2..9c5d52d6ddf 100755 --- a/hacking/report.py +++ b/hacking/report.py @@ -9,6 +9,7 @@ import json import os import sqlite3 import sys +import yaml DATABASE_PATH = os.path.expanduser('~/.ansible/report.db') BASE_PATH = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')) + '/' @@ -22,7 +23,7 @@ if ANSIBLE_TEST_PATH not in sys.path: sys.path.insert(0, ANSIBLE_TEST_PATH) from ansible.module_utils.urls import open_url -from ansible.parsing.metadata import extract_metadata +from ansible.parsing.plugin_docs import read_docstring from ansible_test._internal.target import walk_integration_targets @@ -96,12 +97,10 @@ def populate_modules(): path = os.path.join(root, file_name) - with open(path, 'rb') as module_fd: - module_data = module_fd.read() + result = read_docstring(path) - result = extract_metadata(module_data=module_data) - - metadata = result[0] + metadata = result['metadata'] + doc = result['doc'] if not metadata: if module == 'async_wrapper': @@ -114,6 +113,7 @@ def populate_modules(): namespace=namespace, path=path.replace(BASE_PATH, ''), supported_by=metadata['supported_by'], + version_added=str(doc.get('version_added', '')) if doc else '', )) for status in metadata['status']: @@ -130,6 +130,7 @@ def populate_modules(): ('namespace', 'TEXT'), ('path', 'TEXT'), ('supported_by', 'TEXT'), + ('version_added', 'TEXT'), )), module_statuses=dict( rows=module_statuses_rows,