mirror of
https://github.com/ansible/awx.git
synced 2026-01-10 15:32:07 -03:30
Avoid using SmartFilter during migrations (#14786)
Our migrations that touch roles tend to bring in our real models via migration_utils.set_current_apps_for_migrations, and that can have some undesirable side-effects.
This commit is contained in:
parent
55c6a319dc
commit
36f3b46726
@ -5,6 +5,7 @@
|
||||
import copy
|
||||
import json
|
||||
import re
|
||||
import sys
|
||||
import urllib.parse
|
||||
|
||||
from jinja2 import sandbox, StrictUndefined
|
||||
@ -406,11 +407,13 @@ class SmartFilterField(models.TextField):
|
||||
# https://docs.python.org/2/library/stdtypes.html#truth-value-testing
|
||||
if not value:
|
||||
return None
|
||||
value = urllib.parse.unquote(value)
|
||||
try:
|
||||
SmartFilter().query_from_string(value)
|
||||
except RuntimeError as e:
|
||||
raise models.base.ValidationError(e)
|
||||
# avoid doing too much during migrations
|
||||
if 'migrate' not in sys.argv:
|
||||
value = urllib.parse.unquote(value)
|
||||
try:
|
||||
SmartFilter().query_from_string(value)
|
||||
except RuntimeError as e:
|
||||
raise models.base.ValidationError(e)
|
||||
return super(SmartFilterField, self).get_prep_value(value)
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user