From 8e515a1dcd27f3e6f63eca9563a12c199049f898 Mon Sep 17 00:00:00 2001 From: oscarzhou Date: Fri, 12 Apr 2024 10:14:25 +1200 Subject: [PATCH] fix(stack): auto update not work when stack creator is removed --- api/stacks/deployments/deploy.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/api/stacks/deployments/deploy.go b/api/stacks/deployments/deploy.go index 58ef025a9..7b764b928 100644 --- a/api/stacks/deployments/deploy.go +++ b/api/stacks/deployments/deploy.go @@ -90,7 +90,12 @@ func redeployWhenChanged(stack *portainer.Stack, deployer StackDeployer, datasto Int("endpoint_id", int(stack.EndpointID)). Msg("cannot auto update a stack, stack author user is missing") - return &StackAuthorMissingErr{int(stack.ID), author} + // If the stack creator is deleted, the stack should still remain capable of + // updating automatically. + if !datastore.IsErrObjectNotFound(err) { + // only return error when it's not ErrObjectNotFound + return &StackAuthorMissingErr{int(stack.ID), author} + } } if !isEnvironmentOnline(endpoint) {