mirror of
https://github.com/ansible/awx.git
synced 2024-10-31 23:51:09 +03:00
Adding JobOrigin model and migration.
This commit is contained in:
parent
1ae333ca1d
commit
ec7aa1867f
@ -475,4 +475,4 @@ class Migration(SchemaMigration):
|
||||
}
|
||||
}
|
||||
|
||||
complete_apps = ['main']
|
||||
complete_apps = ['main']
|
||||
|
@ -2,7 +2,9 @@
|
||||
# All Rights Reserved.
|
||||
|
||||
from django.db import models
|
||||
|
||||
from awx.main.managers import InstanceManager
|
||||
from awx.main.models import UnifiedJob
|
||||
|
||||
|
||||
class Instance(models.Model):
|
||||
@ -26,3 +28,21 @@ class Instance(models.Model):
|
||||
if self.primary:
|
||||
return 'primary'
|
||||
return 'secondary'
|
||||
|
||||
|
||||
class JobOrigin(models.Model):
|
||||
"""A model representing the relationship between a unified job and
|
||||
the instance that was responsible for starting that job.
|
||||
|
||||
It may be possible that a job has no origin (the common reason for this
|
||||
being that the job was started on Tower < 2.1 before origins were a thing).
|
||||
This is fine, and code should be able to handle it. A job with no origin
|
||||
is always assumed to *not* have the current instance as its origin.
|
||||
"""
|
||||
unified_job = models.ForeignKey(UnifiedJob)
|
||||
instance = models.ForeignKey(Instance)
|
||||
created = models.DateTimeField(auto_now_add=True)
|
||||
modified = models.DateTimeField(auto_now=True)
|
||||
|
||||
class Meta:
|
||||
app_label = 'main'
|
||||
|
Loading…
Reference in New Issue
Block a user