Coverage for curator/cli_singletons/open_indices.py: 100%

11 statements  

« prev     ^ index     » next       coverage.py v7.3.0, created at 2023-08-16 15:27 -0600

1"""Open (closed) Index Singleton""" 

2import click 

3from curator.cli_singletons.object_class import cli_action 

4from curator.cli_singletons.utils import get_width, validate_filter_json 

5 

6@click.command(name='open', context_settings=get_width()) 

7@click.option( 

8 '--ignore_empty_list', 

9 is_flag=True, 

10 help='Do not raise exception if there are no actionable indices' 

11) 

12@click.option( 

13 '--allow_ilm_indices/--no-allow_ilm_indices', 

14 help='Allow Curator to operate on Index Lifecycle Management monitored indices.', 

15 default=False, 

16 show_default=True 

17) 

18@click.option( 

19 '--filter_list', 

20 callback=validate_filter_json, 

21 help='JSON array of filters selecting indices to act on.', 

22 required=True 

23) 

24@click.pass_context 

25def open_indices(ctx, ignore_empty_list, allow_ilm_indices, filter_list): 

26 """ 

27 Open Indices 

28 """ 

29 # ctx.info_name is the name of the function or name specified in @click.command decorator 

30 action = cli_action( 

31 ctx.info_name, 

32 ctx.obj['config']['client'], 

33 {'allow_ilm_indices':allow_ilm_indices}, 

34 filter_list, 

35 ignore_empty_list 

36 ) 

37 action.do_singleton_action(dry_run=ctx.obj['dry_run'])