apt: add Ceph Reef to standard repo list

For now just duplicate the Ceph Quincy entries, as I want to avoid
using macros and we do not yet have support for enums inside enums
with the api macro.

Adapt and expand the tests slightly to have at least some simple
coverage there too.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2023-09-04 17:14:19 +02:00
parent 767582a2eb
commit 1e47036528
5 changed files with 90 additions and 3 deletions

View File

@ -94,6 +94,13 @@ pub fn standard_repositories(
APTStandardRepository::from(APTRepositoryHandle::CephQuincyNoSubscription),
APTStandardRepository::from(APTRepositoryHandle::CephQuincyTest),
]);
if suite == DebianCodename::Bookworm {
result.append(&mut vec![
APTStandardRepository::from(APTRepositoryHandle::CephReefEnterprise),
APTStandardRepository::from(APTRepositoryHandle::CephReefNoSubscription),
APTStandardRepository::from(APTRepositoryHandle::CephReefTest),
]);
}
}
for file in files.iter() {

View File

@ -52,6 +52,14 @@ pub enum APTRepositoryHandle {
CephQuincyNoSubscription,
/// Ceph Quincy test repository.
CephQuincyTest,
// TODO: Add separate enum for ceph releases and use something like
// `CephTest(CephReleaseCodename),` once the API macro supports it.
/// Ceph Reef enterprise repository.
CephReefEnterprise,
/// Ceph Reef no-subscription repository.
CephReefNoSubscription,
/// Ceph Reef test repository.
CephReefTest,
}
impl From<APTRepositoryHandle> for APTStandardRepository {
@ -76,6 +84,9 @@ impl TryFrom<&str> for APTRepositoryHandle {
"ceph-quincy-enterprise" => Ok(APTRepositoryHandle::CephQuincyEnterprise),
"ceph-quincy-no-subscription" => Ok(APTRepositoryHandle::CephQuincyNoSubscription),
"ceph-quincy-test" => Ok(APTRepositoryHandle::CephQuincyTest),
"ceph-reef-enterprise" => Ok(APTRepositoryHandle::CephReefEnterprise),
"ceph-reef-no-subscription" => Ok(APTRepositoryHandle::CephReefNoSubscription),
"ceph-reef-test" => Ok(APTRepositoryHandle::CephReefTest),
_ => bail!("unknown repository handle '{}'", string),
}
}
@ -92,6 +103,9 @@ impl Display for APTRepositoryHandle {
write!(f, "ceph-quincy-no-subscription")
}
APTRepositoryHandle::CephQuincyTest => write!(f, "ceph-quincy-test"),
APTRepositoryHandle::CephReefEnterprise => write!(f, "ceph-reef-enterprise"),
APTRepositoryHandle::CephReefNoSubscription => write!(f, "ceph-reef-no-subscription"),
APTRepositoryHandle::CephReefTest => write!(f, "ceph-reef-test"),
}
}
}
@ -125,6 +139,18 @@ impl APTRepositoryHandle {
"This repository contains the Ceph Quincy packages before they are moved to the \
main repository."
}
APTRepositoryHandle::CephReefEnterprise => {
"This repository holds the production-ready Proxmox Ceph Reef packages."
}
APTRepositoryHandle::CephReefNoSubscription => {
"This repository holds the Proxmox Ceph Reef packages intended for \
non-production use. The deprecated 'main' repository is an alias for this in \
Proxmox VE 8."
}
APTRepositoryHandle::CephReefTest => {
"This repository contains the Ceph Reef packages before they are moved to the \
main repository."
}
}
.to_string()
}
@ -138,6 +164,9 @@ impl APTRepositoryHandle {
APTRepositoryHandle::CephQuincyEnterprise => "Ceph Quincy Enterprise",
APTRepositoryHandle::CephQuincyNoSubscription => "Ceph Quincy No-Subscription",
APTRepositoryHandle::CephQuincyTest => "Ceph Quincy Test",
APTRepositoryHandle::CephReefEnterprise => "Ceph Reef Enterprise",
APTRepositoryHandle::CephReefNoSubscription => "Ceph Reef No-Subscription",
APTRepositoryHandle::CephReefTest => "Ceph Reef Test",
}
.to_string()
}
@ -152,7 +181,10 @@ impl APTRepositoryHandle {
APTRepositoryHandle::Test => "/etc/apt/sources.list".to_string(),
APTRepositoryHandle::CephQuincyEnterprise
| APTRepositoryHandle::CephQuincyNoSubscription
| APTRepositoryHandle::CephQuincyTest => "/etc/apt/sources.list.d/ceph.list".to_string(),
| APTRepositoryHandle::CephQuincyTest
| APTRepositoryHandle::CephReefEnterprise
| APTRepositoryHandle::CephReefNoSubscription
| APTRepositoryHandle::CephReefTest => "/etc/apt/sources.list.d/ceph.list".to_string(),
}
}
@ -209,6 +241,21 @@ impl APTRepositoryHandle {
vec!["http://download.proxmox.com/debian/ceph-quincy".to_string()],
"test".to_string(),
),
APTRepositoryHandle::CephReefEnterprise => (
APTRepositoryPackageType::Deb,
vec!["https://enterprise.proxmox.com/debian/ceph-reef".to_string()],
"enterprise".to_string(),
),
APTRepositoryHandle::CephReefNoSubscription => (
APTRepositoryPackageType::Deb,
vec!["http://download.proxmox.com/debian/ceph-reef".to_string()],
"no-subscription".to_string(),
),
APTRepositoryHandle::CephReefTest => (
APTRepositoryPackageType::Deb,
vec!["http://download.proxmox.com/debian/ceph-reef".to_string()],
"test".to_string(),
),
}
}

View File

@ -361,6 +361,9 @@ fn test_standard_repositories() -> Result<(), Error> {
APTStandardRepository::from(APTRepositoryHandle::CephQuincyEnterprise),
APTStandardRepository::from(APTRepositoryHandle::CephQuincyNoSubscription),
APTStandardRepository::from(APTRepositoryHandle::CephQuincyTest),
APTStandardRepository::from(APTRepositoryHandle::CephReefEnterprise),
APTStandardRepository::from(APTRepositoryHandle::CephReefNoSubscription),
APTStandardRepository::from(APTRepositoryHandle::CephReefTest),
];
let absolute_suite_list = read_dir.join("absolute_suite.list");
@ -369,6 +372,14 @@ fn test_standard_repositories() -> Result<(), Error> {
let std_repos = standard_repositories(&[file], "pve", DebianCodename::Bullseye);
assert_eq!(std_repos, &expected[0..=5]);
let absolute_suite_list = read_dir.join("absolute_suite.list");
let mut file = APTRepositoryFile::new(&absolute_suite_list)?.unwrap();
file.parse()?;
let std_repos = standard_repositories(&[file], "pve", DebianCodename::Bookworm);
assert_eq!(std_repos, expected);
let pve_list = read_dir.join("pve.list");
@ -386,7 +397,7 @@ fn test_standard_repositories() -> Result<(), Error> {
let std_repos = standard_repositories(&file_vec, "pve", DebianCodename::Bullseye);
assert_eq!(std_repos, expected);
assert_eq!(std_repos, &expected[0..=5]);
let pve_alt_list = read_dir.join("pve-alt.list");
let mut file = APTRepositoryFile::new(&pve_alt_list)?.unwrap();
@ -398,7 +409,7 @@ fn test_standard_repositories() -> Result<(), Error> {
let std_repos = standard_repositories(&[file], "pve", DebianCodename::Bullseye);
assert_eq!(std_repos, expected);
assert_eq!(std_repos, &expected[0..=5]);
let pve_alt_list = read_dir.join("ceph-quincy-bookworm.list");
let mut file = APTRepositoryFile::new(&pve_alt_list)?.unwrap();
@ -430,6 +441,24 @@ fn test_standard_repositories() -> Result<(), Error> {
assert_eq!(std_repos, expected);
let pve_alt_list = read_dir.join("ceph-reef-enterprise-bookworm.list");
let mut file = APTRepositoryFile::new(&pve_alt_list)?.unwrap();
file.parse()?;
expected[0].status = None;
expected[1].status = None;
expected[2].status = None;
expected[3].status = None;
expected[4].status = None;
expected[5].status = None;
expected[6].status = Some(true);
expected[7].status = None;
expected[8].status = None;
let std_repos = standard_repositories(&[file], "pve", DebianCodename::Bookworm);
assert_eq!(std_repos, expected);
Ok(())
}

View File

@ -0,0 +1,2 @@
deb https://enterprise.proxmox.com/debian/ceph-reef bookworm enterprise

View File

@ -0,0 +1,2 @@
deb https://enterprise.proxmox.com/debian/ceph-reef bookworm enterprise