From 5f33c932decda9988544ba41559bd57c0a27f81e Mon Sep 17 00:00:00 2001 From: despire Date: Tue, 26 Sep 2023 09:26:22 +0200 Subject: [PATCH] fix error handling --- services/builder/domain/usecases/workflow_helpers.go | 3 +++ .../kube-eleven/server/domain/utils/kube-eleven/kube_eleven.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/services/builder/domain/usecases/workflow_helpers.go b/services/builder/domain/usecases/workflow_helpers.go index 7d9c68901..181ebcb01 100644 --- a/services/builder/domain/usecases/workflow_helpers.go +++ b/services/builder/domain/usecases/workflow_helpers.go @@ -96,6 +96,8 @@ func (u *Usecases) saveWorkflowDescription(ctx *utils.BuilderContext, descriptio // deleteConfig calls destroy config to remove all traces of infrastructure from given config. func (u *Usecases) deleteConfig(config *pb.Config, clusterView *cutils.ClusterView, cboxClient pb.ContextBoxServiceClient) error { + log := cutils.CreateLoggerWithProjectName(config.Name) + var err error // Try maxDeleteRetry to delete the config. for i := 0; i < maxDeleteRetry; i++ { @@ -103,6 +105,7 @@ func (u *Usecases) deleteConfig(config *pb.Config, clusterView *cutils.ClusterVi // Deletion successful, break here. break } + log.Err(err).Msg("failed to destroy config") } return err } diff --git a/services/kube-eleven/server/domain/utils/kube-eleven/kube_eleven.go b/services/kube-eleven/server/domain/utils/kube-eleven/kube_eleven.go index c432f0625..6a329940c 100644 --- a/services/kube-eleven/server/domain/utils/kube-eleven/kube_eleven.go +++ b/services/kube-eleven/server/domain/utils/kube-eleven/kube_eleven.go @@ -100,7 +100,7 @@ func (k *KubeEleven) DestroyCluster() error { } if err := kubeone.Reset(clusterID); err != nil { - return fmt.Errorf("error while running \"kubeone reset\" in %s: %w", k.outputDirectory, err) + log.Warn().Msgf("failed to destroy cluster and remove binaries: %s, assuming they were deleted", err) } if err := os.RemoveAll(k.outputDirectory); err != nil {