forked from shaba/openuds
Several improvements to messages for transports, and minor client
scripts fixed * Added custom error message for SPICE * Remover "import QT" from NX client scripts
This commit is contained in:
parent
f54d87a295
commit
3c07d2f667
@ -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:
|
||||
|
@ -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)):
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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']
|
||||
|
Loading…
Reference in New Issue
Block a user