Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 11 additions & 21 deletions charon/cmd/cmd_sign.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
from typing import List

from charon.config import get_config
from charon.pkgs.radas_signature_handler import sign_in_radas
from charon.cmd.internal import (
_decide_mode, _safe_delete
)
from charon.pkgs.radas_sign import sign_in_radas
from charon.cmd.internal import _decide_mode

from click import command, option, argument

import traceback
Expand All @@ -39,14 +38,16 @@
"-r",
help="""
The requester who sends the signing request.
"""
""",
required=True
)
@option(
"--result_path",
"-p",
help="""
The path which will save the sign result file.
"""
""",
required=True
)
@option(
"--ignore_patterns",
Expand All @@ -57,14 +58,6 @@
not be allowed to upload to S3. Can accept more than one pattern.
"""
)
@option(
"--work_dir",
"-w",
help="""
The temporary working directory into which archives should
be extracted, when needed.
"""
)
@option(
"--config",
"-c",
Expand All @@ -79,7 +72,8 @@
help="""
rpm-sign key to be used, will replace {{ key }} in default configuration for signature.
Does noting if detach_signature_command does not contain {{ key }} field.
"""
""",
required=True
)
@option(
"--debug",
Expand All @@ -100,10 +94,9 @@ def sign(
repo_url: str,
requester: str,
result_path: str,
sign_key: str,
ignore_patterns: List[str] = None,
work_dir: str = None,
config: str = None,
sign_key: str = "redhatdevel",
debug=False,
quiet=False,
dryrun=False
Expand All @@ -112,7 +105,6 @@ def sign(
radas service. The repo_url points to the maven zip repository
in quay.io, which will be sent as the source of the signing.
"""
tmp_dir = work_dir
logger.debug("%s", ignore_patterns)
try:
current = datetime.datetime.now().strftime("%Y%m%d%I%M")
Expand All @@ -139,10 +131,8 @@ def sign(
"ignore_patterns": ig_patterns,
"radas_config": radas_conf
}
logger.debug("params: %s", args)
sign_in_radas(**args) # type: ignore
except Exception:
print(traceback.format_exc())
sys.exit(2)
finally:
if not debug and tmp_dir:
_safe_delete(tmp_dir)
18 changes: 10 additions & 8 deletions charon/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,34 +75,36 @@ def validate(self) -> bool:
return True

def umb_target(self) -> str:
return f"amqps://{self.__umb_host}:{self.__umb_host_port}"
return f"amqps://{self.__umb_host.strip()}:{self.__umb_host_port}"

def result_queue(self) -> str:
return self.__result_queue
return self.__result_queue.strip()

def request_queue(self) -> str:
return self.__request_queue
return self.__request_queue.strip()

def client_ca(self) -> str:
return self.__client_ca
return self.__client_ca.strip()

def client_key(self) -> str:
return self.__client_key
return self.__client_key.strip()

def client_key_password(self) -> str:
pass_file = self.__client_key_pass_file
if os.access(pass_file, os.R_OK):
with open(pass_file, "r") as f:
return f.read()
return f.read().strip()
elif pass_file:
logger.warning("The key password file is not accessible. Will ignore the password.")
return ""

def root_ca(self) -> str:
return self.__root_ca
return self.__root_ca.strip()

def quay_radas_registry_config(self) -> Optional[str]:
return self.__quay_radas_registry_config
if self.__quay_radas_registry_config:
return self.__quay_radas_registry_config.strip()
return None

def radas_sign_timeout_retry_count(self) -> int:
return self.__radas_sign_timeout_retry_count
Expand Down
2 changes: 1 addition & 1 deletion charon/pkgs/maven.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from charon.utils.files import HashType
import charon.pkgs.indexing as indexing
import charon.pkgs.signature as signature
import charon.pkgs.radas_signature_handler as radas_signature
import charon.pkgs.radas_sign as radas_signature
from charon.utils.files import overwrite_file, digest, write_manifest
from charon.utils.archive import extract_zip_all
from charon.utils.strings import remove_prefix
Expand Down
Loading