Skip to content

Commit 6d1dedc

Browse files
Sebastian Wagnerwaldbauer-certat
authored andcommitted
BUG: lib/upgrades: fix bots file removal with dry run
we definitely do not want to remove files in dry run or upon test runs
1 parent f78d749 commit 6d1dedc

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

intelmq/lib/upgrades.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,8 +583,11 @@ def v300_bots_file_removal(defaults, runtime, harmonization, dry_run):
583583
messages = []
584584
bots_file = Path(os.path.join(CONFIG_DIR, "BOTS"))
585585
if bots_file.exists():
586-
bots_file.unlink()
587-
changed = True
586+
if dry_run:
587+
print('Would now remove file {bots_file!r}.')
588+
else:
589+
bots_file.unlink()
590+
changed = True
588591
messages = ' '.join(messages)
589592
return messages if messages else changed, defaults, runtime, harmonization
590593

0 commit comments

Comments
 (0)