pgbackrest.git / summary / log / commit / refs

commit    9be51f9bf370c4ff2a802dbd4fdafd09e2a05810
Author:   David Steele <david@pgbackrest.org>
Date:     Tue Nov 11 06:52:36 2025 +0000

    Cleanup repo-host options for remote backup.
    
    931435c0 added the ability to backup to a remote repo but did not quite get the option updates right. It worked, but a number of options were marked as internal so would not be visible to the user in command-line help.
    
    Also reverse the dependency of repo-host and repo-host-type, i.e. make repo-host-type depend on repo-host, and alter repo-host-cmd and repo-host-user to depend on repo-host-type=ssh.


src/build/config/config.yaml | 77 ++++++++++++-------------------------- src/config/parse.auto.c.inc | 47 +++-------------------- test/src/module/config/parseTest.c | 2 +- 3 files changed, 30 insertions(+), 96 deletions(-) diff --git a/src/build/config/config.yaml b/src/build/config/config.yaml index f24de6abc..671d6b073 100644 --- a/src/build/config/config.yaml +++ b/src/build/config/config.yaml @@ -1723,11 +1723,9 @@ option: annotate: {} archive-get: {} archive-push: {} - backup: - internal: true + backup: {} check: {} - expire: - internal: true + expire: {} info: {} manifest: {} repo-get: {} @@ -1756,24 +1754,7 @@ option: - posix - s3 - sftp: HAVE_LIBSSH2 - command: - annotate: {} - archive-get: {} - archive-push: {} - backup: {} - check: {} - expire: {} - info: {} - manifest: {} - repo-get: {} - repo-ls: {} - repo-put: {} - repo-rm: {} - restore: {} - stanza-create: {} - stanza-delete: {} - stanza-upgrade: {} - verify: {} + command: repo-local deprecate: repo-type: {} @@ -2013,14 +1994,11 @@ option: deprecate: hardlink: {} - repo-host-type: + repo-host: section: global group: repo - type: string-id - default: ssh - allow-list: - - ssh - - tls + type: string + required: false command: repo-local command-role: async: {} @@ -2030,20 +2008,24 @@ option: option: repo-local list: - false + deprecate: + backup-host: {} - repo-host: + repo-host-type: section: global group: repo - type: string - required: false + type: string-id + default: ssh + allow-list: + - ssh + - tls command: repo-local command-role: async: {} main: {} local: {} - depend: repo-host-type - deprecate: - backup-host: {} + depend: + option: repo-host repo-host-cert-file: section: global @@ -2076,30 +2058,15 @@ option: type: string default-type: dynamic default: bin - command: - annotate: {} - archive-get: {} - archive-push: {} - backup: {} - check: {} - expire: {} - info: {} - manifest: {} - repo-get: {} - repo-ls: {} - repo-put: {} - repo-rm: {} - restore: {} - stanza-create: {} - stanza-delete: {} - stanza-upgrade: {} - verify: {} + command: repo-local command-role: async: {} main: {} local: {} depend: - option: repo-host + option: repo-host-type + list: + - ssh deprecate: backup-cmd: {} @@ -2164,7 +2131,9 @@ option: local: {} default: pgbackrest depend: - option: repo-host + option: repo-host-type + list: + - ssh deprecate: backup-user: {} diff --git a/src/config/parse.auto.c.inc b/src/config/parse.auto.c.inc index 1854fe2ae..8a6416e5e 100644 --- a/src/config/parse.auto.c.inc +++ b/src/config/parse.auto.c.inc @@ -6566,12 +6566,6 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] = PARSE_RULE_OPTION_SECTION(Global), // opt/repo-host PARSE_RULE_OPTION_GROUP_ID(Repo), // opt/repo-host // opt/repo-host - PARSE_RULE_OPTION_COMMAND_INTERNAL_LIST // opt/repo-host - ( // opt/repo-host - PARSE_RULE_OPTION_COMMAND_INTERNAL(Backup, true), // opt/repo-host - PARSE_RULE_OPTION_COMMAND_INTERNAL(Expire, true), // opt/repo-host - ) // opt/repo-host - // opt/repo-host PARSE_RULE_OPTION_COMMAND_ROLE_MAIN_VALID_LIST // opt/repo-host ( // opt/repo-host PARSE_RULE_OPTION_COMMAND(Annotate) // opt/repo-host @@ -6630,12 +6624,6 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] = PARSE_RULE_OPTION_SECTION(Global), // opt/repo-host-ca-file PARSE_RULE_OPTION_GROUP_ID(Repo), // opt/repo-host-ca-file // opt/repo-host-ca-file - PARSE_RULE_OPTION_COMMAND_INTERNAL_LIST // opt/repo-host-ca-file - ( // opt/repo-host-ca-file - PARSE_RULE_OPTION_COMMAND_INTERNAL(Backup, true), // opt/repo-host-ca-file - PARSE_RULE_OPTION_COMMAND_INTERNAL(Expire, true), // opt/repo-host-ca-file - ) // opt/repo-host-ca-file - // opt/repo-host-ca-file PARSE_RULE_OPTION_COMMAND_ROLE_MAIN_VALID_LIST // opt/repo-host-ca-file ( // opt/repo-host-ca-file PARSE_RULE_OPTION_COMMAND(Annotate) // opt/repo-host-ca-file @@ -6694,12 +6682,6 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] = PARSE_RULE_OPTION_SECTION(Global), // opt/repo-host-ca-path PARSE_RULE_OPTION_GROUP_ID(Repo), // opt/repo-host-ca-path // opt/repo-host-ca-path - PARSE_RULE_OPTION_COMMAND_INTERNAL_LIST // opt/repo-host-ca-path - ( // opt/repo-host-ca-path - PARSE_RULE_OPTION_COMMAND_INTERNAL(Backup, true), // opt/repo-host-ca-path - PARSE_RULE_OPTION_COMMAND_INTERNAL(Expire, true), // opt/repo-host-ca-path - ) // opt/repo-host-ca-path - // opt/repo-host-ca-path PARSE_RULE_OPTION_COMMAND_ROLE_MAIN_VALID_LIST // opt/repo-host-ca-path ( // opt/repo-host-ca-path PARSE_RULE_OPTION_COMMAND(Annotate) // opt/repo-host-ca-path @@ -6758,12 +6740,6 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] = PARSE_RULE_OPTION_SECTION(Global), // opt/repo-host-cert-file PARSE_RULE_OPTION_GROUP_ID(Repo), // opt/repo-host-cert-file // opt/repo-host-cert-file - PARSE_RULE_OPTION_COMMAND_INTERNAL_LIST // opt/repo-host-cert-file - ( // opt/repo-host-cert-file - PARSE_RULE_OPTION_COMMAND_INTERNAL(Backup, true), // opt/repo-host-cert-file - PARSE_RULE_OPTION_COMMAND_INTERNAL(Expire, true), // opt/repo-host-cert-file - ) // opt/repo-host-cert-file - // opt/repo-host-cert-file PARSE_RULE_OPTION_COMMAND_ROLE_MAIN_VALID_LIST // opt/repo-host-cert-file ( // opt/repo-host-cert-file PARSE_RULE_OPTION_COMMAND(Annotate) // opt/repo-host-cert-file @@ -6865,7 +6841,8 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] = ( // opt/repo-host-cmd PARSE_RULE_OPTIONAL_DEPEND // opt/repo-host-cmd ( // opt/repo-host-cmd - PARSE_RULE_VAL_OPT(RepoHost), // opt/repo-host-cmd + PARSE_RULE_VAL_OPT(RepoHostType), // opt/repo-host-cmd + PARSE_RULE_VAL_STRID(Ssh), // opt/repo-host-cmd ), // opt/repo-host-cmd // opt/repo-host-cmd PARSE_RULE_OPTIONAL_DEFAULT // opt/repo-host-cmd @@ -7071,12 +7048,6 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] = PARSE_RULE_OPTION_SECTION(Global), // opt/repo-host-key-file PARSE_RULE_OPTION_GROUP_ID(Repo), // opt/repo-host-key-file // opt/repo-host-key-file - PARSE_RULE_OPTION_COMMAND_INTERNAL_LIST // opt/repo-host-key-file - ( // opt/repo-host-key-file - PARSE_RULE_OPTION_COMMAND_INTERNAL(Backup, true), // opt/repo-host-key-file - PARSE_RULE_OPTION_COMMAND_INTERNAL(Expire, true), // opt/repo-host-key-file - ) // opt/repo-host-key-file - // opt/repo-host-key-file PARSE_RULE_OPTION_COMMAND_ROLE_MAIN_VALID_LIST // opt/repo-host-key-file ( // opt/repo-host-key-file PARSE_RULE_OPTION_COMMAND(Annotate) // opt/repo-host-key-file @@ -7209,12 +7180,6 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] = PARSE_RULE_OPTION_SECTION(Global), // opt/repo-host-type PARSE_RULE_OPTION_GROUP_ID(Repo), // opt/repo-host-type // opt/repo-host-type - PARSE_RULE_OPTION_COMMAND_INTERNAL_LIST // opt/repo-host-type - ( // opt/repo-host-type - PARSE_RULE_OPTION_COMMAND_INTERNAL(Backup, true), // opt/repo-host-type - PARSE_RULE_OPTION_COMMAND_INTERNAL(Expire, true), // opt/repo-host-type - ) // opt/repo-host-type - // opt/repo-host-type PARSE_RULE_OPTION_COMMAND_ROLE_MAIN_VALID_LIST // opt/repo-host-type ( // opt/repo-host-type PARSE_RULE_OPTION_COMMAND(Annotate) // opt/repo-host-type @@ -7257,8 +7222,7 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] = ( // opt/repo-host-type PARSE_RULE_OPTIONAL_DEPEND // opt/repo-host-type ( // opt/repo-host-type - PARSE_RULE_VAL_OPT(RepoLocal), // opt/repo-host-type - PARSE_RULE_VAL_BOOL_FALSE, // opt/repo-host-type + PARSE_RULE_VAL_OPT(RepoHost), // opt/repo-host-type ), // opt/repo-host-type // opt/repo-host-type PARSE_RULE_OPTIONAL_ALLOW_LIST // opt/repo-host-type @@ -7326,7 +7290,8 @@ static const ParseRuleOption parseRuleOption[CFG_OPTION_TOTAL] = ( // opt/repo-host-user PARSE_RULE_OPTIONAL_DEPEND // opt/repo-host-user ( // opt/repo-host-user - PARSE_RULE_VAL_OPT(RepoHost), // opt/repo-host-user + PARSE_RULE_VAL_OPT(RepoHostType), // opt/repo-host-user + PARSE_RULE_VAL_STRID(Ssh), // opt/repo-host-user ), // opt/repo-host-user // opt/repo-host-user PARSE_RULE_OPTIONAL_DEFAULT // opt/repo-host-user @@ -11791,7 +11756,6 @@ static const uint8_t optionResolveOrder[] = cfgOptRepoCipherPass, // opt-resolve-order cfgOptRepoGcsKeyType, // opt-resolve-order cfgOptRepoHost, // opt-resolve-order - cfgOptRepoHostCmd, // opt-resolve-order cfgOptRepoHostConfig, // opt-resolve-order cfgOptRepoHostConfigIncludePath, // opt-resolve-order cfgOptRepoHostConfigPath, // opt-resolve-order @@ -11839,6 +11803,7 @@ static const uint8_t optionResolveOrder[] = cfgOptRepoHostCaFile, // opt-resolve-order cfgOptRepoHostCaPath, // opt-resolve-order cfgOptRepoHostCertFile, // opt-resolve-order + cfgOptRepoHostCmd, // opt-resolve-order cfgOptRepoHostKeyFile, // opt-resolve-order cfgOptRepoHostPort, // opt-resolve-order cfgOptRepoS3Key, // opt-resolve-order diff --git a/test/src/module/config/parseTest.c b/test/src/module/config/parseTest.c index ed6d5fe14..53569b2cb 100644 --- a/test/src/module/config/parseTest.c +++ b/test/src/module/config/parseTest.c @@ -1260,7 +1260,7 @@ testRun(void) strLstAddZ(argList, TEST_COMMAND_RESTORE); TEST_ERROR( cfgParseP(storageTest, strLstSize(argList), strLstPtr(argList), .noResetLogLevel = true), OptionInvalidError, - "option 'repo1-host-user' not valid without option 'repo1-host'"); + "option 'repo1-host-user' not valid without option 'repo1-host-type'"); argList = strLstNew(); strLstAddZ(argList, TEST_BACKREST_EXE); [parent: 7a74fd3fb98b]