mirror of
https://github.com/dkmstr/openuds.git
synced 2025-01-18 06:03:54 +03:00
chore: Refactor machine name sanitization method
This commit is contained in:
parent
029224c749
commit
397523c9a3
@ -311,8 +311,8 @@ class DynamicPublication(services.Publication, autoserializable.AutoSerializable
|
|||||||
|
|
||||||
# First we should create a full clone, so base machine do not get fullfilled with "garbage" delta disks...
|
# First we should create a full clone, so base machine do not get fullfilled with "garbage" delta disks...
|
||||||
# Add a number based on current time to avoid collisions
|
# Add a number based on current time to avoid collisions
|
||||||
self._name = self.service().sanitize_machine_name(
|
self._name = self.service().sanitized_name(
|
||||||
f'UDS-Pub {self.servicepool_name()}-{int(time.time())%256:2X} {self.revision()}'
|
f'UDS-Pub-{self.servicepool_name()}-{int(time.time())%256:2X}-{self.revision()}'
|
||||||
)
|
)
|
||||||
self._is_flagged_for_destroy = False
|
self._is_flagged_for_destroy = False
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ class DynamicService(services.Service, abc.ABC): # pylint: disable=too-many-pub
|
|||||||
def get_lenname(self) -> int:
|
def get_lenname(self) -> int:
|
||||||
return self.lenname.value
|
return self.lenname.value
|
||||||
|
|
||||||
def sanitize_machine_name(self, name: str) -> str:
|
def sanitized_name(self, name: str) -> str:
|
||||||
"""
|
"""
|
||||||
Sanitize machine name
|
Sanitize machine name
|
||||||
Override it to provide a custom name sanitizer
|
Override it to provide a custom name sanitizer
|
||||||
|
Loading…
x
Reference in New Issue
Block a user