You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
692 B
Python
26 lines
692 B
Python
import logging
|
|
import django_lcore
|
|
from lambdainst.models import User
|
|
|
|
logger = logging.getLogger(__name__)
|
|
from celery import task
|
|
|
|
@task(autoretry_for=(Exception,), default_retry_delay=60*60)
|
|
def push_all_users():
|
|
for u in User.objects.all():
|
|
# skip 'empty' accounts
|
|
if u.vpnuser.expiration is None:
|
|
continue
|
|
|
|
logger.debug("pushing user %r", u)
|
|
|
|
django_lcore.sync_user(u.vpnuser, fail_silently=False)
|
|
|
|
@task(autoretry_for=(Exception,), max_retries=10, retry_backoff=True)
|
|
def push_user(user_id):
|
|
user = User.objects.get(id=user_id)
|
|
logger.debug("pushing user %r", user)
|
|
django_lcore.sync_user(user.vpnuser, fail_silently=False)
|
|
|
|
|