public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH pve-manager] vzdump: add error if passed in hook script doesn't exist
@ 2022-04-28 14:57 Dylan Whyte
  2022-04-28 16:44 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Dylan Whyte @ 2022-04-28 14:57 UTC (permalink / raw)
  To: pve-devel

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





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

* [pve-devel] applied: [PATCH pve-manager] vzdump: add error if passed in hook script doesn't exist
  2022-04-28 14:57 [pve-devel] [PATCH pve-manager] vzdump: add error if passed in hook script doesn't exist Dylan Whyte
@ 2022-04-28 16:44 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2022-04-28 16:44 UTC (permalink / raw)
  To: Proxmox VE development discussion, Dylan Whyte

On 28.04.22 16:57, Dylan Whyte wrote:
> 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(-)
> 
>

applied, thanks!




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

end of thread, other threads:[~2022-04-28 16:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-28 14:57 [pve-devel] [PATCH pve-manager] vzdump: add error if passed in hook script doesn't exist Dylan Whyte
2022-04-28 16:44 ` [pve-devel] applied: " Thomas Lamprecht

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