Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Async fix #1512

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stix_shifter_modules/msatp/stix_transmission/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ async def create_results_connection(self, query, offset, length):
async def api_run(q):
return await self.api_client_run_search(q, length, offset)

return util.post_process(response_data, return_obj, api_run)
return await util.post_process(response_data, return_obj, api_run)
except Exception as ex:
if response_txt is not None:
ErrorResponder.fill_error(return_obj, message='unexpected exception', connector=self.connector)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def join_query_with_other_tables(self, query, include_alerts=True):
query = ConnectorPostProcessing.DEVICE_NETWORK_QUERY.format(query)
return query

def post_process(self, response_data, return_obj, api_client_run_search):
async def post_process(self, response_data, return_obj, api_client_run_search):
response_data = merge_alerts(response_data)
for event_data in response_data:
table = event_data.get('TableName')
Expand All @@ -194,7 +194,7 @@ def post_process(self, response_data, return_obj, api_client_run_search):
# query events table according to alert fields
joined_query = self.join_alert_with_events(timestamp, device_name, report_id)
print("joining alert with events: ", joined_query)
events_data = api_client_run_search(joined_query)
events_data = await api_client_run_search(joined_query)
if len(events_data) == 0:
# if only alert - assign the alert title to x-oca-event
event_data['ActionType'] = event_data.get("Title")
Expand Down