diff --git a/client b/client index 8f2a6df90..81a1a0c57 160000 --- a/client +++ b/client @@ -1 +1 @@ -Subproject commit 8f2a6df9059475cc4853219e08266716d10649a4 +Subproject commit 81a1a0c57c5584df7dba3cbaa22483371bda595c diff --git a/server/src/uds/core/transports/transport.py b/server/src/uds/core/transports/transport.py index 37d9b24b5..285d5ad2d 100644 --- a/server/src/uds/core/transports/transport.py +++ b/server/src/uds/core/transports/transport.py @@ -81,7 +81,7 @@ class Transport(Module): # For allowing grouping transport on dashboard "new" menu, and maybe other places group: typing.ClassVar[types.transports.Grouping] = types.transports.Grouping.DIRECT - + _db_obj: typing.Optional['models.Transport'] = None def __init__(self, environment: 'Environment', values: types.core.ValuesType): @@ -214,7 +214,7 @@ class Transport(Module): @return: transformed username """ return user.name - + def generate_key(self, length: int = 32) -> str: """ Returns a random key of the requested length @@ -237,22 +237,22 @@ class Transport(Module): this on client """ return types.transports.TransportScript( - script="raise Exception('The transport {transport} is not supported on your platform.'.format(transport=params['transport']))", - signature_b64='EH/91J7u9+/sHtB5+EUVRDW1+jqF0LuZzfRi8qxyIuSdJuWt' - '8V8Yngu24p0NNr13TaxPQ1rpGN8x0NsU/Ma8k4GGohc+zxdf' - '4xlkwMjAIytp8jaMHKkzvcihiIAMtaicP786FZCwGMmFTH4Z' - 'A9i7YWaSzT95h84kirAG67J0GWKiyATxs6mtxBNaLgqU4juA' - 'Qn98hYp5ffWa5FQDSAmheiDyQbCXMRwtWcxVHVQCAoZbsvCe' - 'njKc+FaeKNmXsYOgmcj+pz8IViNOyTbueP9u7lTzuBlIyV+7' - 'OlBPTqb5yA5wOBicKIpplPd8V71Oh3pdpRvdlvVbbwNfsCl5' - 'v6s1X20MxaQOSwM5z02eY1lJSbLIp8d9WRkfVty0HP/4Z8JZ' - 'kavkWNaGiKXEZXqojx/ZdzvTfvBkYrREQ8lMCIvtawBTysus' - 'IV4vHnDRdSmRxpYdj+1SNfzB0s1VuY6F7bSdBvgzja4P3Zbo' - 'Z63yNGuBhIsqUDA2ARmiMHRx9jr6eilFBKhoyWgNi9izTkar' - '3iMYtXfvcFnmz4jvuJHUccbpUo4O31K2G7OaqlLylQ5dCu62' - 'JuVuquKKSfiwOIdYcdPJ6gvpgkQQDPqt7wN+duyZA0FI5F4h' - 'O6acQZmbjBCqZoo9Qsg7k9cTcalNkc5flEYAk1mULnddgDM6' - 'YGmoJgVnDr0=', + script="raise Exception('The selected transport is not supported on your platform.'.format(transport=sp['transport']))", + signature_b64='Ki6Emu7h3gBmqipOD7uW6ytIXQLg149a2vRcCHcl2yyIXqX0' + '4JAViKwhVrbQhAZ5kli1uzLOKa7heLMT0Wif6SAckcMuyOng' + 'lrEZW0xnzuCWYTj3373a1qWX8wres8mzxA9x3cQ9PuzDSRDS' + 'ZMbXbVTifkZU0t5hAV4poLe7oAkjx9bypmQOjFB3MN0XRqGT' + 'AqlT+bViL4a8FL/pkMIDk/2Z2PGh2yF8FkWBab34eSHCwXA8' + 'GgZ/xC3VtO7c1hq6bxNdneVxxLM74EYRpqy4rXX8QXCoZ2kB' + '+7VMviG+lqXDkj1xQpTK77rnYj6ye6mSHLPd+bLkQ3/XqV6e' + '1pqTlVwas1PMmsduEuhEJ+cRh9IhOMCM9oTWcngPGD8n9CQM' + 'k3eMmb/73Tx5ZCg6BhpNjZNKmnomEmEFkdQpX3afZ4bS9Nic' + 'E9M+IJTv+g5AImGZTZXsskDTYP+bQeygugXw0p3YZqDaJeIp' + 'C2u1gDZjgCJ6FobGVziqdqLNRNOjwjP82y8nU6jvs6rnQD+4' + 'qBps9EVau//q3nXyTbWtQfmC8hqQ5hsFID9K27WNy92OHqIc' + 'fd6NuTG7jC+TiHyMGC937TfiQQy+0J8BiQtjY4Q3I+Sws7AT' + 'XXv7MJMqYLXIVi0Fn8yrTiFqEDP2l4eFwKv7XZn5c+RO8ZE9' + 'NbxIWj2Fvuw=', parameters={'transport': transport.name}, ) diff --git a/server/src/uds/core/types/os.py b/server/src/uds/core/types/os.py index 598abb588..0f4779cbe 100644 --- a/server/src/uds/core/types/os.py +++ b/server/src/uds/core/types/os.py @@ -46,7 +46,7 @@ class KnownOS(enum.Enum): CHROME_OS = ('CrOS',) WINDOWS_PHONE = ('Windows Phone',) WINDOWS = ('Windows',) - MAC_OS = ('MacOsX',) + MAC_OS = ('MacOsX', 'MacOs', 'Mac Os X') # Previous was only "Mac" ANDROID = ('Android',) IPAD = ('iPad',) # IPHONE = ('iPhone',) # In fact, these are IOS both, but we can diferentiate them diff --git a/server/src/uds/core/util/fuse.py b/server/src/uds/core/util/fuse.py index 90c7a2a33..2cdb429ca 100644 --- a/server/src/uds/core/util/fuse.py +++ b/server/src/uds/core/util/fuse.py @@ -846,14 +846,14 @@ class FUSE: return func(*args, **kwargs) or 0 except OSError as e: - if e.errno > 0: + if e.errno > 0: # pyright: ignore logger.debug( "FUSE operation %s raised a %s, returning errno %s.", func.__name__, type(e), e.errno, ) - return -e.errno + return -e.errno # pyright: ignore logger.error( "FUSE operation %s raised an OSError with negative " "errno %s, returning errno.EINVAL.", func.__name__, diff --git a/server/src/uds/core/util/os_detector.py b/server/src/uds/core/util/os_detector.py index 754153562..a6bc5a4cc 100644 --- a/server/src/uds/core/util/os_detector.py +++ b/server/src/uds/core/util/os_detector.py @@ -66,9 +66,10 @@ def detect_os( else: # Try to detect from User-Agent ual = ua.lower() for os in consts.os.KNOWN_OS_LIST: - if os.os_name().lower() in ual: - found_os = types.os.KnownOS(os) - break + for osname in os.value: + if osname.lower() in ual: + found_os = types.os.KnownOS(os) + break # If we found a known OS, store it if found_os != types.os.KnownOS.UNKNOWN: diff --git a/server/src/uds/services/Xen/xen/client.py b/server/src/uds/services/Xen/xen/client.py index 4be52aff8..46b615fe2 100644 --- a/server/src/uds/services/Xen/xen/client.py +++ b/server/src/uds/services/Xen/xen/client.py @@ -223,7 +223,7 @@ class XenClient: # pylint: disable=too-many-public-methods self._host = e.details[1] self.login(backup_checked=backup_checked) else: - raise exceptions.XenFailure(e.details) + raise exceptions.XenFailure(typing.cast(typing.Any, e.details)) except Exception: if self._host == self._host_backup or not self._host_backup or backup_checked: logger.exception('Connection to master server is broken and backup connection unavailable.') @@ -305,7 +305,7 @@ class XenClient: # pylint: disable=too-many-public-methods return_list.append(vm) return return_list except XenAPI.Failure as e: - raise exceptions.XenFailure(e.details) + raise exceptions.XenFailure(typing.cast(typing.Any, e.details)) except Exception as e: raise exceptions.XenException(str(e)) @@ -455,7 +455,7 @@ class XenClient: # pylint: disable=too-many-public-methods task = self.Async.VM.clone(vm_opaque_ref, target_name) return task except XenAPI.Failure as e: - raise exceptions.XenFailure(e.details) + raise exceptions.XenFailure(typing.cast(typing.Any, e.details)) @exceptions.catched def delete_vm(self, vm_opaque_ref: str) -> None: diff --git a/server/src/uds/services/Xen/xen/exceptions.py b/server/src/uds/services/Xen/xen/exceptions.py index b6b113af4..5db68636f 100644 --- a/server/src/uds/services/Xen/xen/exceptions.py +++ b/server/src/uds/services/Xen/xen/exceptions.py @@ -83,7 +83,7 @@ class XenFailure(XenAPI.Failure, XenFault): return err.format(*typing.cast(list[typing.Any], self.details)) except Exception: - return 'Unknown exception: {0}'.format(self.details) + return 'Unknown exception: {}'.format(typing.cast(typing.Any, self.details)) def __str__(self) -> str: return self.as_human_readable() @@ -122,7 +122,7 @@ def translator() -> typing.Generator[None, None, None]: except XenAPI.Failure as e: if e.details[0] == 'HANDLE_INVALID': raise XenNotFoundError(e.details[1:]) from e - raise XenFailure(e.details) from e + raise XenFailure(typing.cast(typing.Any, e.details)) from e except TimeoutError: # Retryable error raise XenRetryableError('Timeout error') from None except Exception as e: