From: John Spray Date: Thu, 8 Jun 2017 12:06:12 +0000 (-0400) Subject: mgr/dashboard: fix server view on funny version format X-Git-Tag: v12.1.0~220^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f175090596f1115be5c8a243ff95a317d829f4e9;p=ceph.git mgr/dashboard: fix server view on funny version format Signed-off-by: John Spray --- diff --git a/src/pybind/mgr/dashboard/servers.html b/src/pybind/mgr/dashboard/servers.html index 81a93e787c6..301bca24bbe 100644 --- a/src/pybind/mgr/dashboard/servers.html +++ b/src/pybind/mgr/dashboard/servers.html @@ -24,9 +24,16 @@ }; 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 @@ -{% endblock %} \ No newline at end of file +{% endblock %}