]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: change the readFile to readFileSync 44935/head
authorNizamudeen A <nia@redhat.com>
Wed, 9 Feb 2022 15:36:16 +0000 (21:06 +0530)
committerNizamudeen A <nia@redhat.com>
Thu, 10 Feb 2022 06:00:03 +0000 (11:30 +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>
(cherry picked from commit cbfdd551d9c1e67c2757056ac1119c058f4aa704)

src/pybind/mgr/dashboard/frontend/applitools.config.js

index eaced061071143517e82764294dba4fe5f5fb5ab..2bf52651ec2c9fc7ff6a4baaa8f796744d864c9a 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',
   apiKey: process.env.APPLITOOLS_API_KEY,