1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-01-18 04:58:51 +02:00

Allow any boolean option that is not command-line only to be negated.

This commit is contained in:
David Steele 2015-04-07 19:21:48 -04:00
parent 43d86e64a4
commit 9fe7f87e3a
3 changed files with 9 additions and 7 deletions

View File

@ -666,7 +666,6 @@ my %oOptionRule =
&OPTION_BACKUP_ARCHIVE_CHECK =>
{
&OPTION_RULE_NEGATE => true,
&OPTION_RULE_TYPE => OPTION_TYPE_BOOLEAN,
&OPTION_RULE_DEFAULT => OPTION_DEFAULT_BACKUP_ARCHIVE_CHECK,
&OPTION_RULE_SECTION => true,
@ -696,7 +695,6 @@ my %oOptionRule =
&OPTION_COMPRESS =>
{
&OPTION_RULE_NEGATE => true,
&OPTION_RULE_TYPE => OPTION_TYPE_BOOLEAN,
&OPTION_RULE_DEFAULT => OPTION_DEFAULT_COMPRESS,
&OPTION_RULE_SECTION => true,
@ -988,10 +986,14 @@ sub configLoad
$oOptionAllow{$strOption} = $strOption;
# Check if the option can be negated
if (defined($oOptionRule{$strKey}{&OPTION_RULE_NEGATE}) && $oOptionRule{$strKey}{&OPTION_RULE_NEGATE})
if ((defined($oOptionRule{$strKey}{&OPTION_RULE_NEGATE}) &&
$oOptionRule{$strKey}{&OPTION_RULE_NEGATE}) ||
($oOptionRule{$strKey}{&OPTION_RULE_TYPE} eq OPTION_TYPE_BOOLEAN &&
defined($oOptionRule{$strKey}{&OPTION_RULE_SECTION})))
{
$strOption = "no-${strKey}";
$oOptionAllow{$strOption} = $strOption;
$oOptionRule{$strKey}{&OPTION_RULE_NEGATE} = true;
}
}
@ -1140,13 +1142,12 @@ sub optionValid
confess &log(ERROR, "option '${strOption}' cannot be both set and negated", ERROR_OPTION_NEGATE);
}
if ($bNegate)
if ($bNegate && $oOptionRule{$strOption}{&OPTION_RULE_TYPE} eq OPTION_TYPE_BOOLEAN)
{
$strValue = false;
}
}
# If the operation has rules store them for later evaluation
my $oOperationRule = optionOperationRule($strOption, $strOperation);

View File

@ -394,7 +394,7 @@ sub BackRestTestBackup_Create
BackRestTestCommon_PathCreate(BackRestTestCommon_LocalPathGet());
}
BackRestTestCommon_CreateRepo();
BackRestTestCommon_CreateRepo($bRemote);
# Create the cluster
if ($bCluster)

View File

@ -48,7 +48,8 @@ sub BackRestTestCompare_BuildDb
do
{
BackRestTestBackup_PgExecute("do \$\$ declare iIndex int; begin for iIndex in 1..289000 loop insert into ${strTableName} values (1); end loop; end \$\$;");
BackRestTestBackup_PgExecute("do \$\$ declare iIndex int; begin for iIndex in 1..289000 loop " .
"insert into ${strTableName} values (1); end loop; end \$\$;");
BackRestTestBackup_PgExecute("checkpoint");
my $oStat = stat($strTableFile);