mirror of
https://github.com/dkmstr/openuds.git
synced 2025-01-01 21:17:58 +03:00
Some minor type checking fixes and updated basic non supported platform script
This commit is contained in:
parent
90ba463fb9
commit
a7b64504fe
2
client
2
client
@ -1 +1 @@
|
|||||||
Subproject commit 8f2a6df9059475cc4853219e08266716d10649a4
|
Subproject commit 81a1a0c57c5584df7dba3cbaa22483371bda595c
|
@ -81,7 +81,7 @@ class Transport(Module):
|
|||||||
|
|
||||||
# For allowing grouping transport on dashboard "new" menu, and maybe other places
|
# For allowing grouping transport on dashboard "new" menu, and maybe other places
|
||||||
group: typing.ClassVar[types.transports.Grouping] = types.transports.Grouping.DIRECT
|
group: typing.ClassVar[types.transports.Grouping] = types.transports.Grouping.DIRECT
|
||||||
|
|
||||||
_db_obj: typing.Optional['models.Transport'] = None
|
_db_obj: typing.Optional['models.Transport'] = None
|
||||||
|
|
||||||
def __init__(self, environment: 'Environment', values: types.core.ValuesType):
|
def __init__(self, environment: 'Environment', values: types.core.ValuesType):
|
||||||
@ -214,7 +214,7 @@ class Transport(Module):
|
|||||||
@return: transformed username
|
@return: transformed username
|
||||||
"""
|
"""
|
||||||
return user.name
|
return user.name
|
||||||
|
|
||||||
def generate_key(self, length: int = 32) -> str:
|
def generate_key(self, length: int = 32) -> str:
|
||||||
"""
|
"""
|
||||||
Returns a random key of the requested length
|
Returns a random key of the requested length
|
||||||
@ -237,22 +237,22 @@ class Transport(Module):
|
|||||||
this on client
|
this on client
|
||||||
"""
|
"""
|
||||||
return types.transports.TransportScript(
|
return types.transports.TransportScript(
|
||||||
script="raise Exception('The transport {transport} is not supported on your platform.'.format(transport=params['transport']))",
|
script="raise Exception('The selected transport is not supported on your platform.'.format(transport=sp['transport']))",
|
||||||
signature_b64='EH/91J7u9+/sHtB5+EUVRDW1+jqF0LuZzfRi8qxyIuSdJuWt'
|
signature_b64='Ki6Emu7h3gBmqipOD7uW6ytIXQLg149a2vRcCHcl2yyIXqX0'
|
||||||
'8V8Yngu24p0NNr13TaxPQ1r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'
|
||||||
'3iMYtXfvcFnmz4jvuJHUccbpUo4O31K2G7OaqlLylQ5dCu62'
|
'qBps9EVau//q3nXyTbWtQfmC8hqQ5hsFID9K27WNy92OHqIc'
|
||||||
'JuVuquKKSfiwOIdYcdPJ6gvpgkQQDPqt7wN+duyZA0FI5F4h'
|
'fd6NuTG7jC+TiHyMGC937TfiQQy+0J8BiQtjY4Q3I+Sws7AT'
|
||||||
'O6acQZmbjBCqZoo9Qsg7k9cTcalNkc5flEYAk1mULnddgDM6'
|
'XXv7MJMqYLXIVi0Fn8yrTiFqEDP2l4eFwKv7XZn5c+RO8ZE9'
|
||||||
'YGmoJgVnDr0=',
|
'NbxIWj2Fvuw=',
|
||||||
parameters={'transport': transport.name},
|
parameters={'transport': transport.name},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ class KnownOS(enum.Enum):
|
|||||||
CHROME_OS = ('CrOS',)
|
CHROME_OS = ('CrOS',)
|
||||||
WINDOWS_PHONE = ('Windows Phone',)
|
WINDOWS_PHONE = ('Windows Phone',)
|
||||||
WINDOWS = ('Windows',)
|
WINDOWS = ('Windows',)
|
||||||
MAC_OS = ('MacOsX',)
|
MAC_OS = ('MacOsX', 'MacOs', 'Mac Os X') # Previous was only "Mac"
|
||||||
ANDROID = ('Android',)
|
ANDROID = ('Android',)
|
||||||
IPAD = ('iPad',) #
|
IPAD = ('iPad',) #
|
||||||
IPHONE = ('iPhone',) # In fact, these are IOS both, but we can diferentiate them
|
IPHONE = ('iPhone',) # In fact, these are IOS both, but we can diferentiate them
|
||||||
|
@ -846,14 +846,14 @@ class FUSE:
|
|||||||
return func(*args, **kwargs) or 0
|
return func(*args, **kwargs) or 0
|
||||||
|
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
if e.errno > 0:
|
if e.errno > 0: # pyright: ignore
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"FUSE operation %s raised a %s, returning errno %s.",
|
"FUSE operation %s raised a %s, returning errno %s.",
|
||||||
func.__name__,
|
func.__name__,
|
||||||
type(e),
|
type(e),
|
||||||
e.errno,
|
e.errno,
|
||||||
)
|
)
|
||||||
return -e.errno
|
return -e.errno # pyright: ignore
|
||||||
logger.error(
|
logger.error(
|
||||||
"FUSE operation %s raised an OSError with negative " "errno %s, returning errno.EINVAL.",
|
"FUSE operation %s raised an OSError with negative " "errno %s, returning errno.EINVAL.",
|
||||||
func.__name__,
|
func.__name__,
|
||||||
|
@ -66,9 +66,10 @@ def detect_os(
|
|||||||
else: # Try to detect from User-Agent
|
else: # Try to detect from User-Agent
|
||||||
ual = ua.lower()
|
ual = ua.lower()
|
||||||
for os in consts.os.KNOWN_OS_LIST:
|
for os in consts.os.KNOWN_OS_LIST:
|
||||||
if os.os_name().lower() in ual:
|
for osname in os.value:
|
||||||
found_os = types.os.KnownOS(os)
|
if osname.lower() in ual:
|
||||||
break
|
found_os = types.os.KnownOS(os)
|
||||||
|
break
|
||||||
|
|
||||||
# If we found a known OS, store it
|
# If we found a known OS, store it
|
||||||
if found_os != types.os.KnownOS.UNKNOWN:
|
if found_os != types.os.KnownOS.UNKNOWN:
|
||||||
|
@ -223,7 +223,7 @@ class XenClient: # pylint: disable=too-many-public-methods
|
|||||||
self._host = e.details[1]
|
self._host = e.details[1]
|
||||||
self.login(backup_checked=backup_checked)
|
self.login(backup_checked=backup_checked)
|
||||||
else:
|
else:
|
||||||
raise exceptions.XenFailure(e.details)
|
raise exceptions.XenFailure(typing.cast(typing.Any, e.details))
|
||||||
except Exception:
|
except Exception:
|
||||||
if self._host == self._host_backup or not self._host_backup or backup_checked:
|
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.')
|
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_list.append(vm)
|
||||||
return return_list
|
return return_list
|
||||||
except XenAPI.Failure as e:
|
except XenAPI.Failure as e:
|
||||||
raise exceptions.XenFailure(e.details)
|
raise exceptions.XenFailure(typing.cast(typing.Any, e.details))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise exceptions.XenException(str(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)
|
task = self.Async.VM.clone(vm_opaque_ref, target_name)
|
||||||
return task
|
return task
|
||||||
except XenAPI.Failure as e:
|
except XenAPI.Failure as e:
|
||||||
raise exceptions.XenFailure(e.details)
|
raise exceptions.XenFailure(typing.cast(typing.Any, e.details))
|
||||||
|
|
||||||
@exceptions.catched
|
@exceptions.catched
|
||||||
def delete_vm(self, vm_opaque_ref: str) -> None:
|
def delete_vm(self, vm_opaque_ref: str) -> None:
|
||||||
|
@ -83,7 +83,7 @@ class XenFailure(XenAPI.Failure, XenFault):
|
|||||||
|
|
||||||
return err.format(*typing.cast(list[typing.Any], self.details))
|
return err.format(*typing.cast(list[typing.Any], self.details))
|
||||||
except Exception:
|
except Exception:
|
||||||
return 'Unknown exception: {0}'.format(self.details)
|
return 'Unknown exception: {}'.format(typing.cast(typing.Any, self.details))
|
||||||
|
|
||||||
def __str__(self) -> str:
|
def __str__(self) -> str:
|
||||||
return self.as_human_readable()
|
return self.as_human_readable()
|
||||||
@ -122,7 +122,7 @@ def translator() -> typing.Generator[None, None, None]:
|
|||||||
except XenAPI.Failure as e:
|
except XenAPI.Failure as e:
|
||||||
if e.details[0] == 'HANDLE_INVALID':
|
if e.details[0] == 'HANDLE_INVALID':
|
||||||
raise XenNotFoundError(e.details[1:]) from e
|
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
|
except TimeoutError: # Retryable error
|
||||||
raise XenRetryableError('Timeout error') from None
|
raise XenRetryableError('Timeout error') from None
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
Loading…
Reference in New Issue
Block a user