From 09af38781aae674b599013c5a3a995258d4adceb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Brachth=C3=A4user?= Date: Sat, 23 Sep 2023 01:15:38 +0200 Subject: [PATCH] Add fallback to metadata name for stack name The stack name used for Logging in and Updating now falls back to the metadata name if not specified explicitly in the pulumi_stack specification. This change is intended to prevent failure of these actions if stack name is not specified in pulumi_stack spec. --- pulumi-operator-kubernetes-job/src/pulumi_execution.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pulumi-operator-kubernetes-job/src/pulumi_execution.rs b/pulumi-operator-kubernetes-job/src/pulumi_execution.rs index b444615..8b12f95 100644 --- a/pulumi-operator-kubernetes-job/src/pulumi_execution.rs +++ b/pulumi-operator-kubernetes-job/src/pulumi_execution.rs @@ -140,6 +140,12 @@ impl PulumiExecution { } } + let stack_name = pulumi_stack + .spec + .stack_name + .clone() + .unwrap_or(pulumi_stack.metadata.name.clone().unwrap()); + pulumi .login(LoginOptions { url: inner_stack_auth.backend, @@ -148,13 +154,13 @@ impl PulumiExecution { pulumi .cancel(CancelOptions { - stack: pulumi_stack.spec.stack_name.clone(), + stack: Some(stack_name.clone()), }) .await; let exit = pulumi .up(UpOptions { - stack: pulumi_stack.spec.stack_name.clone(), + stack: Some(stack_name.clone()), ..Default::default() }) .await;