all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Dylan Whyte <d.whyte@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH pve-manager] vzdump: add error if passed in hook script doesn't exist
Date: Thu, 28 Apr 2022 16:57:06 +0200	[thread overview]
Message-ID: <20220428145706.274322-1-d.whyte@proxmox.com> (raw)

Previously, if the '--script' argument was passed with a non-existent
file, it would state that a non-executable script was the reason for
failure. This adds a check to see if the hook script exists, in order
to provide a more accurate error message.

Also adds an 'Error:' prefix the 'script not executable' error.

Signed-off-by: Dylan Whyte <d.whyte@proxmox.com>
---
 PVE/VZDump.pm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm
index 80cbddb5..16e3e888 100644
--- a/PVE/VZDump.pm
+++ b/PVE/VZDump.pm
@@ -669,8 +669,12 @@ sub run_hook_script {
     my $script = $opts->{script};
     return if !$script;
 
+    if (!-f $script) {
+	die "Error: The hook script '$script' does not exist.\n";
+    }
+
     if (!-x $script) {
-	die "The hook script '$script' is not executable.\n";
+	die "Error: The hook script '$script' is not executable.\n";
     }
 
     my $cmd = [$script, $phase];
-- 
2.30.2





             reply	other threads:[~2022-04-28 14:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-28 14:57 Dylan Whyte [this message]
2022-04-28 16:44 ` [pve-devel] applied: " 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=20220428145706.274322-1-d.whyte@proxmox.com \
    --to=d.whyte@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 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