crypto: fix private keys not being imported correctly
closes #1945 Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
f5459645a5
commit
2ca115285c
|
@ -79,7 +79,7 @@ def certificate_discovery(self: MonitoredTask):
|
|||
cert.certificate_data = cert_data
|
||||
dirty = True
|
||||
if name in private_keys:
|
||||
if cert.key_data == private_keys[name]:
|
||||
if cert.key_data != private_keys[name]:
|
||||
cert.key_data = private_keys[name]
|
||||
dirty = True
|
||||
if dirty:
|
||||
|
|
|
@ -191,9 +191,12 @@ class TestCrypto(APITestCase):
|
|||
with CONFIG.patch("cert_discovery_dir", temp_dir):
|
||||
# pyright: reportGeneralTypeIssues=false
|
||||
certificate_discovery() # pylint: disable=no-value-for-parameter
|
||||
self.assertTrue(
|
||||
CertificateKeyPair.objects.filter(managed=MANAGED_DISCOVERED % "foo").exists()
|
||||
)
|
||||
keypair: CertificateKeyPair = CertificateKeyPair.objects.filter(
|
||||
managed=MANAGED_DISCOVERED % "foo"
|
||||
).first()
|
||||
self.assertIsNotNone(keypair)
|
||||
self.assertIsNotNone(keypair.certificate)
|
||||
self.assertIsNotNone(keypair.private_key)
|
||||
self.assertTrue(
|
||||
CertificateKeyPair.objects.filter(managed=MANAGED_DISCOVERED % "foo.bar").exists()
|
||||
)
|
||||
|
|
Reference in New Issue