From a5ee21c10a868c8e91a6fd5e8240602e2b28dd25 Mon Sep 17 00:00:00 2001 From: Nizamudeen A Date: Wed, 9 Feb 2022 21:06:16 +0530 Subject: [PATCH] mgr/dashboard: change the readFile to readFileSync Apparently the readFile i added in #44934 is async and that's not what we want. so changing it to the synchronous call that is readFileSync Fixes: https://tracker.ceph.com/issues/54190 Signed-off-by: Nizamudeen A (cherry picked from commit cbfdd551d9c1e67c2757056ac1119c058f4aa704) --- src/pybind/mgr/dashboard/frontend/applitools.config.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/pybind/mgr/dashboard/frontend/applitools.config.js b/src/pybind/mgr/dashboard/frontend/applitools.config.js index eaced06107114..2bf52651ec2c9 100644 --- a/src/pybind/mgr/dashboard/frontend/applitools.config.js +++ b/src/pybind/mgr/dashboard/frontend/applitools.config.js @@ -1,12 +1,9 @@ -const fs = require('fs') -var branch = new String(); +const fs = require('fs'); // Read the contents of the ceph_release file to retrieve // the branch -fs.readFile('../../../../ceph_release', (_, data) => { - branch = data.toString().split('\n')[1]; -}); - +const cephRelease = fs.readFileSync('../../../../ceph_release', 'utf8').split('\n'); +const branch = cephRelease[2] === 'dev' ? 'master' : cephRelease[1]; module.exports = { appName: 'Ceph Dashboard', apiKey: process.env.APPLITOOLS_API_KEY, -- 2.39.5