This commit is contained in:
Mateusz Gruszczyński
2025-10-27 07:25:48 +01:00
parent 62537ce93c
commit 519f7ac5f2

View File

@@ -571,6 +571,10 @@ class CertPusher:
source_key_path = self.get_key_path(section, source_cert_path)
# Show which certificate we're using
logger.info(f"Source certificate: {source_cert_path}")
logger.info(f"Source key: {source_key_path}")
if not os.path.exists(source_key_path):
logger.error(f"Private key not found: {source_key_path}")
return False
@@ -578,12 +582,25 @@ class CertPusher:
# Load source certificate for comparison
source_cert = self.cert_manager.get_cert_from_file(source_cert_path)
if source_cert:
# Show source cert details
source_serial = format(source_cert.serial_number, 'X').upper()
logger.info(f"Source cert serial: {source_serial}")
logger.info(f"Source cert expires: {source_cert.not_valid_after_utc}")
else:
logger.error("Failed to load source certificate")
return False
# Get check URL if available
check_url = self.config.get(section, 'check_url', fallback=None)
# Check if we should verify before upload
check_first = self.config.getboolean(section, 'check_before_upload', fallback=True)
logger.info(f"Check before upload: {check_first}")
if check_url:
logger.info(f"Check URL: {check_url}")
proxmox = ProxmoxManager(hostname, port, username, ssh_key)
if not proxmox.connect():
@@ -591,19 +608,25 @@ class CertPusher:
return False
# Upload with optional checking
if not proxmox.upload_certificate(source_cert_path, source_key_path,
check_first, source_cert, check_url):
proxmox.disconnect()
result = proxmox.upload_certificate(source_cert_path, source_key_path,
check_first, source_cert, check_url)
proxmox.disconnect()
if result:
# Check if it was actually uploaded or skipped
# This is a bit tricky - we need to track this in upload_certificate
self.stats['uploaded'] += 1
logger.info(f"✓ Proxmox processed successfully")
return True
else:
self.stats['failed'] += 1
return False
proxmox.disconnect()
self.stats['uploaded'] += 1
logger.info(f"✓ Proxmox processed successfully")
return True
except Exception as e:
logger.error(f"Proxmox processing failed: {e}")
import traceback
logger.debug(traceback.format_exc())
self.stats['failed'] += 1
return False