sources/ldap: make task names more consistent

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-12-03 18:39:42 +01:00
parent 8ddb62ed0f
commit 426cef998f
2 changed files with 4 additions and 3 deletions

View File

@ -1,6 +1,6 @@
"""Crypto tests""" """Crypto tests"""
import datetime import datetime
from os import makedirs, mkdir from os import makedirs
from tempfile import TemporaryDirectory from tempfile import TemporaryDirectory
from django.urls import reverse from django.urls import reverse
@ -189,7 +189,8 @@ class TestCrypto(APITestCase):
with open(f"{temp_dir}/foo.bar/privkey.pem", "w+", encoding="utf-8") as _key: with open(f"{temp_dir}/foo.bar/privkey.pem", "w+", encoding="utf-8") as _key:
_key.write(builder.private_key) _key.write(builder.private_key)
with CONFIG.patch("cert_discovery_dir", temp_dir): with CONFIG.patch("cert_discovery_dir", temp_dir):
certificate_discovery() # pyright: reportGeneralTypeIssues=false
certificate_discovery() # pylint: disable=no-value-for-parameter
self.assertTrue( self.assertTrue(
CertificateKeyPair.objects.filter(managed=MANAGED_DISCOVERED % "foo").exists() CertificateKeyPair.objects.filter(managed=MANAGED_DISCOVERED % "foo").exists()
) )

View File

@ -39,7 +39,7 @@ def ldap_sync(self: MonitoredTask, source_pk: str, sync_class: str):
# to set the state with # to set the state with
return return
sync = path_to_class(sync_class) sync = path_to_class(sync_class)
self.set_uid(f"{slugify(source.name)}-{sync.__name__}") self.set_uid(f"{slugify(source.name)}_{sync.__name__.replace('LDAPSynchronizer', '').lower()}")
try: try:
sync_inst = sync(source) sync_inst = sync(source)
count = sync_inst.sync() count = sync_inst.sync()