From 3515e98a5365d47337f9e8f0a0185f1ca0c676f1 Mon Sep 17 00:00:00 2001 From: Rhys Howell Date: Wed, 5 Aug 2020 12:01:49 +0200 Subject: [PATCH 1/2] Use getGenuineMongoDB and isEnterprise from mongodb-build-info --- lib/instance-detail-helper.js | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/lib/instance-detail-helper.js b/lib/instance-detail-helper.js index ce8797c6..caefc2fb 100644 --- a/lib/instance-detail-helper.js +++ b/lib/instance-detail-helper.js @@ -63,13 +63,12 @@ function parseBuildInfo(resp) { query_engine: resp.queryEngine ? resp.queryEngine : null, raw: resp // Save the raw output to later determine if genuine MongoDB }; - // cover both cases of detecting enterprise module, see SERVER-18099 - if (resp.gitVersion && resp.gitVersion.match(/enterprise/)) { - res.enterprise_module = true; - } - if (resp.modules && resp.modules.indexOf('enterprise') !== -1) { + + // Cover both cases of detecting enterprise module, see SERVER-18099. + if (getMongoDBBuildInfo.isEnterprise(resp)) { res.enterprise_module = true; } + return res; } @@ -121,22 +120,16 @@ function getGenuineMongoDB(results, done) { cmdLineOpts ); + const { + isGenuine, + serverName + } = getMongoDBBuildInfo.getGenuineMongoDB(buildInfo, cmdLineOpts); + const res = { - isGenuine: true, - dbType: 'mongodb' + isGenuine, + dbType: serverName }; - if (buildInfo.hasOwnProperty('_t')) { - res.isGenuine = false; - res.dbType = 'cosmosdb'; - } - if ( - cmdLineOpts.hasOwnProperty('errmsg') && - cmdLineOpts.errmsg.indexOf('not supported') !== -1 - ) { - res.isGenuine = false; - res.dbType = 'documentdb'; - } done(null, res); } From e21e7eed76fb27ff2ff44559e06e81717187446a Mon Sep 17 00:00:00 2001 From: Rhys Howell Date: Wed, 5 Aug 2020 12:12:34 +0200 Subject: [PATCH 2/2] Improve build info creation --- lib/instance-detail-helper.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/instance-detail-helper.js b/lib/instance-detail-helper.js index caefc2fb..7b3b4ec8 100644 --- a/lib/instance-detail-helper.js +++ b/lib/instance-detail-helper.js @@ -59,16 +59,11 @@ function parseBuildInfo(resp) { debug: resp.debug, for_bits: resp.bits, max_bson_object_size: resp.maxBsonObjectSize, - enterprise_module: false, + enterprise_module: getMongoDBBuildInfo.isEnterprise(resp), // Cover both cases of detecting enterprise module, see SERVER-18099. query_engine: resp.queryEngine ? resp.queryEngine : null, raw: resp // Save the raw output to later determine if genuine MongoDB }; - // Cover both cases of detecting enterprise module, see SERVER-18099. - if (getMongoDBBuildInfo.isEnterprise(resp)) { - res.enterprise_module = true; - } - return res; }