|
|
|
@ -29,25 +29,6 @@ def default_cluster():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Asset(models.Model):
|
|
|
|
|
# Todo: Move them to settings
|
|
|
|
|
STATUS_CHOICES = (
|
|
|
|
|
('In use', _('In use')),
|
|
|
|
|
('Out of use', _('Out of use')),
|
|
|
|
|
)
|
|
|
|
|
TYPE_CHOICES = (
|
|
|
|
|
('Server', _('Server')),
|
|
|
|
|
('VM', _('VM')),
|
|
|
|
|
('Switch', _('Switch')),
|
|
|
|
|
('Router', _('Router')),
|
|
|
|
|
('Firewall', _('Firewall')),
|
|
|
|
|
('Storage', _("Storage")),
|
|
|
|
|
)
|
|
|
|
|
ENV_CHOICES = (
|
|
|
|
|
('Prod', _('Production')),
|
|
|
|
|
('Dev', _('Development')),
|
|
|
|
|
('Test', _('Testing')),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Important
|
|
|
|
|
id = models.UUIDField(default=uuid.uuid4, primary_key=True)
|
|
|
|
|
ip = models.GenericIPAddressField(max_length=32, verbose_name=_('IP'), db_index=True)
|
|
|
|
@ -56,18 +37,12 @@ class Asset(models.Model):
|
|
|
|
|
groups = models.ManyToManyField(AssetGroup, blank=True, related_name='assets', verbose_name=_('Asset groups'))
|
|
|
|
|
cluster = models.ForeignKey(Cluster, related_name='assets', default=default_cluster, on_delete=models.SET_DEFAULT, verbose_name=_('Cluster'))
|
|
|
|
|
is_active = models.BooleanField(default=True, verbose_name=_('Is active'))
|
|
|
|
|
type = models.CharField(choices=TYPE_CHOICES, max_length=16, blank=True, null=True, default='Server', verbose_name=_('Asset type'),)
|
|
|
|
|
env = models.CharField(choices=ENV_CHOICES, max_length=8, blank=True, null=True, default='Prod', verbose_name=_('Asset environment'),)
|
|
|
|
|
status = models.CharField(choices=STATUS_CHOICES, max_length=12, null=True, blank=True, default='In use', verbose_name=_('Asset status'))
|
|
|
|
|
|
|
|
|
|
# Auth
|
|
|
|
|
admin_user = models.ForeignKey('assets.AdminUser', null=True, blank=True, on_delete=models.SET_NULL, verbose_name=_("Admin user"))
|
|
|
|
|
|
|
|
|
|
# Some information
|
|
|
|
|
public_ip = models.GenericIPAddressField(max_length=32, blank=True, null=True, verbose_name=_('Public IP'))
|
|
|
|
|
remote_card_ip = models.CharField(max_length=16, null=True, blank=True, verbose_name=_('Remote control card IP'))
|
|
|
|
|
cabinet_no = models.CharField(max_length=32, null=True, blank=True, verbose_name=_('Cabinet number'))
|
|
|
|
|
cabinet_pos = models.IntegerField(null=True, blank=True, verbose_name=_('Cabinet position'))
|
|
|
|
|
number = models.CharField(max_length=32, null=True, blank=True, verbose_name=_('Asset number'))
|
|
|
|
|
|
|
|
|
|
# Collect
|
|
|
|
@ -89,7 +64,6 @@ class Asset(models.Model):
|
|
|
|
|
hostname_raw = models.CharField(max_length=128, blank=True, null=True, verbose_name=_('Hostname raw'))
|
|
|
|
|
|
|
|
|
|
labels = models.ManyToManyField('assets.Label', blank=True, related_name='assets', verbose_name=_("Labels"))
|
|
|
|
|
|
|
|
|
|
created_by = models.CharField(max_length=32, null=True, blank=True, verbose_name=_('Created by'))
|
|
|
|
|
date_created = models.DateTimeField(auto_now_add=True, null=True, blank=True, verbose_name=_('Date created'))
|
|
|
|
|
comment = models.TextField(max_length=128, default='', blank=True, verbose_name=_('Comment'))
|
|
|
|
|