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 { APTStandardRepository {
handle: APTRepositoryHandle::Enterprise, handle: APTRepositoryHandle::Enterprise,
status: None, status: None,
name: APTRepositoryHandle::Enterprise.name(product), name: APTRepositoryHandle::Enterprise.name(),
}, },
APTStandardRepository { APTStandardRepository {
handle: APTRepositoryHandle::NoSubscription, handle: APTRepositoryHandle::NoSubscription,
status: None, status: None,
name: APTRepositoryHandle::NoSubscription.name(product), name: APTRepositoryHandle::NoSubscription.name(),
}, },
APTStandardRepository { APTStandardRepository {
handle: APTRepositoryHandle::Test, handle: APTRepositoryHandle::Test,
status: None, status: None,
name: APTRepositoryHandle::Test.name(product), name: APTRepositoryHandle::Test.name(),
}, },
]; ];
@ -102,22 +102,22 @@ pub fn standard_repositories(
APTStandardRepository { APTStandardRepository {
handle: APTRepositoryHandle::CephPacific, handle: APTRepositoryHandle::CephPacific,
status: None, status: None,
name: APTRepositoryHandle::CephPacific.name(product), name: APTRepositoryHandle::CephPacific.name(),
}, },
APTStandardRepository { APTStandardRepository {
handle: APTRepositoryHandle::CephPacificTest, handle: APTRepositoryHandle::CephPacificTest,
status: None, status: None,
name: APTRepositoryHandle::CephPacificTest.name(product), name: APTRepositoryHandle::CephPacificTest.name(),
}, },
APTStandardRepository { APTStandardRepository {
handle: APTRepositoryHandle::CephOctopus, handle: APTRepositoryHandle::CephOctopus,
status: None, status: None,
name: APTRepositoryHandle::CephOctopus.name(product), name: APTRepositoryHandle::CephOctopus.name(),
}, },
APTStandardRepository { APTStandardRepository {
handle: APTRepositoryHandle::CephOctopusTest, handle: APTRepositoryHandle::CephOctopusTest,
status: None, status: None,
name: APTRepositoryHandle::CephOctopusTest.name(product), name: APTRepositoryHandle::CephOctopusTest.name(),
}, },
]); ]);
} }

View File

@ -87,20 +87,17 @@ impl Display for APTRepositoryHandle {
impl APTRepositoryHandle { impl APTRepositoryHandle {
/// Get the full name of the repository. /// Get the full name of the repository.
pub fn name(self, product: &str) -> String { pub fn name(self) -> String {
match self { match self {
APTRepositoryHandle::Enterprise => { APTRepositoryHandle::Enterprise => "Enterprise Repository",
format!("{} Enterprise Repository", product.to_uppercase()) APTRepositoryHandle::NoSubscription => "No-Subscription Repository",
} APTRepositoryHandle::Test => "Test Repository",
APTRepositoryHandle::NoSubscription => { APTRepositoryHandle::CephPacific => "Ceph Pacific Repository",
format!("{} No-Subscription Repository", product.to_uppercase()) APTRepositoryHandle::CephPacificTest => "Ceph Pacific Test Repository",
} APTRepositoryHandle::CephOctopus => "Ceph Octopus Repository",
APTRepositoryHandle::Test => format!("{} Test Repository", product.to_uppercase()), APTRepositoryHandle::CephOctopusTest => "Ceph Octopus Test Repository",
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(),
} }
.to_string()
} }
/// Get the standard file path for the repository referenced by the handle. /// 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 { APTStandardRepository {
handle: APTRepositoryHandle::Enterprise, handle: APTRepositoryHandle::Enterprise,
status: None, status: None,
name: APTRepositoryHandle::Enterprise.name("pve"), name: APTRepositoryHandle::Enterprise.name(),
}, },
APTStandardRepository { APTStandardRepository {
handle: APTRepositoryHandle::NoSubscription, handle: APTRepositoryHandle::NoSubscription,
status: None, status: None,
name: APTRepositoryHandle::NoSubscription.name("pve"), name: APTRepositoryHandle::NoSubscription.name(),
}, },
APTStandardRepository { APTStandardRepository {
handle: APTRepositoryHandle::Test, handle: APTRepositoryHandle::Test,
status: None, status: None,
name: APTRepositoryHandle::Test.name("pve"), name: APTRepositoryHandle::Test.name(),
}, },
APTStandardRepository { APTStandardRepository {
handle: APTRepositoryHandle::CephPacific, handle: APTRepositoryHandle::CephPacific,
status: None, status: None,
name: APTRepositoryHandle::CephPacific.name("pve"), name: APTRepositoryHandle::CephPacific.name(),
}, },
APTStandardRepository { APTStandardRepository {
handle: APTRepositoryHandle::CephPacificTest, handle: APTRepositoryHandle::CephPacificTest,
status: None, status: None,
name: APTRepositoryHandle::CephPacificTest.name("pve"), name: APTRepositoryHandle::CephPacificTest.name(),
}, },
APTStandardRepository { APTStandardRepository {
handle: APTRepositoryHandle::CephOctopus, handle: APTRepositoryHandle::CephOctopus,
status: None, status: None,
name: APTRepositoryHandle::CephOctopus.name("pve"), name: APTRepositoryHandle::CephOctopus.name(),
}, },
APTStandardRepository { APTStandardRepository {
handle: APTRepositoryHandle::CephOctopusTest, handle: APTRepositoryHandle::CephOctopusTest,
status: None, 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); 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]); assert_eq!(&std_repos, &expected[0..=2]);
expected[0].status = Some(false); expected[0].status = Some(false);
expected[1].status = Some(true); 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); let std_repos = standard_repositories("pve", &file_vec);