pass multiple playbooks as arguments and run them sequentially
main / Explore-Gitea-Actions (push) Failing after 13s
main / Explore-Gitea-Actions (push) Failing after 13s
This commit is contained in:
+13
-11
@@ -10,6 +10,8 @@ def parse_args() -> argparse.Namespace:
|
|||||||
# Flag for the playbook file
|
# Flag for the playbook file
|
||||||
_ = parser.add_argument(
|
_ = parser.add_argument(
|
||||||
"-p", "--playbook",
|
"-p", "--playbook",
|
||||||
|
nargs='+',
|
||||||
|
default=[],
|
||||||
type=str,
|
type=str,
|
||||||
required=True,
|
required=True,
|
||||||
help="Path to the playbook yaml file"
|
help="Path to the playbook yaml file"
|
||||||
@@ -21,18 +23,18 @@ def parse_args() -> argparse.Namespace:
|
|||||||
def main():
|
def main():
|
||||||
args: argparse.Namespace = parse_args()
|
args: argparse.Namespace = parse_args()
|
||||||
|
|
||||||
newPlay: Playbook
|
for arg in args.playbook:
|
||||||
try:
|
newPlay: Playbook
|
||||||
newPlay = Playbook.from_yaml(args.playbook)
|
try:
|
||||||
except Exception as e:
|
newPlay = Playbook.from_yaml(arg)
|
||||||
print(f"Failed to load playbook: {e}")
|
except Exception as e:
|
||||||
traceback.print_exc()
|
print(f"Failed to load playbook: {e}")
|
||||||
exit(1)
|
traceback.print_exc()
|
||||||
|
exit(1)
|
||||||
|
|
||||||
# print(newPlay.view_playbook())
|
print(newPlay.view_playbook())
|
||||||
log = newPlay.run_play()
|
log = newPlay.run_play()
|
||||||
print(log.model_dump_json())
|
print(log.model_dump_json())
|
||||||
# print(json.dumps(asdict(newPlay.run_play()), indent=2))
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user