diff --git a/charon/cmd/__init__.py b/charon/cmd/__init__.py index b2cafd05..7c1ce846 100644 --- a/charon/cmd/__init__.py +++ b/charon/cmd/__init__.py @@ -18,7 +18,7 @@ from charon.cmd.cmd_delete import delete from charon.cmd.cmd_index import index from charon.cmd.cmd_checksum import checksum_validate -from charon.cmd.cmd_cache import cf_invalidate, cf_check +from charon.cmd.cmd_cache import init_cf, cf @group() @@ -34,5 +34,7 @@ def cli(): cli.add_command(delete) cli.add_command(index) cli.add_command(checksum_validate) -cli.add_command(cf_invalidate) -cli.add_command(cf_check) + +# init cf cmmand +init_cf() +cli.add_command(cf) diff --git a/charon/cmd/cmd_cache.py b/charon/cmd/cmd_cache.py index 95aae658..71fde471 100644 --- a/charon/cmd/cmd_cache.py +++ b/charon/cmd/cmd_cache.py @@ -18,7 +18,7 @@ from charon.cmd.internal import _decide_mode, _get_buckets from charon.cache import CFClient from charon.pkgs.pkg_utils import invalidate_cf_paths -from click import command, option, argument +from click import command, option, argument, group from typing import List, Tuple import traceback @@ -75,7 +75,7 @@ default=False ) @command() -def cf_invalidate( +def invalidate( target: str, paths: List[str], path_file: str, @@ -161,7 +161,7 @@ def cf_invalidate( default=False ) @command() -def cf_check( +def check( invalidation_id: str, target: str, quiet: bool = False, @@ -214,3 +214,15 @@ def _init_cmd(target: str) -> Tuple[List[Tuple[str, str, str, str, str]], str]: sys.exit(1) return (_get_buckets([target], conf), aws_profile) + + +@group() +def cf(): + """cf commands are responsible for the CloudFront cache operations in + products operated by Charon + """ + + +def init_cf(): + cf.add_command(invalidate) + cf.add_command(check) diff --git a/charon/pkgs/pkg_utils.py b/charon/pkgs/pkg_utils.py index 9325f14b..9d57def1 100644 --- a/charon/pkgs/pkg_utils.py +++ b/charon/pkgs/pkg_utils.py @@ -117,7 +117,7 @@ def invalidate_cf_paths( non_completed[status] = ids logger.info( "The CF invalidating requests done, following requests " - "are not completed yet:\n %s\nPlease use cf-check command to " + "are not completed yet:\n %s\nPlease use 'cf check' command to " "check its details.", non_completed ) logger.debug(