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 json
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
__updated__ = '2017-03-22'
|
__updated__ = '2017-10-03'
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
traceLogger = logging.getLogger('traceLog')
|
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))
|
traceLogger.info('READY on service "{}" for user "{}" with transport "{}" (ip:{})'.format(userService.name, userName, trans.name, ip))
|
||||||
return (ip, userService, iads, trans, itrans)
|
return (ip, userService, iads, trans, itrans)
|
||||||
else:
|
else:
|
||||||
log.doLog(userService, log.WARN, "User service is not accessible (ip {0})".format(ip), log.TRANSPORT)
|
message = itrans.getCustomAvailableErrorMsg(userService, ip)
|
||||||
logger.debug('Transport is not ready for user service {0}'.format(userService))
|
log.doLog(userService, log.WARN, message, log.TRANSPORT)
|
||||||
|
logger.debug('Transport is not ready for user service {}: {}'.format(userService, message))
|
||||||
else:
|
else:
|
||||||
logger.debug('Ip not available from user service {0}'.format(userService))
|
logger.debug('Ip not available from user service {0}'.format(userService))
|
||||||
else:
|
else:
|
||||||
|
@ -40,7 +40,7 @@ from uds.core.transports import protocols
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
__updated__ = '2017-08-02'
|
__updated__ = '2017-10-03'
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -113,6 +113,13 @@ class Transport(Module):
|
|||||||
'''
|
'''
|
||||||
return False
|
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
|
@classmethod
|
||||||
def supportsProtocol(cls, protocol):
|
def supportsProtocol(cls, protocol):
|
||||||
if isinstance(protocol, (list, tuple)):
|
if isinstance(protocol, (list, tuple)):
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
# pylint: disable=import-error, no-name-in-module
|
# pylint: disable=import-error, no-name-in-module
|
||||||
from PyQt4 import QtCore, QtGui # @UnusedImport
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from uds import tools # @UnresolvedImport
|
from uds import tools # @UnresolvedImport
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
# pylint: disable=import-error, no-name-in-module, undefined-variable
|
# pylint: disable=import-error, no-name-in-module, undefined-variable
|
||||||
from PyQt4 import QtCore, QtGui # @UnusedImport
|
|
||||||
import subprocess
|
import subprocess
|
||||||
from uds.forward import forward # @UnresolvedImport
|
from uds.forward import forward # @UnresolvedImport
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
# pylint: disable=import-error, no-name-in-module, too-many-format-args, undefined-variable, invalid-sequence-index
|
# 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 subprocess
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
# pylint: disable=import-error, no-name-in-module, too-many-format-args, undefined-variable, invalid-sequence-index
|
# 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 subprocess
|
||||||
from uds.forward import forward # @UnresolvedImport
|
from uds.forward import forward # @UnresolvedImport
|
||||||
import os
|
import os
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
# pylint: disable=import-error, no-name-in-module
|
# pylint: disable=import-error, no-name-in-module
|
||||||
from PyQt4 import QtCore, QtGui # @UnusedImport
|
|
||||||
import _winreg
|
import _winreg
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
# pylint: disable=import-error, no-name-in-module, undefined-variable
|
# pylint: disable=import-error, no-name-in-module, undefined-variable
|
||||||
from PyQt4 import QtCore, QtGui # @UnusedImport
|
|
||||||
import _winreg
|
import _winreg
|
||||||
import subprocess
|
import subprocess
|
||||||
from uds.forward import forward # @UnresolvedImport
|
from uds.forward import forward # @UnresolvedImport
|
||||||
|
@ -44,7 +44,7 @@ from uds.services.OVirt.OVirtProvider import Provider as oVirtProvider
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
|
||||||
__updated__ = '2017-05-13'
|
__updated__ = '2017-10-03'
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@ -119,7 +119,6 @@ class BaseSpiceTransport(Transport):
|
|||||||
def isAvailableFor(self, userService, ip):
|
def isAvailableFor(self, userService, ip):
|
||||||
'''
|
'''
|
||||||
Checks if the transport is available for the requested destination ip
|
Checks if the transport is available for the requested destination ip
|
||||||
Override this in yours transports
|
|
||||||
'''
|
'''
|
||||||
ready = self.cache.get(ip)
|
ready = self.cache.get(ip)
|
||||||
if ready is None:
|
if ready is None:
|
||||||
@ -138,15 +137,24 @@ class BaseSpiceTransport(Transport):
|
|||||||
# test ANY of the ports
|
# test ANY of the ports
|
||||||
port_to_test = port if port != -1 else secure_port
|
port_to_test = port if port != -1 else secure_port
|
||||||
if port_to_test == -1:
|
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))
|
logger.info('SPICE didn\'t find has any port: {}'.format(con))
|
||||||
return False
|
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:
|
if connection.testServer(con['address'], port_to_test) is True:
|
||||||
self.cache.put(ip, 'Y', READY_CACHE_TIMEOUT)
|
self.cache.put(ip, 'Y', READY_CACHE_TIMEOUT)
|
||||||
ready = 'Y'
|
ready = 'Y'
|
||||||
|
|
||||||
return ready == 'Y'
|
return ready == 'Y'
|
||||||
|
|
||||||
|
def getCustomAvailableErrorMsg(self, userService, ip):
|
||||||
|
userServiceInstance = userService.getInstance()
|
||||||
|
con = userServiceInstance.getConsoleConnection()
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
def processedUser(self, userService, userName):
|
def processedUser(self, userService, userName):
|
||||||
v = self.processUserPassword(userService, userName, '')
|
v = self.processUserPassword(userService, userName, '')
|
||||||
return v['username']
|
return v['username']
|
||||||
|
Loading…
x
Reference in New Issue
Block a user