Skip to content

Commit

Permalink
feat: review correction
Browse files Browse the repository at this point in the history
  • Loading branch information
SteBaum committed Nov 20, 2023
1 parent 78e86c5 commit 8ad5510
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions scripts/playbooks.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 8ad5510

Please sign in to comment.