Coverage for curator/cli_singletons/close.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"""Close 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('--delete_aliases', is_flag=True, help='Delete all aliases from indices to be closed')
8@click.option('--skip_flush', is_flag=True, help='Skip flush phase for indices to be closed')
9@click.option(
10 '--ignore_empty_list',
11 is_flag=True,
12 help='Do not raise exception if there are no actionable indices'
13)
14@click.option(
15 '--allow_ilm_indices/--no-allow_ilm_indices',
16 help='Allow Curator to operate on Index Lifecycle Management monitored indices.',
17 default=False,
18 show_default=True
19)
20@click.option(
21 '--filter_list',
22 callback=validate_filter_json,
23 help='JSON array of filters selecting indices to act on.',
24 required=True
25)
26@click.pass_context
27def close(ctx, delete_aliases, skip_flush, ignore_empty_list, allow_ilm_indices, filter_list):
28 """
29 Close Indices
30 """
31 manual_options = {
32 'skip_flush': skip_flush,
33 'delete_aliases': delete_aliases,
34 'allow_ilm_indices': allow_ilm_indices,
35 }
36 # ctx.info_name is the name of the function or name specified in @click.command decorator
37 action = cli_action(
38 ctx.info_name, ctx.obj['config']['client'], manual_options, filter_list, ignore_empty_list)
39 action.do_singleton_action(dry_run=ctx.obj['dry_run'])