Skip to content

Commit

Permalink
fix(sct_config): remove special characters from user_perfix
Browse files Browse the repository at this point in the history
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
(cherry picked from commit 952a0cd)
  • Loading branch information
fruch committed Nov 27, 2024
1 parent fbae273 commit 2f8a5db
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sdcm/sct_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1939,6 +1939,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!")
Expand Down

0 comments on commit 2f8a5db

Please sign in to comment.