Propagate the token in procedures and event hooks to make sure that the inner requests can be executed
This commit is contained in:
parent
ab41b9d5f4
commit
0288f7ee1b
2 changed files with 8 additions and 0 deletions
|
@ -147,12 +147,16 @@ class EventHook(object):
|
||||||
runs the hook actions if the condition is met """
|
runs the hook actions if the condition is met """
|
||||||
|
|
||||||
result = self.matches_event(event)
|
result = self.matches_event(event)
|
||||||
|
token = Config.get('token')
|
||||||
|
|
||||||
if result.is_match:
|
if result.is_match:
|
||||||
logger.info('Running hook {} triggered by an event'.format(self.name))
|
logger.info('Running hook {} triggered by an event'.format(self.name))
|
||||||
|
|
||||||
for action in self.actions:
|
for action in self.actions:
|
||||||
a = EventAction.build(action)
|
a = EventAction.build(action)
|
||||||
|
if token:
|
||||||
|
a.token = token
|
||||||
|
|
||||||
a.execute(event=event, **result.parsed_args)
|
a.execute(event=event, **result.parsed_args)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -99,8 +99,12 @@ class Procedure(object):
|
||||||
|
|
||||||
logger.info('Executing request {}'.format(self.name))
|
logger.info('Executing request {}'.format(self.name))
|
||||||
response = Response()
|
response = Response()
|
||||||
|
token = Config.get('token')
|
||||||
|
|
||||||
for request in self.requests:
|
for request in self.requests:
|
||||||
|
if token:
|
||||||
|
request.token = token
|
||||||
|
|
||||||
context['async'] = self.async; context['n_tries'] = n_tries
|
context['async'] = self.async; context['n_tries'] = n_tries
|
||||||
response = request.execute(**context)
|
response = request.execute(**context)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue