diff options
Diffstat (limited to 'src/api/models.py')
-rw-r--r-- | src/api/models.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/api/models.py b/src/api/models.py index 5928ea9..93168f5 100644 --- a/src/api/models.py +++ b/src/api/models.py @@ -20,6 +20,7 @@ from django.utils import timezone import json import uuid import yaml +import re from booking.models import Booking from resource_inventory.models import ( @@ -362,7 +363,8 @@ class GeneratedCloudConfig(models.Model): def _normalize_username(self, username: str) -> str: # TODO: make usernames posix compliant - return username + s = re.sub(r'\W+', '', username) + return s def _get_ssh_string(self, username: str) -> str: user = User.objects.get(username=username) @@ -502,7 +504,7 @@ class GeneratedCloudConfig(models.Model): return main_dict def serialize(self) -> str: - return yaml.dump(self._to_dict()) + return yaml.dump(self._to_dict(), width=float("inf")) class APILog(models.Model): |