mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-14 03:25:43 +00:00
followup: make ceph version handling more flexible
ceph has a bad reputation for chaging such minor things a few times, even during a stable release, and as here a bit more flexibillity cost exactly nothing let's do so and accept versions with one to arbitrary version levels Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
005e0a6091
commit
35306f4767
@ -108,7 +108,7 @@ Ext.define('PVE.Utils', { utilities: {
|
||||
}
|
||||
|
||||
if (service.ceph_version) {
|
||||
var match = service.ceph_version.match(/version (\d+\.\d+\.\d+)/);
|
||||
var match = service.ceph_version.match(/version (\d+(\.\d+)*)/);
|
||||
if (match) {
|
||||
return match[1];
|
||||
}
|
||||
@ -121,32 +121,26 @@ Ext.define('PVE.Utils', { utilities: {
|
||||
if (a === b) {
|
||||
return 0;
|
||||
}
|
||||
let avers = a.toString().split('.');
|
||||
let bvers = b.toString().split('.');
|
||||
|
||||
var match_a = a.toString().match(/^(\d+)\.(\d+).(\d+)$/);
|
||||
var match_b = b.toString().match(/^(\d+)\.(\d+).(\d+)$/);
|
||||
while (true) {
|
||||
let av = avers.shift();
|
||||
let bv = bvers.shift();
|
||||
|
||||
if (!match_a && !match_b) {
|
||||
// both versions invalid/undefined
|
||||
return 0;
|
||||
} else if(!match_a) {
|
||||
// a is undefined/invalid but b not
|
||||
return -1;
|
||||
} else if(!match_b) {
|
||||
// b is undefined/invalid but a not
|
||||
return 1;
|
||||
}
|
||||
|
||||
var i;
|
||||
for (i = 1; i <= 3; i++) {
|
||||
var ver_a = parseInt(match_a[i], 10);
|
||||
var ver_b = parseInt(match_b[i], 10);
|
||||
if (ver_a !== ver_b) {
|
||||
return ver_a - ver_b;
|
||||
if (av === undefined && bv === undefined) {
|
||||
return 0;
|
||||
} else if (av === undefined) {
|
||||
return -1;
|
||||
} else if (bv === undefined) {
|
||||
return 1;
|
||||
} else {
|
||||
let diff = parseInt(av, 10) - parseInt(bv, 10);
|
||||
if (diff != 0) return diff;
|
||||
// else we need to look at the next parts
|
||||
}
|
||||
}
|
||||
|
||||
// all parts were the same
|
||||
return 0;
|
||||
},
|
||||
|
||||
get_ceph_icon_html: function(health, fw) {
|
||||
|
Loading…
Reference in New Issue
Block a user