
This patch also removed transaction id hooks when calling RootController default get. As a result, uuids record will not be created. Change-Id: I2ca0be02256ec62c8f9d48266867cc44121c1c4b
23 lines
799 B
Python
Executable File
23 lines
799 B
Python
Executable File
from orm.common.orm_common.hooks.transaction_id_hook import TransactionIdHook
|
|
from orm.common.orm_common.utils import utils
|
|
|
|
from pecan import abort
|
|
|
|
|
|
class TransIdHook(TransactionIdHook):
|
|
|
|
def before(self, state):
|
|
try:
|
|
controller = str(state.controller)
|
|
if 'RootController._default' in controller:
|
|
return
|
|
else:
|
|
transaction_id = utils.make_transid()
|
|
except Exception as exc:
|
|
abort(500, headers={'faultstring': str(exc)})
|
|
|
|
tracking_id = state.request.headers['X-RANGER-Tracking-Id'] \
|
|
if 'X-RANGER-Tracking-Id' in state.request.headers else transaction_id
|
|
setattr(state.request, 'transaction_id', transaction_id)
|
|
setattr(state.request, 'tracking_id', tracking_id)
|