mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Add fallback for uuid retrieval from DF
CURA-11655
This commit is contained in:
parent
5f5758c49d
commit
fa2257aaa3
1 changed files with 18 additions and 0 deletions
|
@ -2,6 +2,8 @@
|
|||
# Cura is released under the terms of the LGPLv3 or higher.
|
||||
from typing import Optional, List
|
||||
|
||||
import uuid
|
||||
|
||||
from .CloudClusterResponse import CloudClusterResponse
|
||||
from .ClusterPrinterStatus import ClusterPrinterStatus
|
||||
|
||||
|
@ -11,4 +13,20 @@ class CloudClusterWithConfigResponse(CloudClusterResponse):
|
|||
|
||||
def __init__(self, **kwargs) -> None:
|
||||
self.configuration = self.parseModel(ClusterPrinterStatus, kwargs.get("host_printer"))
|
||||
|
||||
# Some printers will return a null UUID in the host_printer.uuid field. For those we can fall back using
|
||||
# the host_guid field of the cluster data
|
||||
valid_uuid = False
|
||||
try:
|
||||
parsed_uuid = uuid.UUID(self.configuration.uuid)
|
||||
valid_uuid = parsed_uuid.int != 0
|
||||
except:
|
||||
pass
|
||||
|
||||
if not valid_uuid:
|
||||
try:
|
||||
self.configuration.uuid = kwargs.get("host_guid")
|
||||
except:
|
||||
pass
|
||||
|
||||
super().__init__(**kwargs)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue