diff --git a/tools/index_metadata.py b/tools/index_metadata.py index 2bdb12c4..179d84ae 100644 --- a/tools/index_metadata.py +++ b/tools/index_metadata.py @@ -88,6 +88,10 @@ def main(): data=data ) +def filter_docs(metadata): + allowed_types = ["umn", "api-ref", "dev"] + metadata['docs'] = [doc for doc in metadata['docs'] if doc['type'] in allowed_types] + return metadata def getData(environment, all_doc_types): metadatadata = metadata.service_types_with_doc_types( @@ -95,11 +99,9 @@ def getData(environment, all_doc_types): ) print(all_doc_types) if not all_doc_types: - for i, doc in enumerate(metadatadata["docs"], 0): - if doc["type"] not in ["umn", "api-ref", "dev"]: - metadatadata["docs"].pop(i) - print(metadatadata) - return metadatadata + final_data = filter_docs(metadatadata) + print(final_data) + return final_data def indexData(deleteIndex, hosts, index, username, password, data):