1
0
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:
Adolfo Gómez García 2024-05-05 02:56:06 +02:00
parent 029224c749
commit 397523c9a3
No known key found for this signature in database
GPG Key ID: DD1ABF20724CDA23
2 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -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