Skip to content

Commit 96684b7

Browse files
committed
Add is_radas_enabled unified method to check radas enablement
1 parent 947f23c commit 96684b7

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

charon/config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,9 @@ def get_detach_signature_command(self) -> str:
158158
def is_aws_cf_enable(self) -> bool:
159159
return self.__aws_cf_enable
160160

161+
def is_radas_enabled(self) -> bool:
162+
return bool(self.__radas_config__ and self.__radas_config__.validate())
163+
161164
def get_radas_config(self) -> Optional[RadasConfig]:
162165
return self.__radas_config__
163166

charon/pkgs/maven.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,7 @@ def handle_maven_uploading(
416416
if not conf:
417417
sys.exit(1)
418418

419-
rconf = conf.get_radas_config()
420-
if rconf and rconf.validate():
419+
if conf.is_radas_enabled():
421420
logger.info("Start generating radas signature files for s3 bucket %s\n", bucket_name)
422421
(_failed_metas, _generated_signs) = radas_signature.generate_radas_sign(
423422
top_level=top_level, sign_result_loc=sign_result_loc

charon/pkgs/radas_signature_handler.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,11 @@ def on_start(self, event: Event) -> None:
4949
On start callback
5050
"""
5151
conf = get_config()
52-
rconf = conf.get_radas_config() if conf else None
53-
if not rconf:
52+
if not (conf and conf.is_radas_enabled()):
53+
sys.exit(1)
54+
55+
rconf = conf.get_radas_config()
56+
if rconf is None:
5457
sys.exit(1)
5558
conn = event.container.connect(rconf.umb_target())
5659
event.container.create_receiver(conn, rconf.result_queue())

0 commit comments

Comments
 (0)