print-1.7.0
2 minute read
KOSI Plugin Print Version 1.7.0
Summary
The Print plugin for KOSI allows users to display messages on the command line during a KOSI package operation. It is particularly useful for debugging, logging, or providing status updates within a KOSI package. You can print multiple messages in succession if needed.
Best Practices
- Use the Print plugin to make your KOSI packages more user-friendly by providing status updates and progress messages.
- Avoid excessive printing, which may clutter the terminal output; focus on critical information.
- Messages are logged with timestamps, making them useful for debugging and tracking execution flow.
Keys
Key | Mandatory | Description |
---|---|---|
message |
Yes | The text message to be displayed on the command line. |
Examples
Example 1 - Printing a single message
This example demonstrates how to print a single message to the command line.
languageversion = "1.0.0";
apiversion = "kubernative/kubeops/sina/user/v4";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";
files =
{
input = "template.yaml";
}
containers =
{
example = ["docker.io", "nginx", "latest"];
}
install
{
cmd(command = "echo Starting the KOSI install package execution...");
print(message = "Execution has started successfully.");
}
Output
Starting the KOSI install package execution...
2023-12-01 13:38:14 Info: Execution has started successfully.
Example 2 - Printing multiple messages
In this example, multiple messages are printed during different stages of execution.
languageversion = "1.0.0";
apiversion = "kubernative/kubeops/sina/user/v4";
name = "kosi-example-packagev3";
description = "kosi-example-package";
version = "0.1.0";
docs = "docs.tgz";
logo = "logo.png";
files =
{
input = "template.yaml";
}
containers =
{
example = ["docker.io", "nginx", "latest"];
}
install
{
cmd(command = "echo Initializing installation process...");
print(message = "Step 1: Checking prerequisites...");
print(message = "Step 2: Downloading required files...");
print(message = "Step 3: Installation in progress...");
print(message = "Installation completed successfully.");
}
Output
Initializing installation process...
2023-12-01 13:41:20 Info: Step 1: Checking prerequisites...
2023-12-01 13:41:21 Info: Step 2: Downloading required files...
2023-12-01 13:41:23 Info: Step 3: Installation in progress...
2023-12-01 13:41:25 Info: Installation completed successfully.
Note: The example above does not download and install anything, it only shows a best practice example with the print plugin.