diff --git a/scripts/playbooks.py b/scripts/playbooks.py index 8af3e1b3..7e0784fd 100644 --- a/scripts/playbooks.py +++ b/scripts/playbooks.py @@ -1,8 +1,23 @@ # Copyright 2022 TOSIT.IO # SPDX-License-Identifier: Apache-2.0 +""" + Generate meta playbooks in order to use a TDP like collection without tdp-lib. + + It checks the ansible playbooks which are given as input and returns a meta folder with the following yaml files: + + - all_per_service.yml listing all service. + - all.yml listing the location of all yaml files of every service. + - yaml file for each specified service containing the location of every yaml file concerning this service. + + The command `python path/to/playbooks.py` will execute the script with all collections defined in the `TDP_COLLECTION_PATH` including every service. + + Use the `-h` or `--help` option to get further information about the options. +""" + import argparse import os +import sys from pathlib import Path from typing import Optional @@ -142,13 +157,16 @@ def write_copyright_licence_headers(fd): services = args.services output_dir = args.output_dir for_collection = args.for_collection + if TDP_COLLECTION_PATH is None and args.collection is None: + print(" Error: No collection path has been given") + sys.exit(1) + collections = Collections.from_collection_list( [ Collection.from_path(col) - for col in args.collection or TDP_COLLECTION_PATH.split(":") + for col in args.collection or TDP_COLLECTION_PATH.split(os.pathsep) ] ) - playbooks( collections, services=services,