Include version_added in report.py (#61857)

This commit is contained in:
Matt Martz 2019-09-09 11:40:38 -05:00 committed by GitHub
parent 3ea8e0a144
commit 4e2c70c13e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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