Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persistent VM Naming #523

Closed
wants to merge 2 commits into from
Closed

Conversation

jasperf
Copy link

@jasperf jasperf commented Mar 8, 2025

This pull request introduces several key changes to enhance the VM instance management functionality. The changes include adding support for custom instance names, improving error handling, and updating tests to cover the new functionality.

Enhancements to VM instance management:

  • cli_config/cli_config.go: Added a new field InstanceName to the VmConfig struct to support custom names for Lima VM instances.
  • trellis/vm_instance.go: Implemented functions to get and save the VM instance name based on a priority system (file, config, first site).
  • trellis/trellis.go: Updated MainSiteFromEnvironment to use the new GetVMInstanceName function for determining the main site based on the VM instance name.

Improvements to VM commands:

  • cmd/vm_delete.go: Modified the Run method to remove the instance file if it exists when deleting a VM instance.
  • cmd/vm_start.go: Updated the Run method to save the instance name after starting a VM instance.

Updates to tests:

  • cmd/vm_delete_test.go: Added a new test TestVmDeleteRemovesInstanceFile to verify that the instance file is removed when a VM instance is deleted.
  • cmd/vm_start_test.go: Added a new test TestVmStartSavesInstanceName to ensure that the instance name is saved correctly when a VM instance is started.
  • trellis/vm_instance_test.go: Added tests for the new GetVMInstanceName and SaveVMInstanceName functions to verify their behavior and priority system.

@jasperf jasperf closed this Mar 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant