Add queue to file server tasks

This commit is contained in:
Jan Dittberner 2023-05-07 14:41:56 +02:00
parent 27e9d27b2b
commit 175ffd19f4

View file

@ -157,8 +157,7 @@ def handle_user_created(sender, instance, created, **kwargs):
"""
if created:
chain = (
create_ldap_user.s(
task_ldap_1 = create_ldap_user.s(
instance.username,
instance.uid,
instance.group.gid,
@ -166,13 +165,17 @@ def handle_user_created(sender, instance, created, **kwargs):
instance.homedir,
instance.shell,
None,
).set(queue="ldap")
task_file_1 = setup_file_sftp_userdir_chained.s().set(queue="file")
task_file_2 = setup_file_mail_userdir_chained.s().set(queue="file")
chain = task_ldap_1 | task_file_1 | task_file_2
task_result = TaskResult.objects.create_task_result(
"handle_user_created", chain
)
| setup_file_sftp_userdir_chained.s()
| (setup_file_mail_userdir_chained.s())
)
taskresult = TaskResult.objects.create_task_result("handle_user_created", chain)
_LOGGER.info(
"LDAP user creation has been requested in task %s", taskresult.task_id
"LDAP user creation has been requested in task %s", task_result.task_id
)
_LOGGER.debug("user %s has been %s", instance, created and "created" or "updated")