From 8adddb3467f3c43ddf4ff723a2381e0cf6e2a31b Mon Sep 17 00:00:00 2001 From: Alexander Kukushkin Date: Fri, 3 Nov 2023 13:02:39 +0100 Subject: [PATCH] Limit accepted values for --format argument (#2938) It used to accept any arbitrary string Close https://github.com/zalando/patroni/issues/2936 --- patroni/ctl.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/patroni/ctl.py b/patroni/ctl.py index 83810dd3..b4c57873 100644 --- a/patroni/ctl.py +++ b/patroni/ctl.py @@ -255,7 +255,8 @@ def load_config(path: str, dcs_url: Optional[str]) -> Dict[str, Any]: return config -option_format = click.option('--format', '-f', 'fmt', help='Output format (pretty, tsv, json, yaml)', default='pretty') +option_format = click.option('--format', '-f', 'fmt', help='Output format', default='pretty', + type=click.Choice(['pretty', 'tsv', 'json', 'yaml', 'yml'])) option_watchrefresh = click.option('-w', '--watch', type=float, help='Auto update the screen every X seconds') option_watch = click.option('-W', is_flag=True, help='Auto update the screen every 2 seconds') option_force = click.option('--force', is_flag=True, help='Do not ask for confirmation at any point')