From 424ea21300779c9c170ca52a9a3aadc26d40b427 Mon Sep 17 00:00:00 2001 From: Alvaro Vega Date: Tue, 26 Sep 2023 08:25:18 +0200 Subject: [PATCH] check if trust is found in configTrust ad log it --- lib/models/keystone.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/models/keystone.js b/lib/models/keystone.js index 81281cf9..2833a8eb 100644 --- a/lib/models/keystone.js +++ b/lib/models/keystone.js @@ -34,7 +34,13 @@ function getToken(trust, callback) { const host = config.authentication.host; const port = config.authentication.port; var trustConf = configTrust.trusts.find((item) => item.id === trust); - + // check trust was found or log it + if (!trustConf) { + logger.error('Trust [%s] not found in configTrust file', trust); + callback(new errors.TokenRetrievalError(trust, + 'trust not found' + trust) + ); + } var options = { url: 'http://' + host + ':' + port + '/v3/auth/tokens', method: 'POST',