]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: change the readFile to readFileSync 44956/head
authorNizamudeen A <nia@redhat.com>
Wed, 9 Feb 2022 15:36:16 +0000 (21:06 +0530)
committerNizamudeen A <nia@redhat.com>
Wed, 9 Feb 2022 16:38:09 +0000 (22:08 +0530)
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 <nia@redhat.com>
src/pybind/mgr/dashboard/frontend/applitools.config.js

index be93a0050c9f1b8f9bb20b40dad3260351b55b65..4aaedf23e5aecdf057eb7a3c875d696cd67420d8 100644 (file)
@@ -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',
   batchId: process.env.APPLITOOLS_BATCH_ID,