mirror of
https://github.com/ansible/awx.git
synced 2026-04-14 06:29:25 -02:30
Merge pull request #10619 from wenottingham/dont-think-we-need-this
Delete some old code related to the reencryption migration We've moved past the point where this code would still be live. ISSUE TYPE Bugfix Pull Request COMPONENT NAME API AWX VERSION current ADDITIONAL INFORMATION We could probably squash more of these? Reviewed-by: Alan Rominger <arominge@redhat.com>
This commit is contained in:
@@ -5,10 +5,6 @@ from __future__ import unicode_literals
|
||||
# Django
|
||||
from django.db import migrations
|
||||
|
||||
# AWX
|
||||
from awx.main.migrations import _migration_utils as migration_utils
|
||||
from awx.main.migrations._reencrypt import blank_old_start_args
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
@@ -17,6 +13,8 @@ class Migration(migrations.Migration):
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(migration_utils.set_current_apps_for_migrations, migrations.RunPython.noop),
|
||||
migrations.RunPython(blank_old_start_args, migrations.RunPython.noop),
|
||||
# This list is intentionally empty.
|
||||
# Tower 3.3 included several data migrations that are no longer
|
||||
# necessary (this list is now empty because Tower 3.3 is past EOL and
|
||||
# cannot be directly upgraded to modern versions)
|
||||
]
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
import logging
|
||||
|
||||
from awx.conf.migrations._reencrypt import (
|
||||
decrypt_field,
|
||||
)
|
||||
|
||||
logger = logging.getLogger('awx.main.migrations')
|
||||
|
||||
__all__ = []
|
||||
|
||||
|
||||
def blank_old_start_args(apps, schema_editor):
|
||||
UnifiedJob = apps.get_model('main', 'UnifiedJob')
|
||||
for uj in UnifiedJob.objects.defer('result_stdout_text').exclude(start_args='').iterator():
|
||||
if uj.status in ['running', 'pending', 'new', 'waiting']:
|
||||
continue
|
||||
try:
|
||||
args_dict = decrypt_field(uj, 'start_args')
|
||||
except ValueError:
|
||||
args_dict = None
|
||||
if args_dict == {}:
|
||||
continue
|
||||
if uj.start_args:
|
||||
logger.debug('Blanking job args for %s', uj.pk)
|
||||
uj.start_args = ''
|
||||
uj.save()
|
||||
Reference in New Issue
Block a user