Skip to content

Commit

Permalink
add eol validator for ChannelsSchema model
Browse files Browse the repository at this point in the history
  • Loading branch information
Anas Husseini committed Feb 12, 2024
1 parent 00e2ff7 commit 57ce67f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/image/utils/schema/triggers.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Config:
def ensure_still_supported(cls, v: datetime) -> datetime:
"""ensure that the end of life isn't reached."""
if v < datetime.now(timezone.utc):
raise ImageReachedEol("This image revision has reached its end of life")
raise ImageReachedEol("This track has reached its end of life")
return v


Expand Down Expand Up @@ -71,6 +71,14 @@ def _check_risks(cls, values: List) -> str:

return values

@pydantic.validator("end_of_life")
@classmethod
def ensure_still_supported(cls, v: datetime) -> datetime:
"""ensure that the end of life isn't reached."""
if v < datetime.now(timezone.utc):
raise ImageReachedEol("This track has reached its end of life")
return v


class ImageSchema(pydantic.BaseModel):
"""Validates the schema of the image.yaml files."""
Expand Down

0 comments on commit 57ce67f

Please sign in to comment.