Browse Source
Revert "Add tasks for abonapp"
Revert "Add tasks for abonapp"
This reverts commit 94cdf1fd64.
Bad commit. Cirkullar dependency
devel
2 changed files with 30 additions and 50 deletions
@ -1,46 +0,0 @@ |
|||
from celery import shared_task |
|||
from abonapp.models import Abon |
|||
from djing.lib import LogicError |
|||
from gw_app.nas_managers import NasFailedResult, NasNetworkError |
|||
|
|||
|
|||
@shared_task |
|||
def user_remove_from_gw(user_id: int): |
|||
try: |
|||
user = Abon.objects.get(pk=user_id) |
|||
agent_abon = user.build_agent_struct() |
|||
if agent_abon is not None: |
|||
mngr = user.nas.get_nas_manager() |
|||
mngr.remove_user(agent_abon) |
|||
except ( |
|||
Abon.DoesNotExist, NasFailedResult, |
|||
NasNetworkError, ConnectionResetError, LogicError |
|||
): |
|||
pass |
|||
|
|||
|
|||
@shared_task |
|||
def user_add_to_gw(user_id: int): |
|||
try: |
|||
user = Abon.objects.get(pk=user_id) |
|||
agent_abon = user.build_agent_struct() |
|||
if agent_abon is not None: |
|||
mngr = user.nas.get_nas_manager() |
|||
mngr.add_user(agent_abon) |
|||
except ( |
|||
Abon.DoesNotExist, NasFailedResult, |
|||
NasNetworkError, ConnectionResetError, LogicError |
|||
): |
|||
pass |
|||
|
|||
|
|||
@shared_task |
|||
def user_nas_sync(user_id: int): |
|||
try: |
|||
user = Abon.objects.get(pk=user_id) |
|||
agent_abon = user.build_agent_struct() |
|||
if agent_abon is not None: |
|||
mngr = user.nas.get_nas_manager() |
|||
mngr.update_user(agent_abon) |
|||
except (NasFailedResult, NasNetworkError, ConnectionResetError, LogicError) as e: |
|||
return 'ERROR:%s' % e |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue