From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 547929DA1B for ; Mon, 5 Jun 2023 17:43:24 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 374512A50B for ; Mon, 5 Jun 2023 17:43:24 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Mon, 5 Jun 2023 17:43:23 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id F3B7648AB2 for ; Mon, 5 Jun 2023 17:43:22 +0200 (CEST) From: Fiona Ebner To: pve-devel@lists.proxmox.com Date: Mon, 5 Jun 2023 17:43:12 +0200 Message-Id: <20230605154313.181289-6-f.ebner@proxmox.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230605154313.181289-1-f.ebner@proxmox.com> References: <20230605154313.181289-1-f.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.048 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pve-devel] [PATCH widget-toolkit 4/5] apt repositories: detect mixed suites before major upgrade X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jun 2023 15:43:24 -0000 Usually, differing suites already produce warnings/errors, but before a major upgrade the current and the next suite are both valid. Mixing them is an issue though. Signed-off-by: Fiona Ebner --- src/node/APTRepositories.js | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/src/node/APTRepositories.js b/src/node/APTRepositories.js index 5971bd8..cba9271 100644 --- a/src/node/APTRepositories.js +++ b/src/node/APTRepositories.js @@ -460,6 +460,7 @@ Ext.define('Proxmox.node.APTRepositories', { let nosubscription = vm.get('noSubscriptionRepo'); let test = vm.get('testRepo'); let wrongSuites = vm.get('suitesWarning'); + let mixedSuites = vm.get('mixedSuites'); if (!enterprise && !nosubscription && !test) { addCritical( @@ -477,6 +478,10 @@ Ext.define('Proxmox.node.APTRepositories', { addWarn(gettext('Some suites are misconfigured')); } + if (mixedSuites) { + addWarn(gettext('Detected mixed suites before upgrade')); + } + if (!activeSubscription && enterprise) { addWarn(gettext('The enterprise repository is enabled, but there is no active subscription!')); } @@ -507,6 +512,7 @@ Ext.define('Proxmox.node.APTRepositories', { product: 'Proxmox VE', // default errors: [], suitesWarning: false, + mixedSuites: false, // used before major upgrade subscriptionActive: '', noSubscriptionRepo: '', enterpriseRepo: '', @@ -641,6 +647,11 @@ Ext.define('Proxmox.node.APTRepositories', { let digest; let suitesWarning = false; + // Usually different suites will give errors anyways, but before a major upgrade the + // current and the next suite are allowed, so it makes sense to check for mixed suites. + let checkMixedSuites = false; + let mixedSuites = false; + if (success && records.length > 0) { let data = records[0].data; let files = data.files; @@ -659,6 +670,9 @@ Ext.define('Proxmox.node.APTRepositories', { infos[path][idx] = { origin: '', warnings: [], + // Used as a heuristic to detect mixed repositories pre-upgrade. The + // warning is set on all repositories that do configure the next suite. + gotIgnorePreUpgradeWarning: false, }; } @@ -667,8 +681,11 @@ Ext.define('Proxmox.node.APTRepositories', { } else if (info.kind === 'warning') { infos[path][idx].warnings.push(info); } else if (info.kind === 'ignore-pre-upgrade-warning') { + infos[path][idx].gotIgnorePreUpgradeWarning = true; if (!repoGrid.majorUpgradeAllowed) { infos[path][idx].warnings.push(info); + } else { + checkMixedSuites = true; } } } @@ -683,8 +700,21 @@ Ext.define('Proxmox.node.APTRepositories', { repo.Origin = infos[file.path][n].origin || Proxmox.Utils.UnknownText; repo.warnings = infos[file.path][n].warnings || []; - if (repo.Enabled && repo.warnings.some(w => w.property === 'Suites')) { - suitesWarning = true; + if (repo.Enabled) { + if (repo.warnings.some(w => w.property === 'Suites')) { + suitesWarning = true; + } + + let originType = me.classifyOrigin(repo.Origin); + // Only Proxmox and Debian repositories checked here, because the + // warning can be missing for others for a different reason (e.g. + // using 'stable' or non-Debian code names). + if (checkMixedSuites && repo.Types.includes('deb') && + (originType === 'Proxmox' || originType === 'Debian') && + !infos[file.path][n].gotIgnorePreUpgradeWarning + ) { + mixedSuites = true; + } } } gridData.push(repo); @@ -700,6 +730,7 @@ Ext.define('Proxmox.node.APTRepositories', { vm.set('errors', errors); vm.set('suitesWarning', suitesWarning); + vm.set('mixedSuites', mixedSuites); me.getController().updateState(); }); -- 2.39.2