Coverage for curator/cli_singletons/replicas.py: 100%
14 statements
« prev ^ index » next coverage.py v7.3.0, created at 2023-08-16 15:27 -0600
« prev ^ index » next coverage.py v7.3.0, created at 2023-08-16 15:27 -0600
1"""Change Replica Count Singleton"""
2import click
3from curator.cli_singletons.object_class import cli_action
4from curator.cli_singletons.utils import get_width, validate_filter_json
6@click.command(context_settings=get_width())
7@click.option('--count', type=int, required=True, help='Number of replicas (max 10)')
8@click.option(
9 '--wait_for_completion/--no-wait_for_completion',
10 default=False,
11 help='Wait for replication to complete',
12 show_default=True
13)
14@click.option(
15 '--ignore_empty_list',
16 is_flag=True,
17 help='Do not raise exception if there are no actionable indices'
18)
19@click.option(
20 '--allow_ilm_indices/--no-allow_ilm_indices',
21 help='Allow Curator to operate on Index Lifecycle Management monitored indices.',
22 default=False,
23 show_default=True
24)
25@click.option(
26 '--filter_list',
27 callback=validate_filter_json,
28 help='JSON array of filters selecting indices to act on.',
29 required=True
30)
31@click.pass_context
32def replicas(ctx, count, wait_for_completion, ignore_empty_list, allow_ilm_indices, filter_list):
33 """
34 Change Replica Count
35 """
36 manual_options = {
37 'count': count,
38 'wait_for_completion': wait_for_completion,
39 'allow_ilm_indices': allow_ilm_indices,
40 }
41 # ctx.info_name is the name of the function or name specified in @click.command decorator
42 action = cli_action(
43 ctx.info_name, ctx.obj['config']['client'], manual_options, filter_list, ignore_empty_list)
44 action.do_singleton_action(dry_run=ctx.obj['dry_run'])