all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Christoph Heiss <c.heiss@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [PATCH proxmox] rest-server: throw meaningful error if template file does not exist
Date: Fri, 26 Jun 2026 11:32:22 +0200	[thread overview]
Message-ID: <20260626093248.271176-1-c.heiss@proxmox.com> (raw)

Otherwise, users just fail on startup while constructing an `ApiConfig`
instance, with this pretty unhelpful error message:

  Error: No such file or directory (os error 2)

Give some context to make it easier to trace down these errors in the
future.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
Noticed this while building the latest master of
proxmox-datacenter-manager, which requires a new template as of

  60a1c406 ("server: add and serve template for novnc")

.. but the corresponding package hasn't been bumped yet.

 proxmox-rest-server/src/api_config.rs | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/proxmox-rest-server/src/api_config.rs b/proxmox-rest-server/src/api_config.rs
index 6c5c0aea..2f590018 100644
--- a/proxmox-rest-server/src/api_config.rs
+++ b/proxmox-rest-server/src/api_config.rs
@@ -421,6 +421,10 @@ mod templates {
             }
 
             let path: PathBuf = path.into();
+            if !path.exists() {
+                bail!("template file not found: {}", path.display());
+            }
+
             let metadata = metadata(&path)?;
             let mtime = metadata.modified()?;
 
-- 
2.54.0





                 reply	other threads:[~2026-06-26  9:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260626093248.271176-1-c.heiss@proxmox.com \
    --to=c.heiss@proxmox.com \
    --cc=pdm-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal