From 23215f669764ef368958c872da564b5c49c88bad Mon Sep 17 00:00:00 2001 From: Seokho Son Date: Wed, 1 May 2024 02:53:01 +0900 Subject: [PATCH 1/2] Add readme for init.py and init.sh --- scripts/init/README.md | 46 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 scripts/init/README.md diff --git a/scripts/init/README.md b/scripts/init/README.md new file mode 100644 index 000000000..ff325c101 --- /dev/null +++ b/scripts/init/README.md @@ -0,0 +1,46 @@ + +# README.md for `init.py` + +## Overview +The `init.py` script is designed to automate the process of registering credentials and loading common specifications and images for a Tumblebug server. It can be executed directly or via the `init.sh` script which sets up a Python virtual environment. This script ensures the Tumblebug server is healthy before proceeding and performs several network operations in a secure and managed way. + +## Features +- **Health Check**: Verifies that the Tumblebug server is ready to handle requests before proceeding with operations. +- **Credential Registration**: Dynamically registers all valid credentials stored in a YAML file to the Tumblebug server. +- **Resource Loading**: Initiates the loading of common specs and images into Tumblebug. + +## Prerequisites +- Python 3.x installed +- Python packages listed in `requirements.txt` +- The `python3-venv` package should be installed for running the script using `init.sh`. + +## Usage +### Direct Execution +\```bash +pip3 install -r requirements.txt +\``` + +\```bash +python3 init.py +\``` +### Options +- `-y, --yes`: Automatically answer yes to prompts and proceed without manual confirmation. + +### Execution via Script +\```bash +./init.sh +\``` +The `init.sh` script supports passing options to `init.py`, such as the `-y` flag for automatic execution. + +## Configuration +Before running the script, ensure the following environment variables are set according to your Tumblebug server configuration: +- `TUMBLEBUG_SERVER`: The address of the Tumblebug server. +- `API_USERNAME`: Username for API authentication. +- `API_PASSWORD`: Password for API authentication. + + +## Related Files +- `init.py`: Main Python script. +- `requirements.txt`: Contains all Python dependencies. +- `init.sh`: Bash script for setting up a Python virtual environment and running `init.py`. +- `credentials.yaml`: Contains the credentials data to be registered with the Tumblebug server. From e1784a46a6c6772717b46b85a042f49fc9633f3a Mon Sep 17 00:00:00 2001 From: Seokho Son Date: Wed, 1 May 2024 02:59:30 +0900 Subject: [PATCH 2/2] Update README.md for init.py --- scripts/init/README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/scripts/init/README.md b/scripts/init/README.md index ff325c101..6ffb1e765 100644 --- a/scripts/init/README.md +++ b/scripts/init/README.md @@ -16,21 +16,21 @@ The `init.py` script is designed to automate the process of registering credenti ## Usage ### Direct Execution -\```bash +```bash pip3 install -r requirements.txt -\``` +``` -\```bash +```bash python3 init.py -\``` -### Options -- `-y, --yes`: Automatically answer yes to prompts and proceed without manual confirmation. +``` + +- Options: `-y, --yes` (Automatically answer yes to prompts and proceed without manual confirmation) ### Execution via Script -\```bash -./init.sh -\``` -The `init.sh` script supports passing options to `init.py`, such as the `-y` flag for automatic execution. +```bash +init.sh +``` +- Options: `-y, --yes` (Automatically answer yes to prompts and proceed without manual confirmation) ## Configuration Before running the script, ensure the following environment variables are set according to your Tumblebug server configuration: