From 99a072163192e7546632119df89511a173d9048e Mon Sep 17 00:00:00 2001 From: David Steele Date: Tue, 5 Dec 2017 15:23:32 -0500 Subject: [PATCH] Allow any non-boolean, non-command-line option to be negated. This allows specific options in pgbackrest.conf to be ignored (and set to default) which reduces the need to write new configuration files for specific needs. Note that boolean, non-command-line options are already negatable. --- build/lib/pgBackRestBuild/Config/Data.pm | 5 +- doc/xml/release.xml | 6 + lib/pgBackRest/Config/Config.pm | 18 +- src/config/define.auto.c | 100 ++-- src/config/parse.auto.c | 456 ++++++++++++++++++ test/expect/mock-all-002.log | 29 ++ .../pgBackRestTest/Module/Mock/MockAllTest.pm | 8 + 7 files changed, 563 insertions(+), 59 deletions(-) diff --git a/build/lib/pgBackRestBuild/Config/Data.pm b/build/lib/pgBackRestBuild/Config/Data.pm index fd08afb71..b293c2d7b 100644 --- a/build/lib/pgBackRestBuild/Config/Data.pm +++ b/build/lib/pgBackRestBuild/Config/Data.pm @@ -1892,9 +1892,8 @@ foreach my $strKey (sort(keys(%hConfigDefine))) $hConfigDefine{$strKey}{&CFGDEF_INDEX_TOTAL} = 1; } - # All boolean config options can be negated. Boolean command-line options must be marked for negation individually. - if ($hConfigDefine{$strKey}{&CFGDEF_TYPE} eq CFGDEF_TYPE_BOOLEAN && - defined($hConfigDefine{$strKey}{&CFGDEF_SECTION})) + # All config options can be negated. Boolean command-line options must be marked for negation individually. + if (defined($hConfigDefine{$strKey}{&CFGDEF_SECTION})) { $hConfigDefine{$strKey}{&CFGDEF_NEGATE} = true; } diff --git a/doc/xml/release.xml b/doc/xml/release.xml index aafd006b5..6ef7ad149 100644 --- a/doc/xml/release.xml +++ b/doc/xml/release.xml @@ -22,6 +22,12 @@ + + +

Allow any non-boolean, non-command-line option to be negated. This allows specific options in pgbackrest.conf to be ignored (and set to default) which reduces the need to write new configuration files for specific needs. Note that boolean, non-command-line options are already negatable.

+
+
+

The C library is now required. This eliminates conditional loading and eases development of new library features.

diff --git a/lib/pgBackRest/Config/Config.pm b/lib/pgBackRest/Config/Config.pm index b95f4bdb2..e4a68d1dc 100644 --- a/lib/pgBackRest/Config/Config.pm +++ b/lib/pgBackRest/Config/Config.pm @@ -403,18 +403,18 @@ sub optionValidate my $strValue = optionValueGet($strOption, $oOptionTest); # Check to see if an option can be negated. Make sure that it is not set and negated at the same time. - my $bNegate = false; + $oOption{$strOption}{negate} = false; if (cfgDefOptionNegate($iOptionId)) { - $bNegate = defined($$oOptionTest{'no-' . $strOption}); + $oOption{$strOption}{negate} = defined($$oOptionTest{'no-' . $strOption}); - if ($bNegate && defined($strValue)) + if ($oOption{$strOption}{negate} && defined($strValue)) { confess &log(ERROR, "option '${strOption}' cannot be both set and negated", ERROR_OPTION_NEGATE); } - if ($bNegate && cfgDefOptionType($iOptionId) eq CFGDEF_TYPE_BOOLEAN) + if ($oOption{$strOption}{negate} && cfgDefOptionType($iOptionId) eq CFGDEF_TYPE_BOOLEAN) { $strValue = false; } @@ -464,7 +464,7 @@ sub optionValidate } # If the option value is undefined and not negated, see if it can be loaded from the config file - if (!defined($strValue) && !$bNegate && $strOption ne cfgOptionName(CFGOPT_CONFIG) && + if (!defined($strValue) && !$oOption{$strOption}{negate} && $strOption ne cfgOptionName(CFGOPT_CONFIG) && defined(cfgDefOptionSection($iOptionId)) && $bDependResolved) { # If the config option has not been resolved yet then continue processing @@ -762,7 +762,7 @@ sub optionValidate if (defined($strDefault)) { # Only set default if dependency is resolved - $oOption{$strOption}{value} = $strDefault if !$bNegate; + $oOption{$strOption}{value} = $strDefault if !$oOption{$strOption}{negate}; } # Else check required elsif (cfgDefOptionRequired($iCommandId, $iOptionId) && !$bHelp) @@ -1200,6 +1200,12 @@ sub cfgCommandWrite $strExeString .= cfgCommandWriteOptionFormat($strOption, $bMulti, $bSecure, $oValue); } + # Else is negated and is not a boolean (which is handled above) + elsif (cfgDefOptionValid($iNewCommandId, $iOptionId) && $oOption{$strOption}{negate} && + cfgDefOptionType($iOptionId) ne CFGDEF_TYPE_BOOLEAN) + { + $strExeString .= " --no-${strOption}"; + } } if ($bIncludeCommand) diff --git a/src/config/define.auto.c b/src/config/define.auto.c index e2ad9b3c7..9c3c46b98 100644 --- a/src/config/define.auto.c +++ b/src/config/define.auto.c @@ -186,7 +186,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeInteger) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -204,7 +204,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeFloat) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -230,7 +230,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -263,7 +263,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -297,7 +297,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -325,7 +325,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeInteger) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -384,7 +384,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -418,7 +418,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeInteger) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -484,7 +484,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -563,7 +563,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeInteger) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -596,7 +596,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeInteger) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -664,7 +664,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString) CFGDEFDATA_OPTION_INDEX_TOTAL(8) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -695,7 +695,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString) CFGDEFDATA_OPTION_INDEX_TOTAL(8) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -727,7 +727,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString) CFGDEFDATA_OPTION_INDEX_TOTAL(8) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -759,7 +759,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeList) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -777,7 +777,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString) CFGDEFDATA_OPTION_INDEX_TOTAL(8) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -836,7 +836,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeInteger) CFGDEFDATA_OPTION_INDEX_TOTAL(8) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -864,7 +864,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString) CFGDEFDATA_OPTION_INDEX_TOTAL(8) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -892,7 +892,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeInteger) CFGDEFDATA_OPTION_INDEX_TOTAL(8) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -925,7 +925,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeFloat) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -956,7 +956,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString) CFGDEFDATA_OPTION_INDEX_TOTAL(8) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -1135,7 +1135,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeHash) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -1153,7 +1153,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -1187,7 +1187,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -1231,7 +1231,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -1275,7 +1275,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -1319,7 +1319,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -1387,7 +1387,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeInteger) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -1540,7 +1540,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeInteger) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -1567,7 +1567,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeFloat) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -1600,7 +1600,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeHash) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -1630,7 +1630,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(true) CFGDEFDATA_OPTION_COMMAND_LIST @@ -1669,7 +1669,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -1710,7 +1710,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -1745,7 +1745,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -1784,7 +1784,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -1823,7 +1823,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -1862,7 +1862,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -1901,7 +1901,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -1940,7 +1940,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(true) CFGDEFDATA_OPTION_COMMAND_LIST @@ -1979,7 +1979,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(true) CFGDEFDATA_OPTION_COMMAND_LIST @@ -2018,7 +2018,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -2098,7 +2098,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -2163,7 +2163,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeInteger) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -2187,7 +2187,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -2218,7 +2218,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeInteger) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -2242,7 +2242,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeInteger) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -2294,7 +2294,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -2430,7 +2430,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeHash) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST @@ -2448,7 +2448,7 @@ ConfigDefineOptionData configDefineOptionData[] = CFGDEFDATA_OPTION_LIST CFGDEFDATA_OPTION_TYPE(cfgDefOptTypeString) CFGDEFDATA_OPTION_INDEX_TOTAL(1) - CFGDEFDATA_OPTION_NEGATE(false) + CFGDEFDATA_OPTION_NEGATE(true) CFGDEFDATA_OPTION_SECURE(false) CFGDEFDATA_OPTION_COMMAND_LIST diff --git a/src/config/parse.auto.c b/src/config/parse.auto.c index 9b9541d41..355d3231b 100644 --- a/src/config/parse.auto.c +++ b/src/config/parse.auto.c @@ -38,31 +38,55 @@ static const struct option optionList[] = .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptArchiveQueueMax, }, + { + .name = "no-archive-queue-max", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptArchiveQueueMax, + }, { .name = "archive-timeout", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptArchiveTimeout, }, + { + .name = "no-archive-timeout", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptArchiveTimeout, + }, { .name = "backup-cmd", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptBackupCmd, }, + { + .name = "no-backup-cmd", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptBackupCmd, + }, { .name = "backup-config", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptBackupConfig, }, + { + .name = "no-backup-config", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptBackupConfig, + }, { .name = "backup-host", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptBackupHost, }, + { + .name = "no-backup-host", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptBackupHost, + }, { .name = "backup-ssh-port", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptBackupSshPort, }, + { + .name = "no-backup-ssh-port", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptBackupSshPort, + }, { .name = "backup-standby", .val = PARSE_OPTION_FLAG | cfgOptBackupStandby, @@ -76,11 +100,19 @@ static const struct option optionList[] = .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptBackupUser, }, + { + .name = "no-backup-user", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptBackupUser, + }, { .name = "buffer-size", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptBufferSize, }, + { + .name = "no-buffer-size", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptBufferSize, + }, { .name = "checksum-page", .val = PARSE_OPTION_FLAG | cfgOptChecksumPage, @@ -94,6 +126,10 @@ static const struct option optionList[] = .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptCmdSsh, }, + { + .name = "no-cmd-ssh", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptCmdSsh, + }, { .name = "command", .has_arg = required_argument, @@ -112,11 +148,19 @@ static const struct option optionList[] = .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptCompressLevel, }, + { + .name = "no-compress-level", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptCompressLevel, + }, { .name = "compress-level-network", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptCompressLevelNetwork, }, + { + .name = "no-compress-level-network", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptCompressLevelNetwork, + }, { .name = "config", .has_arg = required_argument, @@ -131,371 +175,667 @@ static const struct option optionList[] = .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptDbCmd, }, + { + .name = "no-db-cmd", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptDbCmd, + }, { .name = "db1-cmd", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptDbCmd, }, + { + .name = "no-db1-cmd", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptDbCmd, + }, { .name = "db2-cmd", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbCmd + 1), }, + { + .name = "no-db2-cmd", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbCmd + 1), + }, { .name = "db3-cmd", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbCmd + 2), }, + { + .name = "no-db3-cmd", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbCmd + 2), + }, { .name = "db4-cmd", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbCmd + 3), }, + { + .name = "no-db4-cmd", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbCmd + 3), + }, { .name = "db5-cmd", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbCmd + 4), }, + { + .name = "no-db5-cmd", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbCmd + 4), + }, { .name = "db6-cmd", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbCmd + 5), }, + { + .name = "no-db6-cmd", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbCmd + 5), + }, { .name = "db7-cmd", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbCmd + 6), }, + { + .name = "no-db7-cmd", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbCmd + 6), + }, { .name = "db8-cmd", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbCmd + 7), }, + { + .name = "no-db8-cmd", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbCmd + 7), + }, { .name = "db-config", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptDbConfig, }, + { + .name = "no-db-config", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptDbConfig, + }, { .name = "db1-config", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptDbConfig, }, + { + .name = "no-db1-config", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptDbConfig, + }, { .name = "db2-config", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbConfig + 1), }, + { + .name = "no-db2-config", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbConfig + 1), + }, { .name = "db3-config", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbConfig + 2), }, + { + .name = "no-db3-config", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbConfig + 2), + }, { .name = "db4-config", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbConfig + 3), }, + { + .name = "no-db4-config", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbConfig + 3), + }, { .name = "db5-config", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbConfig + 4), }, + { + .name = "no-db5-config", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbConfig + 4), + }, { .name = "db6-config", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbConfig + 5), }, + { + .name = "no-db6-config", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbConfig + 5), + }, { .name = "db7-config", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbConfig + 6), }, + { + .name = "no-db7-config", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbConfig + 6), + }, { .name = "db8-config", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbConfig + 7), }, + { + .name = "no-db8-config", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbConfig + 7), + }, { .name = "db-host", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptDbHost, }, + { + .name = "no-db-host", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptDbHost, + }, { .name = "db1-host", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptDbHost, }, + { + .name = "no-db1-host", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptDbHost, + }, { .name = "db2-host", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbHost + 1), }, + { + .name = "no-db2-host", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbHost + 1), + }, { .name = "db3-host", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbHost + 2), }, + { + .name = "no-db3-host", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbHost + 2), + }, { .name = "db4-host", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbHost + 3), }, + { + .name = "no-db4-host", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbHost + 3), + }, { .name = "db5-host", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbHost + 4), }, + { + .name = "no-db5-host", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbHost + 4), + }, { .name = "db6-host", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbHost + 5), }, + { + .name = "no-db6-host", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbHost + 5), + }, { .name = "db7-host", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbHost + 6), }, + { + .name = "no-db7-host", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbHost + 6), + }, { .name = "db8-host", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbHost + 7), }, + { + .name = "no-db8-host", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbHost + 7), + }, { .name = "db-include", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptDbInclude, }, + { + .name = "no-db-include", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptDbInclude, + }, { .name = "db-path", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptDbPath, }, + { + .name = "no-db-path", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptDbPath, + }, { .name = "db1-path", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptDbPath, }, + { + .name = "no-db1-path", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptDbPath, + }, { .name = "db2-path", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbPath + 1), }, + { + .name = "no-db2-path", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbPath + 1), + }, { .name = "db3-path", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbPath + 2), }, + { + .name = "no-db3-path", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbPath + 2), + }, { .name = "db4-path", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbPath + 3), }, + { + .name = "no-db4-path", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbPath + 3), + }, { .name = "db5-path", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbPath + 4), }, + { + .name = "no-db5-path", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbPath + 4), + }, { .name = "db6-path", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbPath + 5), }, + { + .name = "no-db6-path", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbPath + 5), + }, { .name = "db7-path", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbPath + 6), }, + { + .name = "no-db7-path", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbPath + 6), + }, { .name = "db8-path", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbPath + 7), }, + { + .name = "no-db8-path", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbPath + 7), + }, { .name = "db-port", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptDbPort, }, + { + .name = "no-db-port", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptDbPort, + }, { .name = "db1-port", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptDbPort, }, + { + .name = "no-db1-port", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptDbPort, + }, { .name = "db2-port", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbPort + 1), }, + { + .name = "no-db2-port", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbPort + 1), + }, { .name = "db3-port", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbPort + 2), }, + { + .name = "no-db3-port", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbPort + 2), + }, { .name = "db4-port", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbPort + 3), }, + { + .name = "no-db4-port", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbPort + 3), + }, { .name = "db5-port", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbPort + 4), }, + { + .name = "no-db5-port", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbPort + 4), + }, { .name = "db6-port", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbPort + 5), }, + { + .name = "no-db6-port", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbPort + 5), + }, { .name = "db7-port", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbPort + 6), }, + { + .name = "no-db7-port", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbPort + 6), + }, { .name = "db8-port", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbPort + 7), }, + { + .name = "no-db8-port", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbPort + 7), + }, { .name = "db-socket-path", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptDbSocketPath, }, + { + .name = "no-db-socket-path", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptDbSocketPath, + }, { .name = "db1-socket-path", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptDbSocketPath, }, + { + .name = "no-db1-socket-path", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptDbSocketPath, + }, { .name = "db2-socket-path", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbSocketPath + 1), }, + { + .name = "no-db2-socket-path", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbSocketPath + 1), + }, { .name = "db3-socket-path", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbSocketPath + 2), }, + { + .name = "no-db3-socket-path", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbSocketPath + 2), + }, { .name = "db4-socket-path", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbSocketPath + 3), }, + { + .name = "no-db4-socket-path", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbSocketPath + 3), + }, { .name = "db5-socket-path", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbSocketPath + 4), }, + { + .name = "no-db5-socket-path", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbSocketPath + 4), + }, { .name = "db6-socket-path", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbSocketPath + 5), }, + { + .name = "no-db6-socket-path", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbSocketPath + 5), + }, { .name = "db7-socket-path", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbSocketPath + 6), }, + { + .name = "no-db7-socket-path", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbSocketPath + 6), + }, { .name = "db8-socket-path", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbSocketPath + 7), }, + { + .name = "no-db8-socket-path", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbSocketPath + 7), + }, { .name = "db-ssh-port", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptDbSshPort, }, + { + .name = "no-db-ssh-port", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptDbSshPort, + }, { .name = "db1-ssh-port", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptDbSshPort, }, + { + .name = "no-db1-ssh-port", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptDbSshPort, + }, { .name = "db2-ssh-port", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbSshPort + 1), }, + { + .name = "no-db2-ssh-port", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbSshPort + 1), + }, { .name = "db3-ssh-port", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbSshPort + 2), }, + { + .name = "no-db3-ssh-port", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbSshPort + 2), + }, { .name = "db4-ssh-port", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbSshPort + 3), }, + { + .name = "no-db4-ssh-port", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbSshPort + 3), + }, { .name = "db5-ssh-port", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbSshPort + 4), }, + { + .name = "no-db5-ssh-port", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbSshPort + 4), + }, { .name = "db6-ssh-port", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbSshPort + 5), }, + { + .name = "no-db6-ssh-port", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbSshPort + 5), + }, { .name = "db7-ssh-port", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbSshPort + 6), }, + { + .name = "no-db7-ssh-port", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbSshPort + 6), + }, { .name = "db8-ssh-port", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbSshPort + 7), }, + { + .name = "no-db8-ssh-port", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbSshPort + 7), + }, { .name = "db-timeout", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptDbTimeout, }, + { + .name = "no-db-timeout", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptDbTimeout, + }, { .name = "db-user", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptDbUser, }, + { + .name = "no-db-user", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptDbUser, + }, { .name = "db1-user", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptDbUser, }, + { + .name = "no-db1-user", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptDbUser, + }, { .name = "db2-user", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbUser + 1), }, + { + .name = "no-db2-user", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbUser + 1), + }, { .name = "db3-user", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbUser + 2), }, + { + .name = "no-db3-user", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbUser + 2), + }, { .name = "db4-user", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbUser + 3), }, + { + .name = "no-db4-user", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbUser + 3), + }, { .name = "db5-user", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbUser + 4), }, + { + .name = "no-db5-user", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbUser + 4), + }, { .name = "db6-user", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbUser + 5), }, + { + .name = "no-db6-user", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbUser + 5), + }, { .name = "db7-user", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbUser + 6), }, + { + .name = "no-db7-user", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbUser + 6), + }, { .name = "db8-user", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | (cfgOptDbUser + 7), }, + { + .name = "no-db8-user", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | (cfgOptDbUser + 7), + }, { .name = "delta", .val = PARSE_OPTION_FLAG | cfgOptDelta, @@ -530,31 +870,55 @@ static const struct option optionList[] = .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptLinkMap, }, + { + .name = "no-link-map", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptLinkMap, + }, { .name = "lock-path", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptLockPath, }, + { + .name = "no-lock-path", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptLockPath, + }, { .name = "log-level-console", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptLogLevelConsole, }, + { + .name = "no-log-level-console", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptLogLevelConsole, + }, { .name = "log-level-file", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptLogLevelFile, }, + { + .name = "no-log-level-file", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptLogLevelFile, + }, { .name = "log-level-stderr", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptLogLevelStderr, }, + { + .name = "no-log-level-stderr", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptLogLevelStderr, + }, { .name = "log-path", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptLogPath, }, + { + .name = "no-log-path", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptLogPath, + }, { .name = "log-timestamp", .val = PARSE_OPTION_FLAG | cfgOptLogTimestamp, @@ -568,6 +932,10 @@ static const struct option optionList[] = .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptManifestSaveThreshold, }, + { + .name = "no-manifest-save-threshold", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptManifestSaveThreshold, + }, { .name = "neutral-umask", .val = PARSE_OPTION_FLAG | cfgOptNeutralUmask, @@ -599,71 +967,127 @@ static const struct option optionList[] = .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptProcessMax, }, + { + .name = "no-process-max", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptProcessMax, + }, { .name = "protocol-timeout", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptProtocolTimeout, }, + { + .name = "no-protocol-timeout", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptProtocolTimeout, + }, { .name = "recovery-option", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptRecoveryOption, }, + { + .name = "no-recovery-option", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptRecoveryOption, + }, { .name = "repo-cipher-pass", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptRepoCipherPass, }, + { + .name = "no-repo-cipher-pass", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptRepoCipherPass, + }, { .name = "repo-cipher-type", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptRepoCipherType, }, + { + .name = "no-repo-cipher-type", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptRepoCipherType, + }, { .name = "repo-path", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptRepoPath, }, + { + .name = "no-repo-path", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptRepoPath, + }, { .name = "repo-s3-bucket", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptRepoS3Bucket, }, + { + .name = "no-repo-s3-bucket", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptRepoS3Bucket, + }, { .name = "repo-s3-ca-file", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptRepoS3CaFile, }, + { + .name = "no-repo-s3-ca-file", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptRepoS3CaFile, + }, { .name = "repo-s3-ca-path", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptRepoS3CaPath, }, + { + .name = "no-repo-s3-ca-path", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptRepoS3CaPath, + }, { .name = "repo-s3-endpoint", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptRepoS3Endpoint, }, + { + .name = "no-repo-s3-endpoint", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptRepoS3Endpoint, + }, { .name = "repo-s3-host", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptRepoS3Host, }, + { + .name = "no-repo-s3-host", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptRepoS3Host, + }, { .name = "repo-s3-key", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptRepoS3Key, }, + { + .name = "no-repo-s3-key", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptRepoS3Key, + }, { .name = "repo-s3-key-secret", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptRepoS3KeySecret, }, + { + .name = "no-repo-s3-key-secret", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptRepoS3KeySecret, + }, { .name = "repo-s3-region", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptRepoS3Region, }, + { + .name = "no-repo-s3-region", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptRepoS3Region, + }, { .name = "repo-s3-verify-ssl", .val = PARSE_OPTION_FLAG | cfgOptRepoS3VerifySsl, @@ -677,6 +1101,10 @@ static const struct option optionList[] = .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptRepoType, }, + { + .name = "no-repo-type", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptRepoType, + }, { .name = "resume", .val = PARSE_OPTION_FLAG | cfgOptResume, @@ -690,21 +1118,37 @@ static const struct option optionList[] = .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptRetentionArchive, }, + { + .name = "no-retention-archive", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptRetentionArchive, + }, { .name = "retention-archive-type", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptRetentionArchiveType, }, + { + .name = "no-retention-archive-type", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptRetentionArchiveType, + }, { .name = "retention-diff", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptRetentionDiff, }, + { + .name = "no-retention-diff", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptRetentionDiff, + }, { .name = "retention-full", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptRetentionFull, }, + { + .name = "no-retention-full", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptRetentionFull, + }, { .name = "set", .has_arg = required_argument, @@ -715,6 +1159,10 @@ static const struct option optionList[] = .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptSpoolPath, }, + { + .name = "no-spool-path", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptSpoolPath, + }, { .name = "stanza", .has_arg = required_argument, @@ -741,11 +1189,19 @@ static const struct option optionList[] = .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptTablespaceMap, }, + { + .name = "no-tablespace-map", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptTablespaceMap, + }, { .name = "tablespace-map-all", .has_arg = required_argument, .val = PARSE_OPTION_FLAG | cfgOptTablespaceMapAll, }, + { + .name = "no-tablespace-map-all", + .val = PARSE_OPTION_FLAG | PARSE_NEGATE_FLAG | cfgOptTablespaceMapAll, + }, { .name = "target", .has_arg = required_argument, diff --git a/test/expect/mock-all-002.log b/test/expect/mock-all-002.log index 9983d5d0c..90dcfbebf 100644 --- a/test/expect/mock-all-002.log +++ b/test/expect/mock-all-002.log @@ -1537,6 +1537,35 @@ restore, backup '[BACKUP-FULL-2]', expect exit 72 - restore errors on backup hos ------------------------------------------------------------------------------------------------------------------------------------ P00 ERROR: [072]: restore command must be run on the db host +restore, backup '[BACKUP-FULL-2]' - on backup host (backup host) +> [CONTAINER-EXEC] backup [BACKREST-BIN] --config=[TEST_PATH]/backup/pgbackrest.conf --set=[BACKUP-FULL-2] --log-level-console=detail --no-db1-host --db-path=[TEST_PATH]/backup/db --stanza=db restore +------------------------------------------------------------------------------------------------------------------------------------ +P00 INFO: restore command begin [BACKREST-VERSION]: --no-compress --compress-level=3 --compress-level-network=1 --config=[TEST_PATH]/backup/pgbackrest.conf --no-db1-host --db1-path=[TEST_PATH]/backup/db --lock-path=[TEST_PATH]/backup/lock --log-level-console=detail --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/backup/log --protocol-timeout=60 --repo-path=[TEST_PATH]/backup/repo --set=[BACKUP-FULL-2] --stanza=db +P00 INFO: restore backup set [BACKUP-FULL-2] +P00 INFO: remap $PGDATA directory to [TEST_PATH]/backup/db +P00 WARN: contents of directory link pg_stat will be restored in a directory at the same location +P00 WARN: file link postgresql.conf will be restored as a file at the same location +P00 DETAIL: check [TEST_PATH]/backup/db exists +P01 INFO: restore file [TEST_PATH]/backup/db/base/32768/33001 (64KB, 39%) checksum 6bf316f11d28c28914ea9be92c00de9bea6d9a6b +P01 INFO: restore file [TEST_PATH]/backup/db/base/32768/33000.32767 (32KB, 59%) checksum 21e2c7c1a326682c07053b7d6a5a40dbd49c2ec5 +P01 INFO: restore file [TEST_PATH]/backup/db/base/32768/33000 (32KB, 79%) checksum 4a383e4fb8b5cd2a4e8fab91ef63dce48e532a2f +P01 INFO: restore file [TEST_PATH]/backup/db/base/16384/17000 (16KB, 89%) checksum e0101dd8ffb910c9c202ca35b5f828bcb9697bed +P01 INFO: restore file [TEST_PATH]/backup/db/global/pg_control.pgbackrest.tmp (8KB, 94%) checksum b4a3adade1e81ebfc7e9a27bca0887a347d81522 +P01 INFO: restore file [TEST_PATH]/backup/db/base/1/12000 (8KB, 99%) checksum 22c98d248ff548311eda88559e4a8405ed77c003 +P01 INFO: restore file [TEST_PATH]/backup/db/postgresql.conf (21B, 99%) checksum 6721d92c9fcdf4248acff1f9a1377127d9064807 +P01 INFO: restore file [TEST_PATH]/backup/db/pg_stat/global.stat (5B, 99%) checksum e350d5ce0153f3e22d5db21cf2a4eff00f3ee877 +P01 INFO: restore file [TEST_PATH]/backup/db/base/32768/PG_VERSION (3B, 99%) checksum 184473f470864e067ee3a22e64b47b0a1c356f29 +P01 INFO: restore file [TEST_PATH]/backup/db/base/16384/PG_VERSION (3B, 99%) checksum 184473f470864e067ee3a22e64b47b0a1c356f29 +P01 INFO: restore file [TEST_PATH]/backup/db/base/1/PG_VERSION (3B, 99%) checksum 184473f470864e067ee3a22e64b47b0a1c356f29 +P01 INFO: restore file [TEST_PATH]/backup/db/PG_VERSION (3B, 100%) checksum 184473f470864e067ee3a22e64b47b0a1c356f29 +P00 INFO: write [TEST_PATH]/backup/db/recovery.conf +P00 INFO: restore global/pg_control (performed last to ensure aborted restores cannot be started) +P00 INFO: restore command end: completed successfully + ++ supplemental file: [TEST_PATH]/db-master/db/base/recovery.conf +---------------------------------------------------------------- +restore_command = '[BACKREST-BIN] --compress-level-network=0 --config=[TEST_PATH]/db-master/pgbackrest.conf --log-level-console=detail --stanza=db archive-get %f "%p"' + full backup - backup errors on db host (db-master host) > [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --no-online --log-level-console=warn --type=full --stanza=db backup ------------------------------------------------------------------------------------------------------------------------------------ diff --git a/test/lib/pgBackRestTest/Module/Mock/MockAllTest.pm b/test/lib/pgBackRestTest/Module/Mock/MockAllTest.pm index 2ab469e97..5feb4371e 100644 --- a/test/lib/pgBackRestTest/Module/Mock/MockAllTest.pm +++ b/test/lib/pgBackRestTest/Module/Mock/MockAllTest.pm @@ -583,6 +583,14 @@ sub run {rhExpectedManifest => \%oManifest, strUser => TEST_USER, iExpectedExitStatus => ERROR_HOST_INVALID, strOptionalParam => "--log-level-console=warn"}); + my $strBackupHostDbPath = $oHostBackup->testPath() . '/db'; + executeTest("mkdir -p ${strBackupHostDbPath}"); + + $oHostBackup->restore( + 'on backup host', $strFullBackup, + {rhExpectedManifest => \%oManifest, strUser => TEST_USER, + strOptionalParam => "${strLogReduced} --no-db1-host --db-path=${strBackupHostDbPath}"}); + $oHostDbMaster->backup( $strType, 'backup errors on db host', {oExpectedManifest => \%oManifest, iExpectedExitStatus => ERROR_HOST_INVALID,