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).
This commit is contained in:
bctiemann 2026-03-03 16:12:39 -05:00 committed by GitHub
parent 53ea48efa9
commit 6eafffb497
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 3 deletions

View File

@ -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()