mirror of
https://github.com/ansible/awx.git
synced 2026-03-01 00:38:45 -03:30
properly migrate the CyberArk AIM type to its new name
This commit is contained in:
@@ -1,12 +1,23 @@
|
|||||||
# Generated by Django 2.2.4 on 2019-10-16 19:51
|
# Generated by Django 2.2.4 on 2019-10-16 19:51
|
||||||
|
|
||||||
from django.db import migrations
|
from django.db import migrations
|
||||||
|
from awx.main.models import CredentialType
|
||||||
|
|
||||||
|
|
||||||
def update_cyberark_aim_name(apps, schema_editor):
|
def update_cyberark_aim_name(apps, schema_editor):
|
||||||
apps.get_model('main', 'CredentialType').objects.filter(namespace='aim').update(
|
CredentialType.setup_tower_managed_defaults()
|
||||||
name='CyberArk AIM Central Credential Provider Lookup'
|
aim_types = apps.get_model('main', 'CredentialType').objects.filter(
|
||||||
)
|
namespace='aim'
|
||||||
|
).order_by('id')
|
||||||
|
|
||||||
|
if aim_types.count() == 2:
|
||||||
|
original, renamed = aim_types.all()
|
||||||
|
apps.get_model('main', 'Credential').objects.filter(
|
||||||
|
credential_type_id=original.id
|
||||||
|
).update(
|
||||||
|
credential_type_id=renamed.id
|
||||||
|
)
|
||||||
|
original.delete()
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|||||||
Reference in New Issue
Block a user