Skip to content

Commit e3c908a

Browse files
daviddavisdralley
authored andcommitted
Add log statements to package signing task
Adds informational and debug log messages around package signing, mirroring the troubleshooting coverage already present in pulp_deb. The new logs cover the active signing fingerprint, the cases where a package is already signed or a previously-signed result is reused, and the per-repository entry point for signed_add_and_remove. Assisted-by: Claude (GitHub Copilot)
1 parent 194f024 commit e3c908a

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

CHANGES/+package-signing-logs.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Added log statements throughout the package signing task to aid troubleshooting and debugging.

pulp_rpm/app/tasks/signing.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ def _verify_package_fingerprint(path, signing_fingerprint):
6666
if raw_fingerprint.upper().endswith(candidate.upper()):
6767
return True
6868

69+
log.debug(
70+
f"Fingerprint mismatch for {path}: expected {raw_fingerprint}, "
71+
f"found key IDs {key_ids} and fingerprints {fingerprints}."
72+
)
6973
return False
7074

7175

@@ -81,6 +85,7 @@ def _update_signing_keys(package_file, keys):
8185
def _sign_file(package_file, signing_service, signing_fingerprint):
8286
"""Sign a package and return the local path of the signed file."""
8387
prefix, raw_fingerprint = signing_fingerprint.split(":", 1)
88+
log.info(f"Signing package {package_file.name} with fingerprint {signing_fingerprint}.")
8489
result = signing_service.sign(
8590
package_file.name,
8691
env_vars={"PULP_SIGNING_FINGERPRINT_TYPE": prefix},
@@ -120,6 +125,7 @@ def _sign_package(package, signing_service, signing_fingerprint):
120125

121126
# check if the package is already signed with our fingerprint
122127
if _verify_package_fingerprint(final_package.name, signing_fingerprint):
128+
log.info(f"Package {package.filename} is already signed with {signing_fingerprint}.")
123129
return None
124130

125131
# check if the package has been signed in the past with our fingerprint and replace
@@ -128,6 +134,7 @@ def _sign_package(package, signing_service, signing_fingerprint):
128134
original_package_sha256=content_artifact.artifact.sha256,
129135
package_signing_fingerprint=signing_fingerprint,
130136
).first():
137+
log.info(f"Reusing previously signed package for {package.filename}.")
131138
return (package_id, str(existing_result.result_package.pk))
132139

133140
# create a new signed version of the package
@@ -222,6 +229,9 @@ def signed_add_and_remove(
222229
repo = RpmRepository.objects.get(pk=repository_pk)
223230

224231
if repo.package_signing_service:
232+
log.info(
233+
f"Signing packages for repository {repo.name} with {repo.package_signing_service}."
234+
)
225235
add_content_units = set(add_content_units)
226236
packages = list(Package.objects.filter(pk__in=add_content_units).all())
227237

0 commit comments

Comments
 (0)