From: Nizamudeen A Date: Wed, 9 Feb 2022 15:36:16 +0000 (+0530) Subject: mgr/dashboard: change the readFile to readFileSync X-Git-Tag: v16.2.8~201^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a5ee21c10a868c8e91a6fd5e8240602e2b28dd25;p=ceph.git 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) --- 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,