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
|
cert.certificate_data = cert_data
|
||||||
dirty = True
|
dirty = True
|
||||||
if name in private_keys:
|
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]
|
cert.key_data = private_keys[name]
|
||||||
dirty = True
|
dirty = True
|
||||||
if dirty:
|
if dirty:
|
||||||
|
|
|
@ -191,9 +191,12 @@ class TestCrypto(APITestCase):
|
||||||
with CONFIG.patch("cert_discovery_dir", temp_dir):
|
with CONFIG.patch("cert_discovery_dir", temp_dir):
|
||||||
# pyright: reportGeneralTypeIssues=false
|
# pyright: reportGeneralTypeIssues=false
|
||||||
certificate_discovery() # pylint: disable=no-value-for-parameter
|
certificate_discovery() # pylint: disable=no-value-for-parameter
|
||||||
self.assertTrue(
|
keypair: CertificateKeyPair = CertificateKeyPair.objects.filter(
|
||||||
CertificateKeyPair.objects.filter(managed=MANAGED_DISCOVERED % "foo").exists()
|
managed=MANAGED_DISCOVERED % "foo"
|
||||||
)
|
).first()
|
||||||
|
self.assertIsNotNone(keypair)
|
||||||
|
self.assertIsNotNone(keypair.certificate)
|
||||||
|
self.assertIsNotNone(keypair.private_key)
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
CertificateKeyPair.objects.filter(managed=MANAGED_DISCOVERED % "foo.bar").exists()
|
CertificateKeyPair.objects.filter(managed=MANAGED_DISCOVERED % "foo.bar").exists()
|
||||||
)
|
)
|
||||||
|
|
Reference in a new issue