|
1 | 1 | use crate::{ |
2 | 2 | lib_context::{FlowExecutionContext, LibSetupContext, get_auth_registry}, |
3 | | - ops::{get_optional_executor_factory, interface::ExportTargetFactory}, |
| 3 | + ops::{ |
| 4 | + get_optional_executor_factory, |
| 5 | + interface::{ExportTargetFactory, FlowInstanceContext}, |
| 6 | + }, |
4 | 7 | prelude::*, |
5 | 8 | }; |
6 | 9 |
|
@@ -252,6 +255,7 @@ fn group_resource_states<'a>( |
252 | 255 | pub async fn check_flow_setup_status( |
253 | 256 | desired_state: Option<&FlowSetupState<DesiredMode>>, |
254 | 257 | existing_state: Option<&FlowSetupState<ExistingMode>>, |
| 258 | + flow_instance_ctx: &Arc<FlowInstanceContext>, |
255 | 259 | ) -> Result<FlowSetupStatus> { |
256 | 260 | let metadata_change = diff_state( |
257 | 261 | existing_state.map(|e| &e.metadata), |
@@ -331,7 +335,7 @@ pub async fn check_flow_setup_status( |
331 | 335 | &resource_id.key, |
332 | 336 | target_state, |
333 | 337 | existing_without_setup_by_user, |
334 | | - get_auth_registry(), |
| 338 | + flow_instance_ctx.clone(), |
335 | 339 | ) |
336 | 340 | .await?, |
337 | 341 | ) |
@@ -618,16 +622,19 @@ pub struct SetupChangeBundle { |
618 | 622 | impl SetupChangeBundle { |
619 | 623 | async fn get_flow_setup_status<'a>( |
620 | 624 | setup_ctx: &LibSetupContext, |
621 | | - flow_name: &str, |
| 625 | + flow_ctx: &'a FlowContext, |
622 | 626 | flow_exec_ctx: &'a FlowExecutionContext, |
623 | 627 | action: &FlowSetupChangeAction, |
624 | 628 | buffer: &'a mut Option<FlowSetupStatus>, |
625 | 629 | ) -> Result<&'a FlowSetupStatus> { |
626 | 630 | let result = match action { |
627 | 631 | FlowSetupChangeAction::Setup => &flow_exec_ctx.setup_status, |
628 | 632 | FlowSetupChangeAction::Drop => { |
629 | | - let existing_state = setup_ctx.all_setup_states.flows.get(flow_name); |
630 | | - buffer.insert(check_flow_setup_status(None, existing_state).await?) |
| 633 | + let existing_state = setup_ctx.all_setup_states.flows.get(flow_ctx.flow_name()); |
| 634 | + buffer.insert( |
| 635 | + check_flow_setup_status(None, existing_state, &flow_ctx.flow.flow_instance_ctx) |
| 636 | + .await?, |
| 637 | + ) |
631 | 638 | } |
632 | 639 | }; |
633 | 640 | Ok(result) |
@@ -662,7 +669,7 @@ impl SetupChangeBundle { |
662 | 669 | let mut setup_status_buffer = None; |
663 | 670 | let setup_status = Self::get_flow_setup_status( |
664 | 671 | setup_ctx, |
665 | | - flow_name, |
| 672 | + &flow_ctx, |
666 | 673 | &flow_exec_ctx, |
667 | 674 | &self.action, |
668 | 675 | &mut setup_status_buffer, |
@@ -714,7 +721,7 @@ impl SetupChangeBundle { |
714 | 721 | let mut setup_status_buffer = None; |
715 | 722 | let setup_status = Self::get_flow_setup_status( |
716 | 723 | setup_ctx, |
717 | | - flow_name, |
| 724 | + &flow_ctx, |
718 | 725 | &flow_exec_ctx, |
719 | 726 | &self.action, |
720 | 727 | &mut setup_status_buffer, |
|
0 commit comments