public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH widget-toolkit 4/5] apt repositories: detect mixed suites before major upgrade
Date: Mon,  5 Jun 2023 17:43:12 +0200	[thread overview]
Message-ID: <20230605154313.181289-6-f.ebner@proxmox.com> (raw)
In-Reply-To: <20230605154313.181289-1-f.ebner@proxmox.com>

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 <f.ebner@proxmox.com>
---
 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





  parent reply	other threads:[~2023-06-05 15:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-05 15:43 [pve-devel] [PATCH-SERIES proxmox-apt/widget-toolkit] prepare for " Fiona Ebner
2023-06-05 15:43 ` [pve-devel] [PATCH stable proxmox-apt 1/1] repositories: also detect repository with next suite as configured Fiona Ebner
2023-06-09  8:45   ` Wolfgang Bumiller
2023-06-09  8:49     ` Fiona Ebner
2023-06-09  9:59       ` [pve-devel] applied: " Wolfgang Bumiller
2023-06-05 15:43 ` [pve-devel] [PATCH widget-toolkit 1/5] apt repositories: actually ignore ignore-pre-upgrade-warning Fiona Ebner
2023-06-05 15:43 ` [pve-devel] [PATCH/RFC widget-toolkit 2/5] apt repositories: just ignore unknown info rather than throwing an error Fiona Ebner
2023-06-05 17:06   ` Thomas Lamprecht
2023-06-06  6:27     ` Fiona Ebner
2023-06-05 15:43 ` [pve-devel] [PATCH widget-toolkit 3/5] apt repositories: add classifyOrigin helper Fiona Ebner
2023-06-05 15:43 ` Fiona Ebner [this message]
2023-06-05 15:43 ` [pve-devel] [PATCH stable-bullseye widget-toolkit 5/5] apt repositoires: allow major upgrade Fiona Ebner
2023-06-07 15:23 ` [pve-devel] applied-series: [PATCH-SERIES proxmox-apt/widget-toolkit] prepare for " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230605154313.181289-6-f.ebner@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal