feat: v1.5.0 - OpenNebula 7.0.x support, smart auto-fill IDs & multi-instance improvements - #25
Conversation
The previous commit added ID-based functions but installer.py still used name-based lookups after service instantiation, causing "Service not found" errors when multiple services share the same name. ## Changes to utils/one.py - Add oneflow_roles_by_id() to get roles by service ID - Add oneflow_roles_vm_names_by_id() to get VM names by service ID - Add oneflow_chown_by_id() to change owner by service ID - Add oneflow_role_info_by_id() to get role details by service ID - Add oneflow_role_vm_name_by_id() to get role VM name by service ID - Add oneflow_custom_attr_value_by_id() to get custom attrs by service ID - Modify oneflow_template_instantiate() to return Tuple[str, int] - Modify onemarketapp_instantiate() to return Tuple[bool, str, Optional[int]] ## Changes to installer.py - Import oneflow_role_vm_name_by_id and oneflow_custom_attr_value_by_id - Capture toolkit_service_id from onemarketapp_instantiate() - Use oneflow_role_vm_name_by_id() for jenkins_vm, minio_vm, tnlcm_vm - Use oneflow_custom_attr_value_by_id() for sites_ansible_token
…rvice state checks
Add ID-based variants for VM operations to handle cases where multiple
VMs may have the same name (e.g., Technitium DNS, Route Manager API):
New functions in utils/one.py:
- onevm_chown_by_id(vm_id, username, group_name)
- onevm_id(vm_name) - get VM ID from name
- onevm_show_by_id(vm_id)
- onevm_ip_by_id(vm_id)
- onevm_state_by_id(vm_id)
- onevm_user_input_by_id(vm_id, user_input)
- onevms_running_with_ids() - returns {name: id} dict
Modified onemarketapp_instantiate():
- Now returns Tuple[bool, str, Optional[int], Optional[int]]
- Fourth element is VM ID for IMAGE type appliances
- Uses onevms_running_with_ids() for VM selection
- Internally uses ID-based functions to avoid conflicts
Updated installer.py:
- Captures VM IDs for Technitium and Route Manager API
- Uses onevm_ip_by_id() for DNS and Route Manager endpoints
- Uses onevm_user_input_by_id() for Route Manager token
This ensures correct VM operations when multiple toolkit installations
exist with identically named IMAGE-type appliances.
The onemarketapp_instantiate function was updated to return 4 values (is_instantiated, appliance_name, service_id, vm_id) but the toolkit service instantiation was still expecting only 3 values, causing a "too many values to unpack (expected 3)" error. Updated the unpacking at line 335 to include the fourth value (vm_id) using _ since it's not needed for the toolkit service.
Prevent crash when user confirms having an instantiated appliance but no running VMs or services exist in OpenNebula. Changes: - Wrap instantiation confirmation in a while loop to allow retry - Add validation before ask_select to check for empty choices - Display warning message and re-prompt when no instances found - Initialize vm_name, service_name, and vms_running_with_ids variables before the loop to prevent undefined variable issues - Fix typo: "Do yo have" -> "Do you have" Previously, answering "Yes" to the instantiation question when no VMs or services existed would crash with "A list of choices needs to be provided" from questionary's ask_select function.
Generate unique service names with username and timestamp when
instantiating OpenNebula services via oneflow_template_instantiate().
Format: "{template_name} - {username} - {YYYYMMDD-HHMMSS}"
Example: "6G-Sandbox Toolkit 20250915-1622-v1.0.0 - rafag - 20250206-143522"
This allows multiple developers to instantiate the same service template
while being able to identify and differentiate their instances in the
service list.
Add visual header with component name in uppercase, separator lines, and emoji to make components stand out during library iteration.
…ariables Extend the marketplace auto-fill logic to handle components with multiple appliances that use prefixed variable names (e.g., collector_template_id, switch_image_id). The matching algorithm: - Standard variables (template_id, image_id): auto-filled from the only appliance when there's exactly one - Prefixed variables (*_template_id, *_image_id): matched against appliance names by extracting the prefix and searching for it in the appliance name words (case-insensitive, handling hyphens and underscores) This enables components like int_p4_sw to automatically populate their collector_template_id and collector_image_id from the "INT-P4 Collector" appliance, reducing manual input during site configuration.
…nce changelog with multi-instance support and unpack return values
There was a problem hiding this comment.
Pull request overview
This PR adds support for OpenNebula 7.0.x alongside 6.10.x, introduces smart auto-fill functionality for template and image IDs from marketplace appliances, and improves multi-instance support through ID-based resource lookups. The changes include a comprehensive function index in the OpenNebula CLI wrapper, unique naming for service instances, and enhanced user experience for component selection and data entry.
Changes:
- Added OpenNebula 7.0.x version detection and corresponding toolkit service appliance support
- Implemented smart auto-fill logic for template_id/image_id variables with support for standard, prefixed, and nested (versioned) variables
- Introduced ID-based lookup functions (_by_id suffix pattern) to prevent naming conflicts in multi-instance scenarios
- Enhanced user input handling for list values and improved component selection prompts
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| pyproject.toml | Version bump to 1.5.0 and added new authors (has syntax error) |
| scripts/install.sh | Version bump to v1.5.0 |
| CHANGELOG.md | Added v1.5.0 release notes with comprehensive change documentation |
| utils/one.py | Added function index, new _by_id functions, unique service naming, SERVICE type ID retrieval, and empty list handling |
| utils/file.py | Enhanced template_id/image_id detection for prefixed variables, improved list input parsing |
| installer.py | OpenNebula version selection, smart auto-fill logic for IDs, ID-based function calls, improved error messages and component prompts |
Comments suppressed due to low confidence (2)
utils/one.py:1222
- While the comment states "Use ID-based functions to avoid conflicts with services of the same name", the code still uses name-based onevm_chown for VMs within the service. If multiple service instances exist, their VMs could potentially have conflicting names. Consider either creating a oneflow_roles_vm_ids_by_id function to retrieve VM IDs directly, or document why VM names are guaranteed to be unique within instantiated services (e.g., if OpenNebula automatically appends service instance IDs to VM names).
# Use ID-based functions to avoid conflicts with services of the same name
roles_vm_names = oneflow_roles_vm_names_by_id(oneflow_id=service_id)
if roles_vm_names:
for vm_name in roles_vm_names:
onevm_chown(
vm_name=vm_name,
username=username,
group_name=group_name,
)
utils/one.py:2928
- While the comment states "Use ID-based functions from here to avoid conflicts with services of the same name", the code still uses name-based onevm_chown for VMs within the service roles (line 2924). If multiple service instances exist, their VMs could potentially have conflicting names. Consider using VM IDs from the service role data structure instead of names for consistency with the ID-based approach.
roles_vm_names = oneflow_roles_vm_names_by_id(oneflow_id=service_id)
if roles_vm_names:
for vm_name in roles_vm_names:
onevm_chown(
vm_name=vm_name,
username=username,
group_name=group_name,
)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…n auto-fill logic
…ormats in site variable prompts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… in site variable prompts
…ter error management
rubenlocru
left a comment
There was a problem hiding this comment.
All good no errors in the deploy
Summary
This release introduces support for OpenNebula 7.0.x, smart auto-fill of template/image IDs from marketplace appliances, and multi-instance support using ID-based lookups to prevent naming conflicts.
Changes
Added
template_idandimage_idvariables from marketplace appliances.Changed
site_routemanageris now optional.Fixed
onemarketapp_instantiate.onemarketapp_instantiate.Files modified
installer.py— Main installer flow with OpenNebula version selection, ID-based lookups, auto-fill logicutils/one.py— New_by_idfunctions, unique naming, empty list handlingutils/file.py— List input handling improvementsscripts/install.sh— Version bump to v1.5.0pyproject.toml— Version bump to 1.5.0CHANGELOG.md— v1.5.0 entry.env— AddedAPPLIANCE_TOOLKIT_V7_SERVICE_URL