forked from shaba/openuds
Merged with 2.0 fixes
This commit is contained in:
commit
e2db15ead7
@ -211,7 +211,7 @@ if DEBUG:
|
||||
# This is so because we need to share the files between servers
|
||||
# Another options is put /var/server/static on a shared nfs forder for all servers
|
||||
#
|
||||
# COMPRESS_STORAGE = 'uds.core.util.FileStorage.FileStorage'
|
||||
# COMPRESS_STORAGE = 'uds.core.util.FileStorage.CompressorFileStorage'
|
||||
|
||||
# See http://docs.djangoproject.com/en/dev/topics/logging for
|
||||
# more details on how to customize your logging configuration.
|
||||
|
@ -109,7 +109,7 @@ class ServicesPools(ModelHandler):
|
||||
'service_id': item.service.uuid,
|
||||
'provider_id': item.service.provider.uuid,
|
||||
'image_id': item.image.uuid if item.image is not None else None,
|
||||
'pool_group_id': poolGroupId,
|
||||
'servicesPoolGroup_id': poolGroupId,
|
||||
'pool_group_name': poolGroupName,
|
||||
'pool_group_thumb': poolGroupThumb,
|
||||
'initial_srvs': item.initial_srvs,
|
||||
@ -164,7 +164,7 @@ class ServicesPools(ModelHandler):
|
||||
'tab': ugettext('Display'),
|
||||
}, {
|
||||
'name': 'servicesPoolGroup_id',
|
||||
'values': [gui.choiceImage(-1, _('Default'), DEFAULT_THUMB_BASE64)] + gui.sortedChoices([gui.choiceImage(v.uuid, v.name, v.image.thumb64) for v in ServicesPoolGroup.objects.all()]),
|
||||
'values': [gui.choiceImage(-1, _('Default'), DEFAULT_THUMB_BASE64)] + gui.sortedChoices([gui.choiceImage(v.uuid, v.name, v.thumb64) for v in ServicesPoolGroup.objects.all()]),
|
||||
'label': ugettext('Pool group'),
|
||||
'tooltip': ugettext('Pool group for this pool (for pool clasify on display)'),
|
||||
'type': gui.InputField.IMAGECHOICE_TYPE,
|
||||
|
@ -63,6 +63,11 @@ class FileStorage(Storage):
|
||||
cache = None
|
||||
|
||||
self.cache = cache
|
||||
if 'owner' in kwargs:
|
||||
self.owner = kwargs.get('owner')
|
||||
del kwargs['owner']
|
||||
else:
|
||||
self.owner = 'fstor'
|
||||
|
||||
self.cache._cache.flush_all() # On start, ensures that cache is empty to avoid surprises
|
||||
|
||||
@ -126,7 +131,7 @@ class FileStorage(Storage):
|
||||
try:
|
||||
f = self._dbFileForReadWrite(name)
|
||||
except DBFile.DoesNotExist:
|
||||
f = DBFile.objects.create(name=name)
|
||||
f = DBFile.objects.create(owner=self.owner, name=name)
|
||||
|
||||
f.data = content.read()
|
||||
f.save()
|
||||
@ -149,11 +154,12 @@ class FileStorage(Storage):
|
||||
return self._dbFileForReadOnly(name).size
|
||||
|
||||
def delete(self, name):
|
||||
logger.debug('Delete callef for {}'.format(name))
|
||||
self._dbFileForReadWrite(name).delete()
|
||||
self._removeFromCache(name)
|
||||
|
||||
def exists(self, name):
|
||||
logger.debug('Called exists for {}')
|
||||
logger.debug('Called exists for {}'.format(name))
|
||||
try:
|
||||
self._dbFileForReadOnly(name).uuid
|
||||
return True
|
||||
@ -163,3 +169,8 @@ class FileStorage(Storage):
|
||||
def url(self, name):
|
||||
uuid = self._dbFileForReadWrite(name).uuid
|
||||
return urlparse.urljoin(self._base_url, uuid)
|
||||
|
||||
class CompressorFileStorage(FileStorage):
|
||||
def __init__(self, *args, **kwargs):
|
||||
FileStorage.__init__(self, *args, **dict(kwargs, owner='compressor'))
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.9.5 on 2016-06-15 09:24
|
||||
# Generated by Django 1.9.5 on 2016-07-10 20:31
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
@ -13,8 +13,8 @@ class Migration(migrations.Migration):
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='ticketstore',
|
||||
model_name='dbfile',
|
||||
name='owner',
|
||||
field=models.CharField(blank=True, default=None, max_length=8, null=True),
|
||||
field=models.CharField(default='', max_length=32),
|
||||
),
|
||||
]
|
@ -48,6 +48,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class DBFile(UUIDModel):
|
||||
owner = models.CharField(max_length=32, default='') # Not indexed, used for cleanups only
|
||||
name = models.CharField(max_length=255, primary_key=True)
|
||||
content = models.TextField(blank=True)
|
||||
size = models.IntegerField(default=0)
|
||||
|
@ -40,6 +40,7 @@ from django.utils.encoding import python_2_unicode_compatible
|
||||
|
||||
from uds.models.UUIDModel import UUIDModel
|
||||
from uds.models.Image import Image
|
||||
from uds.core.ui.images import DEFAULT_THUMB_BASE64
|
||||
|
||||
import logging
|
||||
|
||||
@ -80,8 +81,10 @@ class ServicesPoolGroup(UUIDModel):
|
||||
'imageUuid': self.image.uuid if self.image is not None else 'x'
|
||||
}
|
||||
|
||||
@property
|
||||
def thumb64(self):
|
||||
return self.image.thumb64 if self.image is not None else DEFAULT_THUMB_BASE64
|
||||
|
||||
@staticmethod
|
||||
def default():
|
||||
return ServicesPoolGroup(name=_('General'), comments='Default group', priority=-10000)
|
||||
|
||||
|
||||
|
@ -141,7 +141,7 @@ class LiveDeployment(UserDeployment):
|
||||
The get method of a mac generator takes one param, that is the mac range
|
||||
to use to get an unused mac.
|
||||
'''
|
||||
return self._mac
|
||||
return self._mac.upper()
|
||||
|
||||
def getIp(self):
|
||||
'''
|
||||
@ -176,7 +176,7 @@ class LiveDeployment(UserDeployment):
|
||||
if state == on.VmState.UNKNOWN:
|
||||
return self.__error('Machine is not available anymore')
|
||||
|
||||
self.service().startMachine()
|
||||
self.service().startMachine(self._vmid)
|
||||
|
||||
self.cache.put('ready', '1')
|
||||
return State.FINISHED
|
||||
|
@ -77,6 +77,7 @@ class HTML5RDPTransport(Transport):
|
||||
def initialize(self, values):
|
||||
if values is None:
|
||||
return
|
||||
self.guacamoleServer.value = self.guacamoleServer.value.strip()
|
||||
if self.guacamoleServer.value[0:4] != 'http':
|
||||
raise Transport.ValidationException(_('The server must be http or https'))
|
||||
|
||||
|
@ -95,9 +95,13 @@ class RDPFile(object):
|
||||
params.append('/smartcard')
|
||||
|
||||
if self.redirectAudio:
|
||||
params.append('/sound:sys:alsa')
|
||||
params.append('/microphone:sys:alsa')
|
||||
params.append('/multimedia:sys:alsa')
|
||||
# params.append('/sound:sys:alsa')
|
||||
# params.append('/microphone:sys:alsa')
|
||||
# params.append('/multimedia:sys:alsa')
|
||||
# Let freerdp decide if pulse o alsa
|
||||
params.append('/sound')
|
||||
params.append('/microphone')
|
||||
params.append('/multimedia')
|
||||
|
||||
if self.redirectDrives is True:
|
||||
params.append('/drive:media,/media')
|
||||
|
@ -137,6 +137,7 @@ def index(request):
|
||||
'not_accesible': not svr.deployed_service.isAccessAllowed(),
|
||||
'in_use': svr.in_use,
|
||||
'to_be_replaced': False, # Manually assigned will not be autoremoved never
|
||||
'comments': svr.comments,
|
||||
})
|
||||
|
||||
logger.debug(services)
|
||||
@ -191,7 +192,8 @@ def index(request):
|
||||
'not_accesible': not svr.isAccessAllowed(),
|
||||
'in_use': in_use,
|
||||
'to_be_replaced': tbr,
|
||||
'to_be_replaced_text': tbrt
|
||||
'to_be_replaced_text': tbrt,
|
||||
'comments': svr.comments,
|
||||
})
|
||||
|
||||
logger.debug('Services: {0}'.format(services))
|
||||
|
Loading…
Reference in New Issue
Block a user