From e6a7571a94dd4bee36d5af60ef99a5c210811901 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Knut=20G=C3=B6tz?= Date: Fri, 10 Nov 2023 15:44:33 +0100 Subject: [PATCH] Don't swallow errors when uninstalling FluxCD MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Knut Götz --- cmd/flux/uninstall.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/cmd/flux/uninstall.go b/cmd/flux/uninstall.go index 0128a833..58b4fa73 100644 --- a/cmd/flux/uninstall.go +++ b/cmd/flux/uninstall.go @@ -90,16 +90,24 @@ func uninstallCmdRun(cmd *cobra.Command, args []string) error { } logger.Actionf("deleting components in %s namespace", *kubeconfigArgs.Namespace) - uninstall.Components(ctx, logger, kubeClient, *kubeconfigArgs.Namespace, uninstallArgs.dryRun) + if err := uninstall.Components(ctx, logger, kubeClient, *kubeconfigArgs.Namespace, uninstallArgs.dryRun); err != nil { + return err + } logger.Actionf("deleting toolkit.fluxcd.io finalizers in all namespaces") - uninstall.Finalizers(ctx, logger, kubeClient, uninstallArgs.dryRun) + if err := uninstall.Finalizers(ctx, logger, kubeClient, uninstallArgs.dryRun); err != nil { + return err + } logger.Actionf("deleting toolkit.fluxcd.io custom resource definitions") - uninstall.CustomResourceDefinitions(ctx, logger, kubeClient, uninstallArgs.dryRun) + if err := uninstall.CustomResourceDefinitions(ctx, logger, kubeClient, uninstallArgs.dryRun); err != nil { + return err + } if !uninstallArgs.keepNamespace { - uninstall.Namespace(ctx, logger, kubeClient, *kubeconfigArgs.Namespace, uninstallArgs.dryRun) + if err := uninstall.Namespace(ctx, logger, kubeClient, *kubeconfigArgs.Namespace, uninstallArgs.dryRun); err != nil { + return err + } } logger.Successf("uninstall finished")