From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [RFC proxmox-apt 3/3] repository check: check components for Proxmox repositories
Date: Mon, 5 Jul 2021 15:50:30 +0200 [thread overview]
Message-ID: <20210705135033.101390-4-f.ebner@proxmox.com> (raw)
In-Reply-To: <20210705135033.101390-1-f.ebner@proxmox.com>
for no-subscription and test, which is currently done directly in the
front-end.
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
src/repositories/file.rs | 34 +++++++++++++++++++++++---
src/repositories/mod.rs | 4 +--
tests/repositories.rs | 23 ++++++++++++++---
tests/sources.list.d.expected/pve.list | 2 ++
tests/sources.list.d/pve.list | 1 +
5 files changed, 55 insertions(+), 9 deletions(-)
diff --git a/src/repositories/file.rs b/src/repositories/file.rs
index b5bdb77..83bccf1 100644
--- a/src/repositories/file.rs
+++ b/src/repositories/file.rs
@@ -298,8 +298,8 @@ impl APTRepositoryFile {
Ok(())
}
- /// Checks if old or unstable suites are configured, and also tries to
- /// determine the origin of each repository.
+ /// Checks if old or unstable suites or components are configured, and also
+ /// tries to determine the origin of each repository.
pub fn check(&self) -> Result<Vec<APTRepositoryInfo>, Error> {
let mut infos = vec![];
@@ -327,11 +327,11 @@ impl APTRepositoryFile {
continue;
}
- let mut add_info = |kind, message| {
+ let mut add_info = |property, kind, message| {
infos.push(APTRepositoryInfo {
path: self.path.clone(),
index: n,
- property: Some("Suites".to_string()),
+ property,
kind,
message,
})
@@ -351,6 +351,7 @@ impl APTRepositoryFile {
if repo.has_suite_variant(suite) {
if n < current_index {
add_info(
+ Some("Suites".to_string()),
"warning".to_string(),
format!("old suite '{}' configured!", suite),
);
@@ -358,6 +359,7 @@ impl APTRepositoryFile {
if n == current_index + 1 {
add_info(
+ Some("Suites".to_string()),
"ignore-pre-upgrade-warning".to_string(),
format!("suite '{}' should not be used in production!", suite),
);
@@ -365,6 +367,7 @@ impl APTRepositoryFile {
if n > current_index + 1 {
add_info(
+ Some("Suites".to_string()),
"warning".to_string(),
format!("suite '{}' should not be used in production!", suite),
);
@@ -376,10 +379,33 @@ impl APTRepositoryFile {
&& repo.has_suite_variant("stable")
{
add_info(
+ Some("Suites".to_string()),
"warning".to_string(),
"use the name of the stable distribution instead of 'stable'!".to_string(),
);
}
+
+ if origin != Some("Proxmox".to_string()) {
+ continue;
+ }
+
+ for component in repo.components.iter() {
+ if component.ends_with("no-subscription") {
+ add_info(
+ Some("Components".to_string()),
+ "warning".to_string(),
+ "The no-subscription repository is NOT production-ready".to_string(),
+ );
+ }
+
+ if component.ends_with("test") {
+ add_info(
+ Some("Components".to_string()),
+ "warning".to_string(),
+ "The test repository may contain unstable updates".to_string(),
+ );
+ }
+ }
}
Ok(infos)
diff --git a/src/repositories/mod.rs b/src/repositories/mod.rs
index 6dd07f0..e5dea03 100644
--- a/src/repositories/mod.rs
+++ b/src/repositories/mod.rs
@@ -43,8 +43,8 @@ fn common_digest(files: &[APTRepositoryFile]) -> [u8; 32] {
openssl::sha::sha256(&common_raw[..])
}
-/// Currently checks if old or unstable suites are configured, and also tries to
-/// determine the origin of each repository.
+/// Currently checks if old or unstable suites and components are configured,
+/// and also tries to determine the origin of each repository.
///
/// For problems, the kind of info will be `warning` for enabled repositories
/// and `info` for disabled repositories. For the origin, the kind is `origin`.
diff --git a/tests/repositories.rs b/tests/repositories.rs
index 67b0255..940cd06 100644
--- a/tests/repositories.rs
+++ b/tests/repositories.rs
@@ -197,11 +197,26 @@ fn test_check_repositories() -> Result<(), Error> {
let path_string = pve_list.into_os_string().into_string().unwrap();
let origins = [
- "Debian", "Debian", "Proxmox", "Proxmox", "Proxmox", "Debian",
+ "Debian", "Debian", "Proxmox", "Proxmox", "Proxmox", "Proxmox", "Debian",
];
- let mut expected_infos = vec![];
- for n in 0..=5 {
+ let mut expected_infos = vec![
+ APTRepositoryInfo {
+ path: path_string.clone(),
+ index: 2,
+ property: Some("Components".to_string()),
+ kind: "warning".to_string(),
+ message: "The no-subscription repository is NOT production-ready".to_string(),
+ },
+ APTRepositoryInfo {
+ path: path_string.clone(),
+ index: 3,
+ property: Some("Components".to_string()),
+ kind: "warning".to_string(),
+ message: "The test repository may contain unstable updates".to_string(),
+ },
+ ];
+ for n in 0..=6 {
expected_infos.push(APTRepositoryInfo {
path: path_string.clone(),
index: n,
@@ -304,6 +319,7 @@ fn test_get_cached_origin() -> Result<(), Error> {
Some("Debian".to_string()),
Some("Debian".to_string()),
Some("Proxmox".to_string()),
+ Some("Proxmox".to_string()),
None, // no cache file exists
None, // no cache file exists
Some("Debian".to_string()),
@@ -353,6 +369,7 @@ fn test_standard_repositories() -> Result<(), Error> {
expected[0].status = Some(false);
expected[1].status = Some(true);
+ expected[2].status = Some(false);
let std_repos = standard_repositories("pve", &file_vec);
diff --git a/tests/sources.list.d.expected/pve.list b/tests/sources.list.d.expected/pve.list
index c801261..a30566b 100644
--- a/tests/sources.list.d.expected/pve.list
+++ b/tests/sources.list.d.expected/pve.list
@@ -6,6 +6,8 @@ deb http://ftp.debian.org/debian bullseye-updates main contrib
# NOT recommended for production use
deb http://download.proxmox.com/debian/pve bullseye pve-no-subscription
+# deb http://download.proxmox.com/debian/pve bullseye pvetest
+
# deb https://enterprise.proxmox.com/debian/pve bullseye pve-enterprise
deb-src https://enterprise.proxmox.com/debian/pve buster pve-enterprise
diff --git a/tests/sources.list.d/pve.list b/tests/sources.list.d/pve.list
index 4d36d3d..1dfc857 100644
--- a/tests/sources.list.d/pve.list
+++ b/tests/sources.list.d/pve.list
@@ -4,6 +4,7 @@ deb http://ftp.debian.org/debian bullseye-updates main contrib
# PVE pve-no-subscription repository provided by proxmox.com,
# NOT recommended for production use
deb http://download.proxmox.com/debian/pve bullseye pve-no-subscription
+# deb http://download.proxmox.com/debian/pve bullseye pvetest
# deb https://enterprise.proxmox.com/debian/pve bullseye pve-enterprise
deb-src https://enterprise.proxmox.com/debian/pve buster pve-enterprise
--
2.30.2
next prev parent reply other threads:[~2021-07-05 13:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-05 13:50 [pve-devel] [PATCH-SERIES apt/widget-toolkit/manager] small refinements for APT repositories Fabian Ebner
2021-07-05 13:50 ` [pve-devel] [PATCH proxmox-apt 1/3] code cleanup: use contains() Fabian Ebner
2021-07-16 14:19 ` [pve-devel] applied: " Thomas Lamprecht
2021-07-05 13:50 ` [pve-devel] [PATCH proxmox-apt 2/3] repository check: limit 'stable' to Proxmox and Debian origin Fabian Ebner
2021-07-05 13:50 ` Fabian Ebner [this message]
2021-07-05 13:50 ` [pve-devel] [PATCH proxmox-widget-toolkit 1/2] node: repos: properly ignore warnings for other properties Fabian Ebner
2021-07-05 13:50 ` [pve-devel] [RFC proxmox-widget-toolkit 2/2] node: repos: show components warnings from the backend Fabian Ebner
2021-07-05 13:50 ` [pve-devel] [PATCH manager 1/1] api: apt: repositories: add description to return schema Fabian Ebner
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=20210705135033.101390-4-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal