mirror of
https://github.com/ansible/awx.git
synced 2026-03-20 10:27:34 -02:30
Give a distinct hostname to satisfy the new unique constraint for job
host summary, show that it is derived from a removed host
This commit is contained in:
@@ -8,11 +8,15 @@ from django.db import models
|
|||||||
class Migration(DataMigration):
|
class Migration(DataMigration):
|
||||||
|
|
||||||
def forwards(self, orm):
|
def forwards(self, orm):
|
||||||
|
idx = 0
|
||||||
for jhs in orm.JobHostSummary.objects.all():
|
for jhs in orm.JobHostSummary.objects.all():
|
||||||
print "JHS: Host: " + str(jhs.host)
|
print "JHS: Host: " + str(jhs.host)
|
||||||
if jhs.host is not None and jhs.host.active:
|
if jhs.host is not None and jhs.host.active:
|
||||||
jhs.host_name = jhs.host.name
|
jhs.host_name = jhs.host.name
|
||||||
jhs.save()
|
else:
|
||||||
|
jhs.host_name = "tower_deleted_host-%s" % str(idx)
|
||||||
|
jhs.save()
|
||||||
|
idx += 1
|
||||||
|
|
||||||
def backwards(self, orm):
|
def backwards(self, orm):
|
||||||
print("Not reversing jobhoststatus host_name field")
|
print("Not reversing jobhoststatus host_name field")
|
||||||
|
|||||||
Reference in New Issue
Block a user