mirror of
https://github.com/ansible/awx.git
synced 2026-03-09 21:49:27 -02:30
short-circuit middleware if migration loading url
* Had to monkey patch django middleware logic. * Left checks to tell coders to use new middleware behavior in favor of monkey patching.
This commit is contained in:
@@ -20,6 +20,7 @@ from django.shortcuts import get_object_or_404, redirect
|
||||
from django.apps import apps
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.urls import resolve
|
||||
|
||||
from awx.main.models import ActivityStream
|
||||
from awx.main.utils.named_url_graph import generate_graph, GraphNode
|
||||
@@ -193,5 +194,6 @@ class MigrationRanCheckMiddleware(object):
|
||||
def process_request(self, request):
|
||||
executor = MigrationExecutor(connection)
|
||||
plan = executor.migration_plan(executor.loader.graph.leaf_nodes())
|
||||
if bool(plan) and 'migrations_notran' not in request.path:
|
||||
if bool(plan) and \
|
||||
getattr(resolve(request.path), 'url_name', '') != 'migrations_notran':
|
||||
return redirect(reverse("ui:migrations_notran"))
|
||||
|
||||
Reference in New Issue
Block a user