From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH proxmox-apt 3/3] standard repos: drop product acronym from repo name
Date: Wed, 30 Jun 2021 12:20:18 +0200 [thread overview]
Message-ID: <20210630102019.39057-4-f.ebner@proxmox.com> (raw)
In-Reply-To: <20210630102019.39057-1-f.ebner@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
src/repositories/mod.rs | 14 +++++++-------
src/repositories/standard.rs | 21 +++++++++------------
tests/repositories.rs | 21 +++++++--------------
3 files changed, 23 insertions(+), 33 deletions(-)
diff --git a/src/repositories/mod.rs b/src/repositories/mod.rs
index eba65f4..e2b0b6b 100644
--- a/src/repositories/mod.rs
+++ b/src/repositories/mod.rs
@@ -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(),
},
]);
}
diff --git a/src/repositories/standard.rs b/src/repositories/standard.rs
index 2a29852..dcfe85b 100644
--- a/src/repositories/standard.rs
+++ b/src/repositories/standard.rs
@@ -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.
diff --git a/tests/repositories.rs b/tests/repositories.rs
index 3265bce..fefc608 100644
--- a/tests/repositories.rs
+++ b/tests/repositories.rs
@@ -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);
--
2.30.2
next prev parent reply other threads:[~2021-06-30 10:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-30 10:20 [pve-devel] [PATCH-SERIES proxmox-apt/proxmox-widget-toolkit] APT repos: Use Origin property instead of "official host" Fabian Ebner
2021-06-30 10:20 ` [pve-devel] [PATCH proxmox-apt 1/3] add get_cached_origin method and an initial config module Fabian Ebner
2021-06-30 10:20 ` [pve-devel] [PATCH proxmox-apt 2/3] check: return 'origin' property instead of 'badge' for official host Fabian Ebner
2021-06-30 10:20 ` Fabian Ebner [this message]
2021-06-30 10:20 ` [pve-devel] [PATCH proxmox-widget-toolkit 1/1] apt repositories: replace OfficialHost with Origin Fabian Ebner
2021-06-30 11:42 ` [pve-devel] applied-series: [PATCH-SERIES proxmox-apt/proxmox-widget-toolkit] APT repos: Use Origin property instead of "official host" Thomas Lamprecht
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=20210630102019.39057-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox