From 6eafffb49723263c8e343b7bf9c50337efe725fb Mon Sep 17 00:00:00 2001 From: bctiemann Date: Tue, 3 Mar 2026 16:12:39 -0500 Subject: [PATCH] Closes: #21304 - Add stronger deprecation warning on use of housekeeping management command (#21483) * Add stronger deprecation warning on use of housekeeping management command * Add stronger deprecation warning on use of housekeeping management command * Rework deprecation warning to use FutureWarning (not DeprecationWarning as that is ignored in non-dev environments). --- netbox/extras/management/commands/housekeeping.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/netbox/extras/management/commands/housekeeping.py b/netbox/extras/management/commands/housekeeping.py index 0d8a7e0b9..63a5e5b61 100644 --- a/netbox/extras/management/commands/housekeeping.py +++ b/netbox/extras/management/commands/housekeeping.py @@ -1,3 +1,4 @@ +import warnings from datetime import timedelta from importlib import import_module @@ -17,11 +18,12 @@ class Command(BaseCommand): help = "Perform nightly housekeeping tasks [DEPRECATED]" def handle(self, *args, **options): - self.stdout.write( + warnings.warn( + "\n\nDEPRECATION WARNING\n" "Running this command is no longer necessary: All housekeeping tasks\n" "are addressed automatically via NetBox's built-in job scheduler. It\n" - "will be removed in a future release.", - self.style.WARNING + "will be removed in a future release.\n", + category=FutureWarning, ) config = Config()