Skip to content

Commit

Permalink
Added validation for namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
itisallgood committed Oct 24, 2024
1 parent f171a4d commit 10da31a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions robusta_krr/core/models/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ def validate_namespaces(cls, v: Union[list[str], Literal["*"]]) -> Union[list[st
if v == []:
return "*"

if isinstance(v, list):
for val in v:
if val.startswith("*"):
raise ValueError("Namespace's values cannot start with an asterisk (*)")

return [val.lower() for val in v]

@pd.validator("resources", pre=True)
Expand Down Expand Up @@ -183,6 +188,7 @@ def __init__(self) -> None:
pass

def __getattr__(self, name: str):
print("it is just config")
if _config is None:
raise AttributeError("Config is not set")

Expand Down

0 comments on commit 10da31a

Please sign in to comment.