From f215aad2bc850ea6f86c7aed24c2177aadaffff6 Mon Sep 17 00:00:00 2001 From: Carl Andersson Date: Tue, 21 Oct 2025 13:39:46 +0200 Subject: [PATCH] helm: Same imroved error reporting as importyaml --- helm.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/helm.nix b/helm.nix index ed3c527..7a321b0 100644 --- a/helm.nix +++ b/helm.nix @@ -51,6 +51,7 @@ in type = types.listOf settingsFormat.type; default = [ ]; }; + # Do we really need this here? Doesn't Helm take care of this? overrideNamespace = lib.mkOption { description = "Override namespace for all namespaced resources"; type = types.nullOr types.str; @@ -128,8 +129,10 @@ in resource: let namespaced = - globalConfig.kubernetes.namespacedMappings.${resource.kind} or throw - "kind ${resource.kind} doesn't have a namespacedMapping"; + if lib.hasAttr resource.kind globalConfig.kubernetes.namespacedMappings then + globalConfig.kubernetes.namespacedMappings.${resource.kind} + else + throw "kind ${resource.kind} doesn't have a namespacedMapping"; in if namespaced then lib.recursiveUpdate resource { metadata.namespace = config.overrideNamespace; }