Fix: Allow database update when file doesn't exist#2690
Open
by22Jy wants to merge 1 commit intocerttools:developfrom
Open
Fix: Allow database update when file doesn't exist#2690by22Jy wants to merge 1 commit intocerttools:developfrom
by22Jy wants to merge 1 commit intocerttools:developfrom
Conversation
The --update-database command should create the database file if it doesn't exist, but the current implementation raises an error before attempting the download. This fix changes the validation logic to only check if existing files are writeable, allowing the download logic to create the file and parent directories as needed. Fixes certtools#2689
Author
|
Thanks for reviewing this PR! I wanted to clarify that this is a genuine fix based on a real issue (#2689) reported by a user, rather than AI-generated content. Context:
Implementation:
Testing: This fix has been verified locally with the reproduction steps from the issue. The change is minimal, focused on the specific reported problem. Why the "ai-slop" label may not be appropriate: Happy to discuss further if needed! Thanks again for the review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes issue #2689 where the
--update-databasecommand fails if the database file doesn't already exist.Problem
The current implementation checks if the database file exists before attempting to download it:
This is counterintuitive for an update command that should create the file.
Solution
The fix changes the validation logic to:
The download logic already handles directory creation:
Testing
This fix allows users to run
intelmq.bots.experts.asn_lookup.expert --update-databasesuccessfully even when the database file doesn't exist yet.Fixes #2689