public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH proxmox-offline-mirror 1/2] wizard: code reformat
@ 2025-09-09  9:01 Fabian Grünbichler
  2025-09-09  9:01 ` [pve-devel] [PATCH proxmox-offline-mirror 2/2] wizard: simplify Proxmox URL generation Fabian Grünbichler
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Fabian Grünbichler @ 2025-09-09  9:01 UTC (permalink / raw)
  To: pve-devel

otherwise the next patch would add another level of indentation here via
rustfmt..

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
 src/bin/proxmox-offline-mirror.rs | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/bin/proxmox-offline-mirror.rs b/src/bin/proxmox-offline-mirror.rs
index 8fd8415..265129f 100644
--- a/src/bin/proxmox-offline-mirror.rs
+++ b/src/bin/proxmox-offline-mirror.rs
@@ -197,10 +197,8 @@ fn action_add_mirror(config: &SectionConfigData) -> Result<Vec<MirrorConfig>, Er
     let mut use_subscription = None;
     let mut extra_repos = Vec::new();
 
-    let (repository, key_path, architectures, suggested_id, skip) = if read_bool_from_tty(
-        "Guided Setup",
-        Some(true),
-    )? {
+    let guided = read_bool_from_tty("Guided Setup", Some(true))?;
+    let (repository, key_path, architectures, suggested_id, skip) = if guided {
         let distros = &[
             (Distro::Pve, "Proxmox VE"),
             (Distro::Pbs, "Proxmox Backup Server"),
-- 
2.47.3



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pve-devel] [PATCH proxmox-offline-mirror 2/2] wizard: simplify Proxmox URL generation
  2025-09-09  9:01 [pve-devel] [PATCH proxmox-offline-mirror 1/2] wizard: code reformat Fabian Grünbichler
@ 2025-09-09  9:01 ` Fabian Grünbichler
  2025-09-09  9:27 ` [pve-devel] [PATCH proxmox-offline-mirror 1/2] wizard: code reformat Shannon Sterz
  2025-09-09 11:04 ` [pve-devel] applied-series: " Fabian Grünbichler
  2 siblings, 0 replies; 4+ messages in thread
From: Fabian Grünbichler @ 2025-09-09  9:01 UTC (permalink / raw)
  To: pve-devel

this also changes the suggested ID for no-subscription mirrors, but in a way
that actually makes it more consistent, since `_` is used as delimiter between
fields, and `no-subscription` is a single field, not two fields.

Suggested-by: Shannon Sterz <s.sterz@proxmox.com>
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
 src/bin/proxmox-offline-mirror.rs | 63 +++++++++++++------------------
 1 file changed, 27 insertions(+), 36 deletions(-)

diff --git a/src/bin/proxmox-offline-mirror.rs b/src/bin/proxmox-offline-mirror.rs
index 265129f..b3b8cda 100644
--- a/src/bin/proxmox-offline-mirror.rs
+++ b/src/bin/proxmox-offline-mirror.rs
@@ -104,12 +104,23 @@ impl Display for ProxmoxVariant {
     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         match self {
             ProxmoxVariant::Enterprise => write!(f, "enterprise"),
-            ProxmoxVariant::NoSubscription => write!(f, "no_subscription"),
+            ProxmoxVariant::NoSubscription => write!(f, "no-subscription"),
             ProxmoxVariant::Test => write!(f, "test"),
         }
     }
 }
 
+impl ProxmoxVariant {
+    fn base_url(&self) -> &str {
+        match self {
+            ProxmoxVariant::Enterprise => "https://enterprise.proxmox.com/debian",
+            ProxmoxVariant::NoSubscription | ProxmoxVariant::Test => {
+                "http://download.proxmox.com/debian"
+            }
+        }
+    }
+}
+
 fn derive_debian_repo(
     release: &Release,
     variant: &DebianVariant,
@@ -285,26 +296,19 @@ fn action_add_mirror(config: &SectionConfigData) -> Result<Vec<MirrorConfig>, Er
                             Some(0),
                         )?;
 
-                        match variant {
-                            ProxmoxVariant::Enterprise => {
-                                use_subscription = Some(ProductType::Pve);
-                                (
-                                    "https://enterprise.proxmox.com/debian/ceph",
-                                    "enterprise".to_string(),
-                                )
-                            }
-                            ProxmoxVariant::NoSubscription => (
-                                "http://download.proxmox.com/debian/ceph",
-                                "no-subscription".to_string(),
-                            ),
-                            ProxmoxVariant::Test => (
-                                "http://download.proxmox.com/debian/ceph",
-                                "test".to_string(),
-                            ),
+                        if variant == &ProxmoxVariant::Enterprise {
+                            use_subscription = Some(ProductType::Pve);
                         }
+                        (
+                            format!("{url}/{dist}", url = variant.base_url()),
+                            variant.to_string(),
+                        )
                     } else {
                         (
-                            "http://download.proxmox.com/debian/ceph",
+                            format!(
+                                "{url}/{dist}",
+                                url = ProxmoxVariant::NoSubscription.base_url()
+                            ),
                             read_string_from_tty("Enter repository components", Some("main test"))?,
                         )
                     };
@@ -335,24 +339,11 @@ fn action_add_mirror(config: &SectionConfigData) -> Result<Vec<MirrorConfig>, Er
                     read_selection_from_tty("Select repository variant", variants, Some(0))?;
 
                 // TODO enterprise query for key!
-                let url = match variant {
-                    ProxmoxVariant::Enterprise => format!(
-                        "https://enterprise.proxmox.com/debian/{product} {release} {product}-enterprise"
-                    ),
-                    ProxmoxVariant::NoSubscription => format!(
-                        "http://download.proxmox.com/debian/{product} {release} {product}-no-subscription"
-                    ),
-                    ProxmoxVariant::Test => {
-                        if release >= &Release::Trixie {
-                            format!(
-                                "http://download.proxmox.com/debian/{product} {release} {product}-test"
-                            )
-                        } else {
-                            format!(
-                                "http://download.proxmox.com/debian/{product} {release} {product}test"
-                            )
-                        }
-                    }
+                let base_url = variant.base_url();
+                let url = if variant == &ProxmoxVariant::Test && release < &Release::Trixie {
+                    format!("{base_url}/{product} {release} {product}{variant}")
+                } else {
+                    format!("{base_url}/{product} {release} {product}-{variant}")
                 };
 
                 use_subscription = match (product, variant) {
-- 
2.47.3



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [pve-devel] [PATCH proxmox-offline-mirror 1/2] wizard: code reformat
  2025-09-09  9:01 [pve-devel] [PATCH proxmox-offline-mirror 1/2] wizard: code reformat Fabian Grünbichler
  2025-09-09  9:01 ` [pve-devel] [PATCH proxmox-offline-mirror 2/2] wizard: simplify Proxmox URL generation Fabian Grünbichler
@ 2025-09-09  9:27 ` Shannon Sterz
  2025-09-09 11:04 ` [pve-devel] applied-series: " Fabian Grünbichler
  2 siblings, 0 replies; 4+ messages in thread
From: Shannon Sterz @ 2025-09-09  9:27 UTC (permalink / raw)
  To: Proxmox VE development discussion, Fabian Grünbichler

On Tue Sep 9, 2025 at 11:01 AM CEST, Fabian Grünbichler wrote:

both patches here look good to me so consider them:

Reviewed-by: Shannon Sterz <s.sterz@proxmox.com>


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pve-devel] applied-series: [PATCH proxmox-offline-mirror 1/2] wizard: code reformat
  2025-09-09  9:01 [pve-devel] [PATCH proxmox-offline-mirror 1/2] wizard: code reformat Fabian Grünbichler
  2025-09-09  9:01 ` [pve-devel] [PATCH proxmox-offline-mirror 2/2] wizard: simplify Proxmox URL generation Fabian Grünbichler
  2025-09-09  9:27 ` [pve-devel] [PATCH proxmox-offline-mirror 1/2] wizard: code reformat Shannon Sterz
@ 2025-09-09 11:04 ` Fabian Grünbichler
  2 siblings, 0 replies; 4+ messages in thread
From: Fabian Grünbichler @ 2025-09-09 11:04 UTC (permalink / raw)
  To: Proxmox VE development discussion

with Shannon's R-B

On September 9, 2025 11:01 am, Fabian Grünbichler wrote:
> otherwise the next patch would add another level of indentation here via
> rustfmt..
> 
> Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
> ---
>  src/bin/proxmox-offline-mirror.rs | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/src/bin/proxmox-offline-mirror.rs b/src/bin/proxmox-offline-mirror.rs
> index 8fd8415..265129f 100644
> --- a/src/bin/proxmox-offline-mirror.rs
> +++ b/src/bin/proxmox-offline-mirror.rs
> @@ -197,10 +197,8 @@ fn action_add_mirror(config: &SectionConfigData) -> Result<Vec<MirrorConfig>, Er
>      let mut use_subscription = None;
>      let mut extra_repos = Vec::new();
>  
> -    let (repository, key_path, architectures, suggested_id, skip) = if read_bool_from_tty(
> -        "Guided Setup",
> -        Some(true),
> -    )? {
> +    let guided = read_bool_from_tty("Guided Setup", Some(true))?;
> +    let (repository, key_path, architectures, suggested_id, skip) = if guided {
>          let distros = &[
>              (Distro::Pve, "Proxmox VE"),
>              (Distro::Pbs, "Proxmox Backup Server"),
> -- 
> 2.47.3
> 
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-09-09 11:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-09  9:01 [pve-devel] [PATCH proxmox-offline-mirror 1/2] wizard: code reformat Fabian Grünbichler
2025-09-09  9:01 ` [pve-devel] [PATCH proxmox-offline-mirror 2/2] wizard: simplify Proxmox URL generation Fabian Grünbichler
2025-09-09  9:27 ` [pve-devel] [PATCH proxmox-offline-mirror 1/2] wizard: code reformat Shannon Sterz
2025-09-09 11:04 ` [pve-devel] applied-series: " Fabian Grünbichler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal