[pve-devel] [PATCH pve-manager] vzdump: add error if passed in hook script doesn't exist
Dylan Whyte
d.whyte at proxmox.com
Thu Apr 28 16:57:06 CEST 2022
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 at 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
More information about the pve-devel
mailing list