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,22 +157,25 @@ def handle_user_created(sender, instance, created, **kwargs):
"""
if created:
chain = (
create_ldap_user.s(
instance.username,
instance.uid,
instance.group.gid,
instance.gecos,
instance.homedir,
instance.shell,
None,
)
| setup_file_sftp_userdir_chained.s()
| (setup_file_mail_userdir_chained.s())
task_ldap_1 = create_ldap_user.s(
instance.username,
instance.uid,
instance.group.gid,
instance.gecos,
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
)
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")