Add no_params option for custom bootstrap method (#1664)

Close #1475
This commit is contained in:
Kostiantyn Nemchenko
2020-08-28 08:23:00 +02:00
committed by GitHub
parent 48aa0ba61b
commit 918a57fe0c
2 changed files with 5 additions and 1 deletions
+3
View File
@@ -24,6 +24,7 @@ arguments to them, i.e. the name of the cluster and the path to the data directo
<custom_bootstrap_method_name>:
command: <path_to_custom_bootstrap_script> [param1 [, ...]]
keep_existing_recovery_conf: False
no_params: False
recovery_conf:
recovery_target_action: promote
recovery_target_timeline: latest
@@ -40,6 +41,8 @@ in the configuration files, Patroni supplies two cluster-specific ones:
--datadir
Path to the data directory of the cluster instance to be bootstrapped
Passing these two additional flags can be disabled by setting a special ``no_params`` parameter to ``True``.
If the bootstrap script returns 0, Patroni tries to configure and start the PostgreSQL instance produced by it. If any
of the intermediate steps fail, or the script returns a non-zero value, Patroni assumes that the bootstrap has failed,
cleans up after itself and releases the initialize lock to give another node the opportunity to bootstrap.
+2 -1
View File
@@ -98,7 +98,8 @@ class Bootstrap(object):
def _custom_bootstrap(self, config):
self._postgresql.set_state('running custom bootstrap script')
params = ['--scope=' + self._postgresql.scope, '--datadir=' + self._postgresql.data_dir]
params = [] if config.get('no_params') else ['--scope=' + self._postgresql.scope,
'--datadir=' + self._postgresql.data_dir]
try:
logger.info('Running custom bootstrap script: %s', config['command'])
if self._postgresql.cancellable.call(shlex.split(config['command']) + params) != 0: