standard repos: drop product acronym from repo name

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
Fabian Ebner 2021-06-30 12:20:18 +02:00 committed by Thomas Lamprecht
parent 87ea23ec83
commit 3f7152383b
3 changed files with 23 additions and 33 deletions

View File

@ -83,17 +83,17 @@ pub fn standard_repositories(
APTStandardRepository {
handle: APTRepositoryHandle::Enterprise,
status: None,
name: APTRepositoryHandle::Enterprise.name(product),
name: APTRepositoryHandle::Enterprise.name(),
},
APTStandardRepository {
handle: APTRepositoryHandle::NoSubscription,
status: None,
name: APTRepositoryHandle::NoSubscription.name(product),
name: APTRepositoryHandle::NoSubscription.name(),
},
APTStandardRepository {
handle: APTRepositoryHandle::Test,
status: None,
name: APTRepositoryHandle::Test.name(product),
name: APTRepositoryHandle::Test.name(),
},
];
@ -102,22 +102,22 @@ pub fn standard_repositories(
APTStandardRepository {
handle: APTRepositoryHandle::CephPacific,
status: None,
name: APTRepositoryHandle::CephPacific.name(product),
name: APTRepositoryHandle::CephPacific.name(),
},
APTStandardRepository {
handle: APTRepositoryHandle::CephPacificTest,
status: None,
name: APTRepositoryHandle::CephPacificTest.name(product),
name: APTRepositoryHandle::CephPacificTest.name(),
},
APTStandardRepository {
handle: APTRepositoryHandle::CephOctopus,
status: None,
name: APTRepositoryHandle::CephOctopus.name(product),
name: APTRepositoryHandle::CephOctopus.name(),
},
APTStandardRepository {
handle: APTRepositoryHandle::CephOctopusTest,
status: None,
name: APTRepositoryHandle::CephOctopusTest.name(product),
name: APTRepositoryHandle::CephOctopusTest.name(),
},
]);
}

View File

@ -87,20 +87,17 @@ impl Display for APTRepositoryHandle {
impl APTRepositoryHandle {
/// Get the full name of the repository.
pub fn name(self, product: &str) -> String {
pub fn name(self) -> String {
match self {
APTRepositoryHandle::Enterprise => {
format!("{} Enterprise Repository", product.to_uppercase())
}
APTRepositoryHandle::NoSubscription => {
format!("{} No-Subscription Repository", product.to_uppercase())
}
APTRepositoryHandle::Test => format!("{} Test Repository", product.to_uppercase()),
APTRepositoryHandle::CephPacific => "PVE Ceph Pacific Repository".to_string(),
APTRepositoryHandle::CephPacificTest => "PVE Ceph Pacific Test Repository".to_string(),
APTRepositoryHandle::CephOctopus => "PVE Ceph Octopus Repository".to_string(),
APTRepositoryHandle::CephOctopusTest => "PVE Ceph Octopus Test Repository".to_string(),
APTRepositoryHandle::Enterprise => "Enterprise Repository",
APTRepositoryHandle::NoSubscription => "No-Subscription Repository",
APTRepositoryHandle::Test => "Test Repository",
APTRepositoryHandle::CephPacific => "Ceph Pacific Repository",
APTRepositoryHandle::CephPacificTest => "Ceph Pacific Test Repository",
APTRepositoryHandle::CephOctopus => "Ceph Octopus Repository",
APTRepositoryHandle::CephOctopusTest => "Ceph Octopus Test Repository",
}
.to_string()
}
/// Get the standard file path for the repository referenced by the handle.

View File

@ -320,37 +320,37 @@ fn test_standard_repositories() -> Result<(), Error> {
APTStandardRepository {
handle: APTRepositoryHandle::Enterprise,
status: None,
name: APTRepositoryHandle::Enterprise.name("pve"),
name: APTRepositoryHandle::Enterprise.name(),
},
APTStandardRepository {
handle: APTRepositoryHandle::NoSubscription,
status: None,
name: APTRepositoryHandle::NoSubscription.name("pve"),
name: APTRepositoryHandle::NoSubscription.name(),
},
APTStandardRepository {
handle: APTRepositoryHandle::Test,
status: None,
name: APTRepositoryHandle::Test.name("pve"),
name: APTRepositoryHandle::Test.name(),
},
APTStandardRepository {
handle: APTRepositoryHandle::CephPacific,
status: None,
name: APTRepositoryHandle::CephPacific.name("pve"),
name: APTRepositoryHandle::CephPacific.name(),
},
APTStandardRepository {
handle: APTRepositoryHandle::CephPacificTest,
status: None,
name: APTRepositoryHandle::CephPacificTest.name("pve"),
name: APTRepositoryHandle::CephPacificTest.name(),
},
APTStandardRepository {
handle: APTRepositoryHandle::CephOctopus,
status: None,
name: APTRepositoryHandle::CephOctopus.name("pve"),
name: APTRepositoryHandle::CephOctopus.name(),
},
APTStandardRepository {
handle: APTRepositoryHandle::CephOctopusTest,
status: None,
name: APTRepositoryHandle::CephOctopusTest.name("pve"),
name: APTRepositoryHandle::CephOctopusTest.name(),
},
];
@ -370,17 +370,10 @@ fn test_standard_repositories() -> Result<(), Error> {
let std_repos = standard_repositories("pbs", &file_vec);
expected[0].name = APTRepositoryHandle::Enterprise.name("pbs");
expected[1].name = APTRepositoryHandle::NoSubscription.name("pbs");
expected[2].name = APTRepositoryHandle::Test.name("pbs");
assert_eq!(&std_repos, &expected[0..=2]);
expected[0].status = Some(false);
expected[1].status = Some(true);
expected[0].name = APTRepositoryHandle::Enterprise.name("pve");
expected[1].name = APTRepositoryHandle::NoSubscription.name("pve");
expected[2].name = APTRepositoryHandle::Test.name("pve");
let std_repos = standard_repositories("pve", &file_vec);