mirror of
https://github.com/retspen/webvirtcloud
synced 2024-12-24 15:15:22 +00:00
UserAttributes.default_instances moved to django.conf.settings.NEW_USER_DEFAULT_INSTANCES
This commit is contained in:
parent
2ef672ffb5
commit
b7cd731fda
2 changed files with 7 additions and 8 deletions
|
@ -1,5 +1,6 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
|
from django.conf import settings
|
||||||
from instances.models import Instance
|
from instances.models import Instance
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,13 +31,6 @@ class UserAttributes(models.Model):
|
||||||
max_memory = models.IntegerField(default=2048)
|
max_memory = models.IntegerField(default=2048)
|
||||||
max_disk_size = models.IntegerField(default=20)
|
max_disk_size = models.IntegerField(default=20)
|
||||||
|
|
||||||
default_instances = [
|
|
||||||
'debian8-template',
|
|
||||||
'debian8-template-nocf',
|
|
||||||
'debian9-template',
|
|
||||||
'debian9-template-nocf',
|
|
||||||
]
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def create_missing_userattributes(user):
|
def create_missing_userattributes(user):
|
||||||
try:
|
try:
|
||||||
|
@ -49,7 +43,7 @@ class UserAttributes(models.Model):
|
||||||
def add_default_instances(user):
|
def add_default_instances(user):
|
||||||
existing_instances = UserInstance.objects.filter(user=user)
|
existing_instances = UserInstance.objects.filter(user=user)
|
||||||
if not existing_instances:
|
if not existing_instances:
|
||||||
for instance_name in UserAttributes.default_instances:
|
for instance_name in settings.NEW_USER_DEFAULT_INSTANCES:
|
||||||
instance = Instance.objects.get(name=instance_name)
|
instance = Instance.objects.get(name=instance_name)
|
||||||
user_instance = UserInstance(user=user, instance=instance)
|
user_instance = UserInstance(user=user, instance=instance)
|
||||||
user_instance.save()
|
user_instance.save()
|
||||||
|
|
|
@ -117,6 +117,11 @@ LIBVIRT_KEEPALIVE_INTERVAL = 5
|
||||||
LIBVIRT_KEEPALIVE_COUNT = 5
|
LIBVIRT_KEEPALIVE_COUNT = 5
|
||||||
|
|
||||||
ALLOW_INSTANCE_MULTIPLE_OWNER = True
|
ALLOW_INSTANCE_MULTIPLE_OWNER = True
|
||||||
|
NEW_USER_DEFAULT_INSTANCES = [
|
||||||
|
'debian8-template',
|
||||||
|
'debian9-template',
|
||||||
|
'kiv-adm-template',
|
||||||
|
]
|
||||||
CLONE_INSTANCE_DEFAULT_PREFIX = 'ourea'
|
CLONE_INSTANCE_DEFAULT_PREFIX = 'ourea'
|
||||||
LOGS_PER_PAGE = 100
|
LOGS_PER_PAGE = 100
|
||||||
QUOTA_DEBUG = True
|
QUOTA_DEBUG = True
|
||||||
|
|
Loading…
Reference in a new issue