mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-03-03 14:52:21 +02:00
Error when specified vm is invalid.
This commit is contained in:
parent
a52faf83a5
commit
e06db21e35
@ -13,6 +13,7 @@ use Carp qw(confess);
|
||||
use Exporter qw(import);
|
||||
our @EXPORT = qw();
|
||||
|
||||
use pgBackRest::Common::Exception;
|
||||
use pgBackRest::Common::Log;
|
||||
use pgBackRest::DbVersion;
|
||||
|
||||
@ -496,6 +497,21 @@ foreach my $strPgVersion (versionSupport())
|
||||
}
|
||||
}
|
||||
|
||||
####################################################################################################################################
|
||||
# vmValid
|
||||
####################################################################################################################################
|
||||
sub vmValid
|
||||
{
|
||||
my $strVm = shift;
|
||||
|
||||
if (!defined($oyVm->{$strVm}))
|
||||
{
|
||||
confess &log(ERROR, "no definition for vm '${strVm}'", ERROR_OPTION_INVALID_VALUE);
|
||||
}
|
||||
}
|
||||
|
||||
push @EXPORT, qw(vmValid);
|
||||
|
||||
####################################################################################################################################
|
||||
# vmGet
|
||||
####################################################################################################################################
|
||||
|
11
test/test.pl
11
test/test.pl
@ -356,6 +356,11 @@ eval
|
||||
{
|
||||
$strVm = VM_ALL;
|
||||
}
|
||||
# Else make sure vm is valid
|
||||
elsif ($strVm ne VM_ALL)
|
||||
{
|
||||
vmValid($strVm);
|
||||
}
|
||||
|
||||
# Get the base backrest path
|
||||
my $strBackRestBase = dirname(dirname(abs_path($0)));
|
||||
@ -1547,7 +1552,11 @@ or do
|
||||
# If a backrest exception then return the code
|
||||
if (isException(\$EVAL_ERROR))
|
||||
{
|
||||
syswrite(*STDOUT, $EVAL_ERROR->message() . "\n" . $EVAL_ERROR->trace());
|
||||
if ($EVAL_ERROR->code() != ERROR_OPTION_INVALID_VALUE)
|
||||
{
|
||||
syswrite(*STDOUT, $EVAL_ERROR->message() . "\n" . $EVAL_ERROR->trace());
|
||||
}
|
||||
|
||||
exit $EVAL_ERROR->code();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user