|
|
|
@ -9,7 +9,7 @@ from common.utils import get_logger
|
|
|
|
|
from common.utils.timezone import local_now_display |
|
|
|
|
from ops.celery.decorator import after_app_ready_start |
|
|
|
|
from ops.celery.utils import ( |
|
|
|
|
create_or_update_celery_periodic_tasks, disable_celery_periodic_task |
|
|
|
|
create_or_update_celery_periodic_tasks, delete_celery_periodic_task |
|
|
|
|
) |
|
|
|
|
from orgs.models import Organization |
|
|
|
|
from settings.notifications import LDAPImportMessage |
|
|
|
@ -69,6 +69,7 @@ def import_ldap_user_periodic():
|
|
|
|
|
if not settings.AUTH_LDAP: |
|
|
|
|
return |
|
|
|
|
task_name = 'import_ldap_user_periodic' |
|
|
|
|
delete_celery_periodic_task(task_name) |
|
|
|
|
if not settings.AUTH_LDAP_SYNC_IS_PERIODIC: |
|
|
|
|
return |
|
|
|
|
|
|
|
|
@ -85,8 +86,7 @@ def import_ldap_user_periodic():
|
|
|
|
|
task_name: { |
|
|
|
|
'task': import_ldap_user.name, |
|
|
|
|
'interval': interval, |
|
|
|
|
'crontab': crontab, |
|
|
|
|
'enabled': True, |
|
|
|
|
'crontab': crontab |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
create_or_update_celery_periodic_tasks(tasks) |
|
|
|
|