Skip to content

Commit b702f70

Browse files
committed
supervisor: Add a helper function for getting advisory url
Adds get_erratum_advisory_url, removes trailing slash from ET_URL, and updates erratum URL construction across the codebase.
1 parent 161d439 commit b702f70

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

supervisor/errata_utils.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
logger = logging.getLogger(__name__)
2121

2222

23-
ET_URL = "https://errata.engineering.redhat.com/"
23+
ET_URL = "https://errata.engineering.redhat.com"
2424

2525
# regex pattern for extracting timestamps from push logs
2626
_TIMESTAMP_PATTERN = re.compile(r"(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) \+0000")
@@ -117,6 +117,10 @@ def get_utc_timestamp_from_str(timestamp_string: str):
117117
)
118118

119119

120+
def get_erratum_advisory_url(erratum_id: str | int) -> str:
121+
return f"{ET_URL}/advisory/{erratum_id}"
122+
123+
120124
@overload
121125
def get_erratum(erratum_id: str | int, full: Literal[False] = False) -> Erratum: ...
122126

@@ -155,7 +159,7 @@ def get_erratum(erratum_id: str | int, full: bool = False) -> Erratum | FullErra
155159
base_erratum = Erratum(
156160
id=details["id"],
157161
full_advisory=details["fulladvisory"],
158-
url=f"https://errata.engineering.redhat.com/advisory/{erratum_id}",
162+
url=get_erratum_advisory_url(erratum_id),
159163
synopsis=details["synopsis"],
160164
status=ErrataStatus(details["status"]),
161165
jira_issues=jira_issues,

supervisor/erratum_handler.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
erratum_has_magic_string_in_comments,
2020
erratum_push_to_stage,
2121
erratum_refresh_security_alerts,
22+
get_erratum_advisory_url,
2223
get_erratum_build_map,
2324
get_erratum_transition_rules,
2425
get_previous_erratum,
@@ -95,7 +96,7 @@ def compare_file_lists(
9596
comment = (
9697
f"jotnar-product-listings-checked({current_build.nvr})\n\n"
9798
f"Compared the file lists for {current_build.nvr} to the file lists for\n"
98-
f"{previous_build.nvr} in https://errata.engineering.redhat.com/advisory/{previous_erratum_id} -\n"
99+
f"{previous_build.nvr} in {get_erratum_advisory_url(previous_erratum_id)} -\n"
99100
)
100101

101102
if is_matched:

0 commit comments

Comments
 (0)