ranger/orm/services/image_manager/ims/hooks/service_hooks.py
hosingh000 3de38762aa initial commit
Change-Id: Ie417df96258c2daa852d14e588de4ad2d54bb819
2017-07-27 09:14:42 -05:00

13 lines
495 B
Python
Executable File

from orm_common.hooks.transaction_id_hook import TransactionIdHook
from orm_common.utils import utils
class TransIdHook(TransactionIdHook):
def before(self, state):
transaction_id = utils.make_transid()
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)