Upgrade to Django 5.2 LTS (#16185)

Upgrade to Django 5.2 LTS with compatibility fixes across fields, migrations, dispatch config, tests, and dev deps.

Dependencies:
- Upgrade django to 5.2.8 and relax requirements.in to >=5.2,<5.3.
- Bump django-debug-toolbar to >=6.0 for compatibility.

Backend:
- awx/conf/fields.py: switch URL TLD regex to use DomainNameValidator.ul in custom URLField.
- awx/main/management/commands/gather_analytics.py: use datetime.timezone.utc for naïve datetime handling.
- awx/main/dispatch/config.py: add mock_publish option; avoid DB access for test runs, set default max_workers, and support a noop broker.

Migrations (SQLite/Postgres compatibility):
- Add awx/main/migrations/_sqlite_helper.py with db-aware AlterIndexTogether/RenameIndex wrappers; consume in 0144_event_partitions.py and 0184_django_indexes.py.
- Update 0187_hop_nodes.py to use CheckConstraint(condition=...).
- Add 0205_alter_instance_peers_alter_job_hosts_and_more.py adjusting through_fields/relations on instance.peers, job.hosts, and role.ancestors.
- _dab_rbac.py: iterate roles with chunk_size=1000 for migration performance.

Tests:
Include hcp_terraform in default credential types in test_credential.py.
---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Alan Rominger <arominge@redhat.com>
This commit is contained in:
Hao Liu
2025-12-03 14:22:52 -05:00
committed by GitHub
parent 711b018ae7
commit b24156805a
12 changed files with 152 additions and 35 deletions

View File

@@ -1,9 +1,9 @@
import datetime
import logging
from awx.main import analytics
from dateutil import parser
from django.core.management.base import BaseCommand
from django.utils import timezone
class Command(BaseCommand):
@@ -38,10 +38,10 @@ class Command(BaseCommand):
since = parser.parse(opt_since) if opt_since else None
if since and since.tzinfo is None:
since = since.replace(tzinfo=timezone.utc)
since = since.replace(tzinfo=datetime.timezone.utc)
until = parser.parse(opt_until) if opt_until else None
if until and until.tzinfo is None:
until = until.replace(tzinfo=timezone.utc)
until = until.replace(tzinfo=datetime.timezone.utc)
if opt_ship and opt_dry_run:
self.logger.error('Both --ship and --dry-run cannot be processed at the same time.')