diff options
author | Andrey Volkov <avolkov@mirantis.com> | 2017-04-12 15:13:23 +0300 |
---|---|---|
committer | Andrey Volkov <avolkov@mirantis.com> | 2017-05-24 12:15:28 +0300 |
commit | 90cabd0c8c6ad73596b4bf14f87831c47c69430e (patch) | |
tree | c6bf13b5fbdb64f12d60c398c87247a22744e811 /tools | |
parent | 640b152004fe3d9c43c26538809c3ac796f20eba (diff) | |
download | nova-90cabd0c8c6ad73596b4bf14f87831c47c69430e.tar.gz |
[placement] Fix placement-api-ref check tool
Some time ago the placement-api-ref source structure was changed
(Ia2fd62ae7f401cad34ee7c2b355c9a5ab1c93f6b) to use inc-files istead of
putting all in index.rst, but that change broke placement_api_docs.py.
This change modifies placement_api_docs.py to go through all *.inc files
in placement-api-ref directory and scan for the "rest method" header.
Change-Id: I60150ab51173934f848662499dcf6af18625697e
Diffstat (limited to 'tools')
-rw-r--r-- | tools/placement_api_docs.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/tools/placement_api_docs.py b/tools/placement_api_docs.py index 652800cf8d..1915c43b36 100644 --- a/tools/placement_api_docs.py +++ b/tools/placement_api_docs.py @@ -11,6 +11,7 @@ # under the License. """Test to see if docs exists for routes and methods in the placement API.""" +import os import sys from nova.api.openstack.placement import handler @@ -25,8 +26,8 @@ def _header_line(map_entry): return line -def inspect_doc(doc_file): - """Load up doc_file and see if any routes are missing. +def inspect_doc(doc_files): + """Load up doc_files and see if any routes are missing. The routes are defined in handler.ROUTE_DECLARATIONS. """ @@ -42,8 +43,10 @@ def inspect_doc(doc_file): for map_entry in routes: header_lines.append(_header_line(map_entry)) - with open(doc_file) as doc_fh: - content_lines = doc_fh.read().splitlines() + content_lines = [] + for doc_file in doc_files: + with open(doc_file) as doc_fh: + content_lines.extend(doc_fh.read().splitlines()) missing_lines = [] for line in header_lines: @@ -60,5 +63,7 @@ def inspect_doc(doc_file): if __name__ == '__main__': - doc_file = sys.argv[1] - sys.exit(inspect_doc(doc_file)) + path = sys.argv[1] + doc_files = [os.path.join(path, file) + for file in os.listdir(path) if file.endswith(".inc")] + sys.exit(inspect_doc(doc_files)) |