diff options
author | Harald Musum <musum@yahooinc.com> | 2022-04-28 11:10:45 +0200 |
---|---|---|
committer | Harald Musum <musum@yahooinc.com> | 2022-04-28 11:10:45 +0200 |
commit | 72e78aa60bcecf4ea455357f077302fccb5d994b (patch) | |
tree | 2bd500bf632a3e710b52d2560394b289b64f5f13 | |
parent | 75faf2a651e1afb050aef9fb3d7e6ba99dda98b7 (diff) |
Throw a RuntimeException if no secret is found
-rw-r--r-- | configserver/src/main/java/com/yahoo/vespa/config/server/tenant/SecretStoreExternalIdRetriever.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/SecretStoreExternalIdRetriever.java b/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/SecretStoreExternalIdRetriever.java index a50f84b1579..e775d8d0124 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/SecretStoreExternalIdRetriever.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/SecretStoreExternalIdRetriever.java @@ -5,7 +5,6 @@ import com.yahoo.config.model.api.TenantSecretStore; import com.yahoo.config.provision.SystemName; import com.yahoo.config.provision.TenantName; import com.yahoo.container.jdisc.secretstore.SecretStore; - import java.util.List; import java.util.stream.Collectors; @@ -20,7 +19,10 @@ public class SecretStoreExternalIdRetriever { return tenantSecretStores.stream() .map(tenantSecretStore -> { var secretName = secretName(tenant, system, tenantSecretStore.getName()); - return tenantSecretStore.withExternalId(secretStore.getSecret(secretName)); + String secret = secretStore.getSecret(secretName); + if (secret == null) + throw new RuntimeException("No secret found in secret store for " + secretName); + return tenantSecretStore.withExternalId(secret); }) .collect(Collectors.toList()); } @@ -39,4 +41,5 @@ public class SecretStoreExternalIdRetriever { throw new IllegalArgumentException("No tenant secret store key group defined for system " + system); } } + } |