Skip to content

Commit 4c17aeb

Browse files
authored
Merge pull request #219 from ligangty/re-checksum
Add cf sub commands
2 parents 44d173b + 9350aba commit 4c17aeb

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

charon/cmd/__init__.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from charon.cmd.cmd_delete import delete
1919
from charon.cmd.cmd_index import index
2020
from charon.cmd.cmd_checksum import checksum_validate
21-
from charon.cmd.cmd_cache import cf_invalidate, cf_check
21+
from charon.cmd.cmd_cache import init_cf, cf
2222

2323

2424
@group()
@@ -34,5 +34,7 @@ def cli():
3434
cli.add_command(delete)
3535
cli.add_command(index)
3636
cli.add_command(checksum_validate)
37-
cli.add_command(cf_invalidate)
38-
cli.add_command(cf_check)
37+
38+
# init cf cmmand
39+
init_cf()
40+
cli.add_command(cf)

charon/cmd/cmd_cache.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from charon.cmd.internal import _decide_mode, _get_buckets
1919
from charon.cache import CFClient
2020
from charon.pkgs.pkg_utils import invalidate_cf_paths
21-
from click import command, option, argument
21+
from click import command, option, argument, group
2222
from typing import List, Tuple
2323

2424
import traceback
@@ -75,7 +75,7 @@
7575
default=False
7676
)
7777
@command()
78-
def cf_invalidate(
78+
def invalidate(
7979
target: str,
8080
paths: List[str],
8181
path_file: str,
@@ -161,7 +161,7 @@ def cf_invalidate(
161161
default=False
162162
)
163163
@command()
164-
def cf_check(
164+
def check(
165165
invalidation_id: str,
166166
target: str,
167167
quiet: bool = False,
@@ -214,3 +214,15 @@ def _init_cmd(target: str) -> Tuple[List[Tuple[str, str, str, str, str]], str]:
214214
sys.exit(1)
215215

216216
return (_get_buckets([target], conf), aws_profile)
217+
218+
219+
@group()
220+
def cf():
221+
"""cf commands are responsible for the CloudFront cache operations in
222+
products operated by Charon
223+
"""
224+
225+
226+
def init_cf():
227+
cf.add_command(invalidate)
228+
cf.add_command(check)

charon/pkgs/pkg_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def invalidate_cf_paths(
117117
non_completed[status] = ids
118118
logger.info(
119119
"The CF invalidating requests done, following requests "
120-
"are not completed yet:\n %s\nPlease use cf-check command to "
120+
"are not completed yet:\n %s\nPlease use 'cf check' command to "
121121
"check its details.", non_completed
122122
)
123123
logger.debug(

0 commit comments

Comments
 (0)