]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: fix server view on funny version format
authorJohn Spray <john.spray@redhat.com>
Thu, 8 Jun 2017 12:06:12 +0000 (08:06 -0400)
committerJohn Spray <john.spray@redhat.com>
Thu, 8 Jun 2017 15:43:20 +0000 (11:43 -0400)
Signed-off-by: John Spray <john.spray@redhat.com>
src/pybind/mgr/dashboard/servers.html

index 81a93e787c69f200926b354302371fbcd5609db8..301bca24bbe120819e27a442aa0ca6ea56256f2b 100644 (file)
             };
 
             rivets.formatters.short_version = function(version) {
-                // Turn "ceph version 1.2.3-g9asdasd (as98d7a0s8d7)"
-                // into "1.2.3-g9asdasd"
-                return /ceph version (.+) \(.+\)$/.exec(version)[1];
+                // Expect "ceph version 1.2.3-g9asdasd (as98d7a0s8d7)"
+                var result = /ceph version\s+([^ ]+)\s+\(.+\)/.exec(version);
+                if (result) {
+                    // Return the "1.2.3-g9asdasd" part
+                    return result[1];
+                } else {
+                    // Unexpected format, pass it through
+                    return version;
+                }
+                return 
             };
 
             rivets.bind($("#content"), content_data);
@@ -74,4 +81,4 @@
     </div>
 </section>
 
-{% endblock %}
\ No newline at end of file
+{% endblock %}