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 <[email protected]> --- 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 _______________________________________________ pve-devel mailing list [email protected] https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
