mirror of
https://github.com/optim-enterprises-bv/patroni.git
synced 2026-01-08 16:41:30 +00:00
Previous to this commit, if a user would ever like to add parameters to the custom bootstrap script call, they would need to configure Patroni like this:
```
bootstrap:
method: custom_method_name
custom_method_name:
command: /path/to/my/custom_script --arg1=value1 --arg2=value2 ...
```
This commit extends that so we achieve a similar behavior that is seen when using `create_replica_methods`, i.e., we also allow the following syntax:
```
bootstrap:
method: custom_method_name
custom_method_name:
command: /path/to/my/custom_script
arg1: value1
arg2: value2
```
All keys in the mapping which are not recognized by Patroni, will be dealt with as if they were additional named arguments to be passed down to the `command` call.
References: PAT-218.
13 lines
374 B
Python
Executable File
13 lines
374 B
Python
Executable File
#!/usr/bin/env python
|
|
import argparse
|
|
import shutil
|
|
|
|
if __name__ == "__main__":
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument("--datadir", required=True)
|
|
parser.add_argument("--sourcedir", required=True)
|
|
parser.add_argument("--test-argument", required=True)
|
|
args, _ = parser.parse_known_args()
|
|
|
|
shutil.copytree(args.sourcedir, args.datadir)
|