Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions src/trustshell/product_definitions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from collections import defaultdict
import copy
from datetime import datetime
import json
import logging
import os
Expand Down Expand Up @@ -128,6 +129,7 @@ def __init__(
active_only: bool = True,
rhel_git_branch: str = "main",
rhel_releases_path: str = "",
check_lifecycle: bool = False,
) -> None:
self.stream_nodes_by_cpe: dict[str, list[ProductStream]] = defaultdict(list)
product_streams_by_name: dict[str, list[ProductStream]] = defaultdict(list)
Expand Down Expand Up @@ -167,6 +169,29 @@ def __init__(
for ps_module, module_data in data["ps_modules"].items():
cpes = module_data.get("cpe", [])

# Check module-level active status based on lifecycle data
module_is_active = True
if check_lifecycle:
lifecycle = module_data.get("lifecycle", {})
if lifecycle:
supported_from = lifecycle.get("supported_from")
if supported_from:
try:
supported_from_date = datetime.strptime(
supported_from, "%Y-%m-%d"
).date()
current_date = datetime.now().date()
# Module is only active if supported_from date is today or in the past
module_is_active = supported_from_date <= current_date
except ValueError as e:
logger.warning(
f"Invalid date format for {ps_module} supported_from: {supported_from}, error: {e}"
)

# Skip this module if it's not active yet (based on lifecycle)
if active_only and not module_is_active:
continue

active_streams: set[str] = set()
active_streams.update(module_data.get("active_ps_update_streams", []))
for stream in module_data.get("ps_update_streams"):
Expand Down
Loading