Skip to content
Open
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
10 changes: 6 additions & 4 deletions intelmq/bots/experts/asn_lookup/expert.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,12 @@ def update_database(cls, verbose=False):
raise MissingDependencyError("pyasn")

for database_path in set(bots.values()):
if not Path(database_path).is_file():
raise ValueError('Database file does not exist or is not a file.')
elif not os.access(database_path, os.W_OK):
raise ValueError('Database file is not writeable.')
database_file = Path(database_path)
if database_file.is_file():
# File exists, check if it's writeable
if not os.access(database_path, os.W_OK):
raise ValueError('Database file is not writeable.')
# If file doesn't exist, the directory will be created later when downloading

try:
if verbose:
Expand Down