-
Notifications
You must be signed in to change notification settings - Fork 71
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
Improve OpenRelik File Download Handling and Folder Management #965
base: main
Are you sure you want to change the base?
Conversation
|
||
self.logger.info(f"Created folder {self.folder_id}") | ||
self.logger.info(f"Updating folder {self.folder_id}") | ||
_ = self.openrelik_folder_client.update_folder( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can skip the empty assignment here
if not self.folder_id or not self.openrelik_folder_client.folder_exists( | ||
self.folder_id | ||
): | ||
folder_id = self.openrelik_folder_client.create_root_folder( | ||
self.folder_id = self.openrelik_folder_client.create_root_folder( | ||
f"{self.incident_id}" | ||
) | ||
self.logger.info(f"Created folder {folder_id}") | ||
|
||
self.logger.info(f"Created folder {self.folder_id}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're using the same folder for all files, wouldn't we want this piece of logic to go in SetUp? It looks like there would be a race condition if multiple threads ran at the sam time.
Summary:
This PR enhances the OpenRelik processor by improving error handling during file downloads and streamlining folder management within OpenRelik. It also updates several dependencies.
Technical Details:
DownloadWorkflowOutput
function indftimewolf/lib/processors/openrelik.py
now uses the dedicatedopenrelik_api_client.download_file
function and explicitly handles cases where the download fails. It logs an error message and returnsNone
if the download is unsuccessful, preventing downstream errors and providing better feedback to the user.DownloadWorkflowOutput
has been updated tostr | None
to reflect the possible return ofNone
in case of download failure, enhancing type safety.