From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 0F60594314 for ; Wed, 21 Sep 2022 13:04:22 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 0182326C4A for ; Wed, 21 Sep 2022 13:04:22 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Wed, 21 Sep 2022 13:04:21 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id E358D442E8 for ; Wed, 21 Sep 2022 13:04:14 +0200 (CEST) From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= To: pve-devel@lists.proxmox.com Date: Wed, 21 Sep 2022 13:04:06 +0200 Message-Id: <20220921110407.2988743-1-f.gruenbichler@proxmox.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.147 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH proxmox-offline-mirror 1/2] helper: make mountpoint non-optional X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Sep 2022 11:04:22 -0000 the default/fallback was a remnant from a no-longer-employed "copy-helper-to-medium" deployment strategy. Signed-off-by: Fabian Grünbichler --- 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, + 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