From 952a0cd558af9579b769b4bdb1817c25e4883726 Mon Sep 17 00:00:00 2001 From: Israel Fruchter Date: Tue, 26 Nov 2024 17:00:35 +0200 Subject: [PATCH] fix(sct_config): remove special characters from `user_perfix` remove any special characters from `user_prefix`, since later it will be used as a part of the instance names and some platfrom don't support special characters in the instance names (docker, AWS and such) Fixes: #8919 --- sdcm/sct_config.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sdcm/sct_config.py b/sdcm/sct_config.py index a005cbcb34..7778887dc2 100644 --- a/sdcm/sct_config.py +++ b/sdcm/sct_config.py @@ -1995,6 +1995,10 @@ def __init__(self): # noqa: PLR0912, PLR0914, PLR0915 prefix_max_len -= 3 self['user_prefix'] = user_prefix[:prefix_max_len] + # remove any special characters from user_prefix, since later it will be used as a part of the instance names + # and some platfrom don't support special characters in the instance names (docker, AWS and such) + self['user_prefix'] = re.sub(r"[^a-zA-Z0-9-]", "-", self['user_prefix']) + # 11) validate that supported instance_provision selected if self.get('instance_provision') not in ['spot', 'on_demand', 'spot_fleet', 'spot_low_price']: raise ValueError(f"Selected instance_provision type '{self.get('instance_provision')}' is not supported!")