Plugins Function in InfraSet

Welcome to the Plugins Function user guide. This guide provides a comprehensive overview of how to validate, store, install, and execute plugins under the InfraSet functionality. The plugin feature enables extending the capabilities of your InfraSet setup through user-defined or prebuilt plugins.

Key Features of the Plugins Function

Plugin Workflow

  1. Validate Plugin: Ensure the plugin zip file includes the required files.
  2. Store Plugin: Place the plugin in the designated plugin directory for future use.
  3. Install Plugin: Extract and compile the plugin into a standalone executable using PyInstaller.
  4. Execute Plugin: Dynamically run the plugin with parameters and cloud credentials.

Declarative YAML Configuration for Plugins

Example: Declaring a Plugin in YAML


plugin_management:
  enabled: true
  plugins:
    - name: "example-plugin"
      path: "/path/to/example-plugin.zip"
      

Execution


dob infraset screenplay /path/to/infraset.yaml
      

Imperative CLI Commands for Plugins

Validate Plugin Structure

Command:


validate_plugin_structure(plugin_zip_path)
      

Description: Ensures that the plugin zip file contains the required files, such as main.py.

Output: Returns True if valid; otherwise, prints the missing files and returns False.

Store Plugin

Command:


store_plugin(plugin_name, plugin_path)
      

Description: Validates and stores a plugin in the plugin directory.

Arguments:

Example:


store_plugin("example-plugin", "/path/to/example-plugin.zip")
      

Install Plugin

Command:


install_plugin(plugin_name, plugin_zip_path)
      

Description: Extracts the plugin, installs dependencies, and compiles it into an executable.

Arguments:

Example:


install_plugin("example-plugin", "/path/to/example-plugin.zip")
      

Execute Plugin

Command:


execute_plugin(plugin_path, parameters, provider)
      

Description: Executes the plugin binary or script with dynamic parameters and credentials.

Arguments:

Example:


execute_plugin(
    plugin_path="/path/to/example-plugin",
    parameters={"action": "create", "resource_type": "vm"},
    provider="gcp"
)
      

Best Practices

Error Handling and Debugging

Conclusion

The Plugins Function in InfraSet is a powerful feature for extending the capabilities of your infrastructure setup. By supporting validation, installation, and execution, it provides a structured approach to managing plugins. Whether you’re creating custom plugins or integrating third-party solutions, this guide ensures a seamless experience.