fixing up things

This commit is contained in:
Adolfo Gómez García 2018-09-10 10:40:34 +02:00
parent 4561e6c0fe
commit 9ffced6365
12 changed files with 29 additions and 37 deletions

View File

@ -48,7 +48,7 @@ import logging
logger = logging.getLogger(__name__)
__updated__ = '2018-06-27'
__updated__ = '2018-09-07'
@python_2_unicode_compatible
@ -194,7 +194,7 @@ class Authenticator(ManagedObjectModel, TaggingMixin):
else:
auths = Authenticator.objects.all().order_by('priority', 'name')
return [auth for auth in auths if auth.getType().isCustom() is False or tag != 'disabled']
return [auth for auth in auths if auth.getType() and (auth.getType().isCustom() is False or tag != 'disabled')]
@staticmethod
def beforeDelete(sender, **kwargs):

View File

@ -44,7 +44,7 @@ from uds.core.ui.images import DEFAULT_THUMB_BASE64
import logging
__updated__ = '2018-09-03'
__updated__ = '2018-09-07'
logger = logging.getLogger(__name__)
@ -86,4 +86,4 @@ class ServicesPoolGroup(UUIDModel):
@staticmethod
def default():
return ServicesPoolGroup(name=_('General'), comments='Default group', priority=-10000)
return ServicesPoolGroup(name=_('General'), comments='', priority=-10000)

View File

@ -55,7 +55,7 @@ from uds.models.Util import getSqlDatetime
import logging
__updated__ = '2018-06-15'
__updated__ = '2018-09-10'
logger = logging.getLogger(__name__)
@ -173,7 +173,10 @@ class UserService(UUIDModel):
raise Exception('Class {0} needs deployedType but it is not defined!!!'.format(serviceInstance.__class__.__name__))
us = serviceInstance.deployedType(self.getEnvironment(), service=serviceInstance, publication=publicationInstance, osmanager=osmanagerInstance, dbservice=self)
if self.data != '' and self.data is not None:
us.unserialize(self.data)
try:
us.unserialize(self.data)
except Exception:
logger.exception('Error unserializing {}//{} : {}'.format(self.deployed_service.name, self.uuid, self.data))
return us
def updateData(self, us):

View File

@ -37,9 +37,7 @@ from uds.core.util.State import State
from datetime import datetime
import logging
__updated__ = '2017-03-22'
__updated__ = '2018-09-10'
logger = logging.getLogger(__name__)
@ -71,14 +69,14 @@ class OVirtPublication(Publication):
"""
returns data from an instance of Sample Publication serialized
"""
return '\t'.join(['v1', self._name, self._reason, self._destroyAfter, self._templateId, self._state])
return b'\t'.join(['v1', self._name, self._reason, self._destroyAfter, self._templateId, self._state])
def unmarshal(self, data):
"""
deserializes the data and loads it inside instance.
"""
logger.debug('Data: {0}'.format(data))
vals = data.split('\t')
vals = data.split(b'\t')
if vals[0] == 'v1':
self._name, self._reason, self._destroyAfter, self._templateId, self._state = vals[1:]
@ -118,7 +116,6 @@ class OVirtPublication(Publication):
self._reason = str(e)
return State.ERROR
if self._state == 'removed':
self._state = 'error'
self._reason = 'Template has been removed!'

View File

@ -39,9 +39,7 @@ import six
import logging
__updated__ = '2017-03-27'
__updated__ = '2018-09-10'
logger = logging.getLogger(__name__)
@ -72,14 +70,14 @@ class LivePublication(Publication):
"""
returns data from an instance of Sample Publication serialized
"""
return '\t'.join(['v1', self._name, self._reason, self._templateId, self._state])
return b'\t'.join(['v1', self._name, self._reason, self._templateId, self._state])
def unmarshal(self, data):
"""
deserializes the data and loads it inside instance.
"""
logger.debug('Data: {0}'.format(data))
vals = data.split('\t')
vals = data.split(b'\t')
if vals[0] == 'v1':
self._name, self._reason, self._templateId, self._state = vals[1:]
@ -119,7 +117,6 @@ class LivePublication(Publication):
if self._state == 'ok':
return State.FINISHED
self._state = 'ok'
return State.FINISHED

View File

@ -98,7 +98,7 @@ def udsJs(context):
'version_stamp': VERSION_STAMP,
'language': get_language(),
'available_languages': [{'id': k, 'name': gettext(v)} for k, v in settings.LANGUAGES],
'authenticators': [getAuth(auth) for auth in authenticators],
'authenticators': [getAuth(auth) for auth in authenticators if auth.getType()],
'bypassPluginDetection': False,
'os': request.os['OS'],
'csrf_field': CSRF_FIELD,
@ -110,7 +110,8 @@ def udsJs(context):
'customAuth': reverse('uds.web.views.customAuth', kwargs={'idAuth': ''}),
'services': reverse('modern.services'),
'enabler': reverse('ClientAccessEnabler', kwargs={ 'idService': 'param1', 'idTransport': 'param2' }),
'galeryImage': reverse('galleryImage', kwargs={ 'idImage': 'param1' }),
'galleryImage': reverse('galleryImage', kwargs={ 'idImage': 'param1' }),
'transportIcon': reverse('uds.web.views.transportIcon', kwargs={'idTrans': 'param1'})
}
}

View File

@ -27,7 +27,6 @@
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
Created on Jul 29, 2011
@ -125,8 +124,8 @@ class NXTransport(Transport):
return str.join('\t', ['v1', gui.boolToStr(self._useEmptyCreds), self._fixedName, self._fixedPassword, self._listenPort,
self._connection, self._session, self._cacheDisk, self._cacheMem])
def unmarshal(self, string):
data = string.split('\t')
def unmarshal(self, val):
data = val.decode('utf8').split('\t')
if data[0] == 'v1':
self._useEmptyCreds = gui.strToBool(data[1])
self._fixedName, self._fixedPassword, self._listenPort, self._connection, self._session, self._cacheDisk, self._cacheMem = data[2:]

View File

@ -27,7 +27,6 @@
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
Created on Jul 29, 2011
@ -140,8 +139,8 @@ class TSNXTransport(Transport):
return str.join('\t', ['v1', gui.boolToStr(self._useEmptyCreds), self._fixedName, self._fixedPassword, self._listenPort,
self._connection, self._session, self._cacheDisk, self._cacheMem, self._tunnelServer, self._tunnelCheckServer])
def unmarshal(self, string):
data = string.split('\t')
def unmarshal(self, val):
data = val.decode('utf8').split('\t')
if data[0] == 'v1':
self._useEmptyCreds = gui.strToBool(data[1])
self._fixedName, self._fixedPassword, self._listenPort, self._connection, self._session, self._cacheDisk, self._cacheMem, self._tunnelServer, self._tunnelCheckServer = data[2:]
@ -194,7 +193,7 @@ class TSNXTransport(Transport):
if self._useEmptyCreds is True:
username, password = '', ''
tunpass = ''.join(random.choice(string.letters + string.digits) for _i in range(12))
tunpass = ''.join(random.choice(string.ascii_letters + string.digits) for _i in range(12))
tunuser = TicketStore.create(tunpass)
sshServer = self._tunnelServer

View File

@ -48,7 +48,7 @@ import logging
import random
import string
__updated__ = '2018-09-06'
__updated__ = '2018-09-10'
logger = logging.getLogger(__name__)
@ -118,7 +118,7 @@ class TRDPTransport(BaseRDPTransport):
width, height = self.screenSize.value.split('x')
depth = self.colorDepth.value
tunpass = ''.join(random.choice(string.letters + string.digits) for _i in range(12))
tunpass = ''.join(random.choice(string.ascii_letters + string.digits) for _i in range(12))
tunuser = TicketStore.create(tunpass)
sshHost, sshPort = self.tunnelServer.value.split(':')
@ -187,7 +187,6 @@ class TRDPTransport(BaseRDPTransport):
if os is None:
return super(self.__class__, self).getUDSTransportScript(userService, transport, ip, os, user, password, request)
sp = {
'tunUser': tunuser,
'tunPass': tunpass,
@ -200,6 +199,4 @@ class TRDPTransport(BaseRDPTransport):
'r': r,
}
m = tools.DictAsObj(data)
return self.getScript('scripts/{}/tunnel.py', os, sp)

View File

@ -45,7 +45,7 @@ import logging
import random
import string
__updated__ = '2018-03-22'
__updated__ = '2018-09-10'
logger = logging.getLogger(__name__)
@ -110,7 +110,7 @@ class TX2GOTransport(BaseX2GOTransport):
user=username
)
tunpass = ''.join(random.choice(string.letters + string.digits) for _i in range(12))
tunpass = ''.join(random.choice(string.ascii_letters + string.digits) for _i in range(12))
tunuser = TicketStore.create(tunpass)
sshHost, sshPort = self.tunnelServer.value.split(':')

View File

@ -45,8 +45,7 @@ import logging
logger = logging.getLogger(__name__)
__updated__ = '2016-08-26'
__updated__ = '2018-09-10'
UserPrefsManager.manager().registerPrefs(
'_uds',

View File

@ -53,7 +53,7 @@ import logging
logger = logging.getLogger(__name__)
__updated__ = '2018-08-31'
__updated__ = '2018-09-10'
@webLoginRequired(admin=False)