]> git.proxmox.com Git - proxmox.git/commitdiff
apt: split Ceph main repository into no-subscription and enterprise
authorFiona Ebner <f.ebner@proxmox.com>
Fri, 2 Jun 2023 08:48:21 +0000 (10:48 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Sat, 3 Jun 2023 12:39:05 +0000 (14:39 +0200)
The old 'main' component stays valid, pointing to no-subscription,
which means the is_referenced_repository() check needs a special case
for it. It will eventually go away, together with the handles for
Quincy.

Alternatively, the standard repository's info() could've been changed
to return multiple possible components, similar to URLs, but as
opposed to URLs, there could be a standard repository that wants to
have multiple components and it feels a bit unnatural, because
multiple components are usually not aliases of the same. And adapting
is_referenced_repository() would be needed here too. So overall, the
above alternative just felt better.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
proxmox-apt/src/repositories/mod.rs
proxmox-apt/src/repositories/repository.rs
proxmox-apt/src/repositories/standard.rs
proxmox-apt/tests/repositories.rs

index 11f52dd23f6ee5fb9e99a05028fdb6ed09c19969..b2e83a0c7d0ba9e926c80abfaccafc652a81de0c 100644 (file)
@@ -90,7 +90,8 @@ pub fn standard_repositories(
 
     if product == "pve" {
         result.append(&mut vec![
-            APTStandardRepository::from(APTRepositoryHandle::CephQuincy),
+            APTStandardRepository::from(APTRepositoryHandle::CephQuincyEnterprise),
+            APTStandardRepository::from(APTRepositoryHandle::CephQuincyNoSubscription),
             APTStandardRepository::from(APTRepositoryHandle::CephQuincyTest),
         ]);
     }
index a5e3015f5d3db547c9f9a81837257a64efd037b7..ba4e8b1de78d111fe806d3d1ba19c885ae84bf64 100644 (file)
@@ -285,11 +285,19 @@ impl APTRepository {
             found_uri = found_uri || handle_uris.iter().any(|handle_uri| handle_uri == uri);
         }
 
+        // In the past it was main instead of enterprise/no-subscription, and main now maps to
+        // no-subscription. Note this only applies for Quincy.
+        let found_component = if handle == APTRepositoryHandle::CephQuincyNoSubscription {
+            self.components.contains(&component) || self.components.contains(&"main".to_string())
+        } else {
+            self.components.contains(&component)
+        };
+
         self.types.contains(&package_type)
             && found_uri
             // using contains would require a &String
             && self.suites.iter().any(|self_suite| self_suite == suite)
-            && self.components.contains(&component)
+            && found_component
     }
 
     /// Guess the origin from the repository's URIs.
index 33c4842042907116d3aaca22f2c193e2cdac542c..2cae630fe82cb3bd5cff7333fd1db871961996eb 100644 (file)
@@ -46,8 +46,10 @@ pub enum APTRepositoryHandle {
     NoSubscription,
     /// The test repository.
     Test,
-    /// Ceph Quincy repository.
-    CephQuincy,
+    /// Ceph Quincy enterprise repository.
+    CephQuincyEnterprise,
+    /// Ceph Quincy no-subscription repository.
+    CephQuincyNoSubscription,
     /// Ceph Quincy test repository.
     CephQuincyTest,
 }
@@ -71,7 +73,8 @@ impl TryFrom<&str> for APTRepositoryHandle {
             "enterprise" => Ok(APTRepositoryHandle::Enterprise),
             "no-subscription" => Ok(APTRepositoryHandle::NoSubscription),
             "test" => Ok(APTRepositoryHandle::Test),
-            "ceph-quincy" => Ok(APTRepositoryHandle::CephQuincy),
+            "ceph-quincy-enterprise" => Ok(APTRepositoryHandle::CephQuincyEnterprise),
+            "ceph-quincy-no-subscription" => Ok(APTRepositoryHandle::CephQuincyNoSubscription),
             "ceph-quincy-test" => Ok(APTRepositoryHandle::CephQuincyTest),
             _ => bail!("unknown repository handle '{}'", string),
         }
@@ -84,7 +87,8 @@ impl Display for APTRepositoryHandle {
             APTRepositoryHandle::Enterprise => write!(f, "enterprise"),
             APTRepositoryHandle::NoSubscription => write!(f, "no-subscription"),
             APTRepositoryHandle::Test => write!(f, "test"),
-            APTRepositoryHandle::CephQuincy => write!(f, "ceph-quincy"),
+            APTRepositoryHandle::CephQuincyEnterprise => write!(f, "ceph-quincy-enterprise"),
+            APTRepositoryHandle::CephQuincyNoSubscription => write!(f, "ceph-quincy-no-subscription"),
             APTRepositoryHandle::CephQuincyTest => write!(f, "ceph-quincy-test"),
         }
     }
@@ -107,8 +111,13 @@ impl APTRepositoryHandle {
                 "This repository contains the latest packages and is primarily used for test labs \
                 and by developers to test new features."
             }
-            APTRepositoryHandle::CephQuincy => {
-                "This repository holds the main Proxmox Ceph Quincy packages."
+            APTRepositoryHandle::CephQuincyEnterprise => {
+                "This repository holds the production-ready Proxmox Ceph Quincy packages."
+            }
+            APTRepositoryHandle::CephQuincyNoSubscription => {
+                "This repository holds the Proxmox Ceph Quincy packages intended for \
+                non-production use. The deprecated 'main' repository is an alias for this in \
+                Proxmox VE 8."
             }
             APTRepositoryHandle::CephQuincyTest => {
                 "This repository contains the Ceph Quincy packages before they are moved to the \
@@ -124,7 +133,8 @@ impl APTRepositoryHandle {
             APTRepositoryHandle::Enterprise => "Enterprise",
             APTRepositoryHandle::NoSubscription => "No-Subscription",
             APTRepositoryHandle::Test => "Test",
-            APTRepositoryHandle::CephQuincy => "Ceph Quincy",
+            APTRepositoryHandle::CephQuincyEnterprise => "Ceph Quincy Enterprise",
+            APTRepositoryHandle::CephQuincyNoSubscription => "Ceph Quincy No-Subscription",
             APTRepositoryHandle::CephQuincyTest => "Ceph Quincy Test",
         }
         .to_string()
@@ -138,7 +148,8 @@ impl APTRepositoryHandle {
             }
             APTRepositoryHandle::NoSubscription => "/etc/apt/sources.list".to_string(),
             APTRepositoryHandle::Test => "/etc/apt/sources.list".to_string(),
-            APTRepositoryHandle::CephQuincy => "/etc/apt/sources.list.d/ceph.list".to_string(),
+            APTRepositoryHandle::CephQuincyEnterprise => "/etc/apt/sources.list.d/ceph.list".to_string(),
+            APTRepositoryHandle::CephQuincyNoSubscription => "/etc/apt/sources.list.d/ceph.list".to_string(),
             APTRepositoryHandle::CephQuincyTest => "/etc/apt/sources.list.d/ceph.list".to_string(),
         }
     }
@@ -181,10 +192,15 @@ impl APTRepositoryHandle {
                 },
                 format!("{}test", product),
             ),
-            APTRepositoryHandle::CephQuincy => (
+            APTRepositoryHandle::CephQuincyEnterprise => (
+                APTRepositoryPackageType::Deb,
+                vec!["https://enterprise.proxmox.com/debian/ceph-quincy".to_string()],
+                "enterprise".to_string(),
+            ),
+            APTRepositoryHandle::CephQuincyNoSubscription => (
                 APTRepositoryPackageType::Deb,
                 vec!["http://download.proxmox.com/debian/ceph-quincy".to_string()],
-                "main".to_string(),
+                "no-subscription".to_string(),
             ),
             APTRepositoryHandle::CephQuincyTest => (
                 APTRepositoryPackageType::Deb,
index ea714e6536005863f4ebc029756c122ac4e919cd..4b3c9de5847c9b826db2ce6608e0eb8e326f6bd2 100644 (file)
@@ -362,7 +362,8 @@ fn test_standard_repositories() -> Result<(), Error> {
         APTStandardRepository::from(APTRepositoryHandle::Enterprise),
         APTStandardRepository::from(APTRepositoryHandle::NoSubscription),
         APTStandardRepository::from(APTRepositoryHandle::Test),
-        APTStandardRepository::from(APTRepositoryHandle::CephQuincy),
+        APTStandardRepository::from(APTRepositoryHandle::CephQuincyEnterprise),
+        APTStandardRepository::from(APTRepositoryHandle::CephQuincyNoSubscription),
         APTStandardRepository::from(APTRepositoryHandle::CephQuincyTest),
     ];