feat: [#352] add JSON output to provision command#353
Merged
josecelano merged 2 commits intomainfrom Feb 16, 2026
Merged
Conversation
Member
Author
|
ACK 2341244 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Adds machine-readable JSON output format (
--output-format json) to theprovisioncommand, enabling automation workflows to programmatically extract provisioned instance details without regex parsing of console output.Closes #352
Parent Epic: #348
What Changed
Implementation (Commit: 422692f)
Added Files:
src/presentation/views/commands/provision/provision_details.rs- DTO for provision output datasrc/presentation/views/commands/provision/text_view.rs- Human-readable text output (default)src/presentation/views/commands/provision/json_view.rs- Machine-readable JSON outputsrc/presentation/views/commands/provision/mod.rs- Module exports and documentationModified Files:
src/presentation/controller/commands/provision/handler.rs- Strategy Pattern format switchingsrc/presentation/controller/errors.rs- OutputFormatting error variantsrc/presentation/controller/router.rs- output_format parameter passing7 files changed: 707 insertions(+), 108 deletions(-)
Documentation (Commit: 2341244)
Updated Files:
docs/user-guide/commands/provision.md- Added Output Formats section with 6 automation examplesdocs/user-guide/commands.md- Updated common optionsdocs/issues/352-add-json-output-to-provision-command.md- Updated implementation status3 files changed: 464 insertions(+), 114 deletions(-)
Architecture
Follows the Strategy Pattern established in #349:
ProvisionDetailsDatafor data transferTextViewandJsonViewfor format-specific renderingExecutionContext::output_format()DDD Compliance: Views in presentation layer only format data, no business logic.
JSON Output Schema
{ "environment_name": "my-environment", "instance_name": "torrust-tracker-vm-my-environment", "instance_ip": "10.140.190.42", "ssh_private_key_path": "/home/user/.ssh/id_rsa", "ssh_public_key_path": "/home/user/.ssh/id_rsa.pub", "ssh_username": "torrust", "ssh_port": 22, "provider": "lxd", "domains": [], "provisioned_at": "2026-02-16T13:38:02.446056727Z" }Testing
Unit Tests ✅
Manual Tests ✅
jqQuality Checks ✅
Use Cases Enabled
1. SSH Connection Automation
2. CI/CD Pipeline Integration
3. DNS Automation (HTTPS deployments)
Breaking Changes
None. Default behavior unchanged (human-readable text output).
Documentation
Reviewer Notes
Checklist