From 6947fe8c9937a4c5159081e5451ad75f6a5525b8 Mon Sep 17 00:00:00 2001 From: Cian Hughes Date: Fri, 27 Oct 2023 17:44:13 +0100 Subject: [PATCH] Added top-level overall command --- autoignition.py | 1 + create_disk.py | 1 + create_img.py | 1 + node_deployer.py | 18 ++++++++++++++++++ 4 files changed, 21 insertions(+) create mode 100644 node_deployer.py diff --git a/autoignition.py b/autoignition.py index 45dd2db..a86acdb 100644 --- a/autoignition.py +++ b/autoignition.py @@ -121,6 +121,7 @@ def json_to_img( str, typer.Option(help="The file to output the disk image to", prompt=True) ], ) -> None: + """Takes a fuel-ignition json file and produces an ignition disk image file""" selenium_container = None fuelignition_container = None fuelignition_image = None diff --git a/create_disk.py b/create_disk.py index 651eaef..d64a0f1 100644 --- a/create_disk.py +++ b/create_disk.py @@ -85,6 +85,7 @@ def create_ignition_disk( str, typer.Option(help="Swarm token for connecting to the swarm", prompt=True) ], ) -> None: + """Writes an ignition image to the specified disk for easy deployment of new nodes to the swarm""" # noqa create_img(hostname, password, switch_ip_address, switch_port, swarm_token) valid, response = validate() if not valid: diff --git a/create_img.py b/create_img.py index 06ac205..573f837 100644 --- a/create_img.py +++ b/create_img.py @@ -90,6 +90,7 @@ def create_img( str, typer.Option(help="Swarm token for connecting to the swarm", prompt=True) ], ) -> None: + """Creates an ignition image for deploying a new node to the swarm""" switch_ip_address = ipaddress.ip_address(switch_ip_address) if switch_port > MAX_PORT: raise ValueError(f"Port must be less than {MAX_PORT}") diff --git a/node_deployer.py b/node_deployer.py new file mode 100644 index 0000000..dd0ff33 --- /dev/null +++ b/node_deployer.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 + +import typer + +from create_img import create_img +from create_disk import create_ignition_disk +from autoignition import json_to_img + +app = typer.Typer( + help="A tool for creating ignition images for automated deployment to a swarm" +) + +app.command()(create_img) +app.command()(create_ignition_disk) +app.command()(json_to_img) + +if __name__ == "__main__": + app() \ No newline at end of file