Projet

Général

Profil

0001-misc-use-uwsgi-spooler-when-provisionning-through-HT.patch

Emmanuel Cazenave, 15 juillet 2021 17:45

Télécharger (1,51 ko)

Voir les différences:

Subject: [PATCH] misc: use uwsgi spooler when provisionning through HTTP
 (#55571)

 wcs/api.py | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
wcs/api.py
32 32
from wcs.carddef import CardDef
33 33
from wcs.categories import Category
34 34
from wcs.conditions import Condition, ValidationError
35
from wcs.ctl.hobo_notify import CmdHoboNotify
35 36
from wcs.data_sources import NamedDataSource
36 37
from wcs.data_sources import get_object as get_data_source_object
37 38
from wcs.formdef import FormDef
......
1294 1295
    return JsonResponse(hint)
1295 1296

  
1296 1297

  
1298
class ProvisionAfterJob(AfterJob):
1299
    def __init__(self, json_data, **kwargs):
1300
        super().__init__(**kwargs)
1301
        self.json_data = json_data
1302

  
1303
    def execute(self):
1304
        CmdHoboNotify().process_notification(self.json_data)
1305

  
1306

  
1297 1307
def provisionning(request):
1298 1308
    if not is_url_signed():
1299 1309
        raise AccessForbiddenError()
1300
    from wcs.ctl.hobo_notify import CmdHoboNotify
1301 1310

  
1302
    CmdHoboNotify().process_notification(get_request().json)
1311
    job = ProvisionAfterJob(json_data=get_request().json)
1312
    job.run(spool=True)
1303 1313
    return JsonResponse({'err': 0})
1304
-