public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH proxmox-offline-mirror 1/2] helper: make mountpoint non-optional
Date: Wed, 21 Sep 2022 13:04:06 +0200	[thread overview]
Message-ID: <20220921110407.2988743-1-f.gruenbichler@proxmox.com> (raw)

the default/fallback was a remnant from a no-longer-employed
"copy-helper-to-medium" deployment strategy.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
technically breaking, but the default/fallback of /usr/bin was bogus
anyway..

 src/bin/proxmox-offline-mirror-helper.rs | 31 +++---------------------
 1 file changed, 3 insertions(+), 28 deletions(-)

diff --git a/src/bin/proxmox-offline-mirror-helper.rs b/src/bin/proxmox-offline-mirror-helper.rs
index af090a5..4efb343 100644
--- a/src/bin/proxmox-offline-mirror-helper.rs
+++ b/src/bin/proxmox-offline-mirror-helper.rs
@@ -64,16 +64,7 @@ async fn setup(_param: Value) -> Result<(), Error> {
         bail!("Setup wizard can only run interactively.");
     }
 
-    let default_dir = std::env::current_exe().map_or_else(
-        |_| None,
-        |mut p| {
-            p.pop();
-            let p = p.to_str();
-            p.map(str::to_string)
-        },
-    );
-
-    let mountpoint = read_string_from_tty("Path to medium mountpoint", default_dir.as_deref())?;
+    let mountpoint = read_string_from_tty("Path to medium mountpoint", None)?;
     let mountpoint = Path::new(&mountpoint);
     if !mountpoint.exists() {
         bail!("Medium mountpoint doesn't exist.");
@@ -267,8 +258,7 @@ async fn setup(_param: Value) -> Result<(), Error> {
         properties: {
             mountpoint: {
                 type: String,
-                optional: true,
-                description: "Path to medium mountpoint - defaults to `proxmox-offline-mirror-helper` containing directory.",
+                description: "Path to medium mountpoint",
             },
             product: {
                 type: ProductType,
@@ -278,7 +268,7 @@ async fn setup(_param: Value) -> Result<(), Error> {
 )]
 /// Configures and offline subscription key
 async fn setup_offline_key(
-    mountpoint: Option<String>,
+    mountpoint: String,
     product: ProductType,
     _param: Value,
 ) -> Result<(), Error> {
@@ -289,21 +279,6 @@ async fn setup_offline_key(
         );
     }
 
-    let mountpoint = mountpoint
-        .or_else(|| {
-            std::env::current_exe().map_or_else(
-                |_| None,
-                |mut p| {
-                    p.pop();
-                    let p = p.to_str();
-                    p.map(str::to_string)
-                },
-            )
-        })
-        .ok_or_else(|| {
-            format_err!("Failed to determine fallback mountpoint via executable path.")
-        })?;
-
     let mountpoint = Path::new(&mountpoint);
     if !mountpoint.exists() {
         bail!("Medium mountpoint doesn't exist.");
-- 
2.30.2





             reply	other threads:[~2022-09-21 11:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-21 11:04 Fabian Grünbichler [this message]
2022-09-21 11:04 ` [pve-devel] [PATCH proxmox-offline-mirror 2/2] helper: add status command Fabian Grünbichler
2022-10-21 11:03 ` [pve-devel] applied-series: [PATCH proxmox-offline-mirror 1/2] helper: make mountpoint non-optional Wolfgang Bumiller

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=20220921110407.2988743-1-f.gruenbichler@proxmox.com \
    --to=f.gruenbichler@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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal