diff --git a/server/src/uds/core/managers/UserServiceManager.py b/server/src/uds/core/managers/UserServiceManager.py index f96d0c17..079950f1 100644 --- a/server/src/uds/core/managers/UserServiceManager.py +++ b/server/src/uds/core/managers/UserServiceManager.py @@ -51,7 +51,7 @@ import requests import json import logging -__updated__ = '2017-03-22' +__updated__ = '2017-10-03' logger = logging.getLogger(__name__) traceLogger = logging.getLogger('traceLog') @@ -539,8 +539,9 @@ class UserServiceManager(object): traceLogger.info('READY on service "{}" for user "{}" with transport "{}" (ip:{})'.format(userService.name, userName, trans.name, ip)) return (ip, userService, iads, trans, itrans) else: - log.doLog(userService, log.WARN, "User service is not accessible (ip {0})".format(ip), log.TRANSPORT) - logger.debug('Transport is not ready for user service {0}'.format(userService)) + message = itrans.getCustomAvailableErrorMsg(userService, ip) + log.doLog(userService, log.WARN, message, log.TRANSPORT) + logger.debug('Transport is not ready for user service {}: {}'.format(userService, message)) else: logger.debug('Ip not available from user service {0}'.format(userService)) else: diff --git a/server/src/uds/core/transports/BaseTransport.py b/server/src/uds/core/transports/BaseTransport.py index b8dd6009..0cf2ec63 100644 --- a/server/src/uds/core/transports/BaseTransport.py +++ b/server/src/uds/core/transports/BaseTransport.py @@ -40,7 +40,7 @@ from uds.core.transports import protocols import logging -__updated__ = '2017-08-02' +__updated__ = '2017-10-03' logger = logging.getLogger(__name__) @@ -113,6 +113,13 @@ class Transport(Module): ''' return False + def getCustomAvailableErrorMsg(self, userService, ip): + ''' + Returns a customized error message, that will be used when a service fails to check "isAvailableFor" + Override this in yours transports if needed + ''' + return "Not accessible (using service ip {0})".format(ip) + @classmethod def supportsProtocol(cls, protocol): if isinstance(protocol, (list, tuple)): diff --git a/server/src/uds/transports/NX/scripts/linux/direct.py b/server/src/uds/transports/NX/scripts/linux/direct.py index 993703cc..375e96b0 100644 --- a/server/src/uds/transports/NX/scripts/linux/direct.py +++ b/server/src/uds/transports/NX/scripts/linux/direct.py @@ -3,7 +3,6 @@ from __future__ import unicode_literals # pylint: disable=import-error, no-name-in-module -from PyQt4 import QtCore, QtGui # @UnusedImport import subprocess from uds import tools # @UnresolvedImport diff --git a/server/src/uds/transports/NX/scripts/linux/tunnel.py b/server/src/uds/transports/NX/scripts/linux/tunnel.py index c5141a47..7ad2323b 100644 --- a/server/src/uds/transports/NX/scripts/linux/tunnel.py +++ b/server/src/uds/transports/NX/scripts/linux/tunnel.py @@ -3,7 +3,6 @@ from __future__ import unicode_literals # pylint: disable=import-error, no-name-in-module, undefined-variable -from PyQt4 import QtCore, QtGui # @UnusedImport import subprocess from uds.forward import forward # @UnresolvedImport diff --git a/server/src/uds/transports/NX/scripts/macosx/direct.py b/server/src/uds/transports/NX/scripts/macosx/direct.py index 6e44c489..a1d9b353 100644 --- a/server/src/uds/transports/NX/scripts/macosx/direct.py +++ b/server/src/uds/transports/NX/scripts/macosx/direct.py @@ -3,7 +3,6 @@ from __future__ import unicode_literals # pylint: disable=import-error, no-name-in-module, too-many-format-args, undefined-variable, invalid-sequence-index -from PyQt4 import QtCore, QtGui # @UnusedImport import subprocess import os diff --git a/server/src/uds/transports/NX/scripts/macosx/tunnel.py b/server/src/uds/transports/NX/scripts/macosx/tunnel.py index 8f9d2d06..05b6298a 100644 --- a/server/src/uds/transports/NX/scripts/macosx/tunnel.py +++ b/server/src/uds/transports/NX/scripts/macosx/tunnel.py @@ -3,7 +3,6 @@ from __future__ import unicode_literals # pylint: disable=import-error, no-name-in-module, too-many-format-args, undefined-variable, invalid-sequence-index -from PyQt4 import QtCore, QtGui # @UnusedImport import subprocess from uds.forward import forward # @UnresolvedImport import os diff --git a/server/src/uds/transports/NX/scripts/windows/direct.py b/server/src/uds/transports/NX/scripts/windows/direct.py index c7368988..8e3fffe5 100644 --- a/server/src/uds/transports/NX/scripts/windows/direct.py +++ b/server/src/uds/transports/NX/scripts/windows/direct.py @@ -3,7 +3,6 @@ from __future__ import unicode_literals # pylint: disable=import-error, no-name-in-module -from PyQt4 import QtCore, QtGui # @UnusedImport import _winreg import subprocess diff --git a/server/src/uds/transports/NX/scripts/windows/tunnel.py b/server/src/uds/transports/NX/scripts/windows/tunnel.py index 3290ad75..2493babf 100644 --- a/server/src/uds/transports/NX/scripts/windows/tunnel.py +++ b/server/src/uds/transports/NX/scripts/windows/tunnel.py @@ -3,7 +3,6 @@ from __future__ import unicode_literals # pylint: disable=import-error, no-name-in-module, undefined-variable -from PyQt4 import QtCore, QtGui # @UnusedImport import _winreg import subprocess from uds.forward import forward # @UnresolvedImport diff --git a/server/src/uds/transports/SPICE/BaseSPICETransport.py b/server/src/uds/transports/SPICE/BaseSPICETransport.py index 4dbe12f6..2c681269 100644 --- a/server/src/uds/transports/SPICE/BaseSPICETransport.py +++ b/server/src/uds/transports/SPICE/BaseSPICETransport.py @@ -44,7 +44,7 @@ from uds.services.OVirt.OVirtProvider import Provider as oVirtProvider import logging import os -__updated__ = '2017-05-13' +__updated__ = '2017-10-03' logger = logging.getLogger(__name__) @@ -119,7 +119,6 @@ class BaseSpiceTransport(Transport): def isAvailableFor(self, userService, ip): ''' Checks if the transport is available for the requested destination ip - Override this in yours transports ''' ready = self.cache.get(ip) if ready is None: @@ -138,15 +137,24 @@ class BaseSpiceTransport(Transport): # test ANY of the ports port_to_test = port if port != -1 else secure_port if port_to_test == -1: + self.cache.put('cachedMsg', 'Could not find the PORT for connection', 120) # Write a message, that will be used from getCustom logger.info('SPICE didn\'t find has any port: {}'.format(con)) return False + self.cache.put('Could not reach server "{}" on port "{}" from broker'.format(con['address'], port_to_test)) + if connection.testServer(con['address'], port_to_test) is True: self.cache.put(ip, 'Y', READY_CACHE_TIMEOUT) ready = 'Y' return ready == 'Y' + def getCustomAvailableErrorMsg(self, userService, ip): + userServiceInstance = userService.getInstance() + con = userServiceInstance.getConsoleConnection() + return + + def processedUser(self, userService, userName): v = self.processUserPassword(userService, userName, '') return v['username']