Skip to content

Commit eab48b3

Browse files
committed
fix: set provision_method to Provisioned after infrastructure provisioning
The provision_method field in RuntimeOutputs was not being set when using the provision command, resulting in null in the environment state JSON. This commit adds the missing with_provision_method() call to set the field to ProvisionMethod::Provisioned after successful provisioning, consistent with how the register command sets it to ProvisionMethod::Registered. Changes: - Add import for ProvisionMethod in provision handler - Chain with_provision_method(ProvisionMethod::Provisioned) after with_instance_ip() in the success handler - Update comment to reflect both instance IP and provision method are set This ensures the provision_method field correctly indicates whether infrastructure was created via 'provision' (Provisioned) or connected via 'register' (Registered), which affects lifecycle operations like destroy.
1 parent 585cd0f commit eab48b3

File tree

1 file changed

+5
-2
lines changed
  • src/application/command_handlers/provision

1 file changed

+5
-2
lines changed

src/application/command_handlers/provision/handler.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use crate::application::steps::{
1818
WaitForCloudInitStep, WaitForSSHConnectivityStep,
1919
};
2020
use crate::domain::environment::repository::{EnvironmentRepository, TypedEnvironmentRepository};
21+
use crate::domain::environment::runtime_outputs::ProvisionMethod;
2122
use crate::domain::environment::state::{ProvisionFailureContext, ProvisionStep};
2223
use crate::domain::environment::{Environment, Provisioned, Provisioning};
2324
use crate::domain::EnvironmentName;
@@ -112,8 +113,10 @@ impl ProvisionCommandHandler {
112113
// This allows us to know exactly which step failed if an error occurs
113114
match self.execute_provisioning_workflow(&environment).await {
114115
Ok((provisioned, instance_ip)) => {
115-
// Store instance IP in the environment context
116-
let provisioned = provisioned.with_instance_ip(instance_ip);
116+
// Store instance IP and provision method in the environment context
117+
let provisioned = provisioned
118+
.with_instance_ip(instance_ip)
119+
.with_provision_method(ProvisionMethod::Provisioned);
117120

118121
info!(
119122
command = "provision",

0 commit comments

Comments
 (0)