This commit is contained in:
+8
-10
@@ -1,18 +1,14 @@
|
||||
import json
|
||||
import argparse
|
||||
import traceback
|
||||
from typing import List
|
||||
from playbook import Play
|
||||
from dataclasses import asdict
|
||||
|
||||
from playbook.action_registry import ActionRegistry
|
||||
from playbook import Playbook
|
||||
|
||||
|
||||
def parse_args() -> argparse.Namespace:
|
||||
parser = argparse.ArgumentParser(description="Playbook Taskrunner")
|
||||
|
||||
# Flag for the playbook file
|
||||
parser.add_argument(
|
||||
_ = parser.add_argument(
|
||||
"-p", "--playbook",
|
||||
type=str,
|
||||
required=True,
|
||||
@@ -25,16 +21,18 @@ def parse_args() -> argparse.Namespace:
|
||||
def main():
|
||||
args: argparse.Namespace = parse_args()
|
||||
|
||||
newPlay: Play
|
||||
newPlay: Playbook
|
||||
try:
|
||||
newPlay = Play.from_yaml(args.playbook)
|
||||
newPlay = Playbook.from_yaml(args.playbook)
|
||||
except Exception as e:
|
||||
print(f"Failed to load playbook: {e}")
|
||||
traceback.print_exc()
|
||||
exit(1)
|
||||
|
||||
print(newPlay.view_playbook())
|
||||
# print(json.dumps(asdict(newPlay.play()), indent=2))
|
||||
# print(newPlay.view_playbook())
|
||||
log = newPlay.run_play()
|
||||
print(log.model_dump_json())
|
||||
# print(json.dumps(asdict(newPlay.run_play()), indent=2))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user