misc: use uwsgi spooler when provisionning through HTTP (#55571)
This commit is contained in:
parent
b335e49f67
commit
b26cf2d1b6
14
wcs/api.py
14
wcs/api.py
|
@ -32,6 +32,7 @@ from wcs.api_utils import get_query_flag, get_user_from_api_query_string, is_url
|
|||
from wcs.carddef import CardDef
|
||||
from wcs.categories import Category
|
||||
from wcs.conditions import Condition, ValidationError
|
||||
from wcs.ctl.hobo_notify import CmdHoboNotify
|
||||
from wcs.data_sources import NamedDataSource
|
||||
from wcs.data_sources import get_object as get_data_source_object
|
||||
from wcs.formdef import FormDef
|
||||
|
@ -1294,10 +1295,19 @@ def validate_condition(request, *args, **kwargs):
|
|||
return JsonResponse(hint)
|
||||
|
||||
|
||||
class ProvisionAfterJob(AfterJob):
|
||||
def __init__(self, json_data, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
self.json_data = json_data
|
||||
|
||||
def execute(self):
|
||||
CmdHoboNotify().process_notification(self.json_data)
|
||||
|
||||
|
||||
def provisionning(request):
|
||||
if not is_url_signed():
|
||||
raise AccessForbiddenError()
|
||||
from wcs.ctl.hobo_notify import CmdHoboNotify
|
||||
|
||||
CmdHoboNotify().process_notification(get_request().json)
|
||||
job = ProvisionAfterJob(json_data=get_request().json)
|
||||
job.run(spool=True)
|
||||
return JsonResponse({'err': 0})
|
||||
|
|
Loading…
Reference in New Issue