-
Notifications
You must be signed in to change notification settings - Fork 9
Fix default mails #221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix default mails #221
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,7 +14,6 @@ | |
| from pathlib import Path | ||
| from typing import Dict, List | ||
|
|
||
| DEFAULT_MAILS: List[str] = [] | ||
| SCLORG_MAILS = {} | ||
| SEND_PASTE_BIN = "/root/ci-scripts/send_to_paste_bin.sh" | ||
|
|
||
|
|
@@ -121,6 +120,7 @@ def __init__(self): | |
| self.full_success = False | ||
| self.smtp_port = 25 | ||
| self.smtp_server = "smtp.redhat.com" | ||
| self.default_mails: List[str] = [] | ||
| if self.args.upstream_tests: | ||
| self.available_test_case = TEST_UPSTREAM_CASES | ||
| else: | ||
|
|
@@ -184,14 +184,14 @@ def load_mails_from_environment(self): | |
| if "SMTP_PORT" in os.environ: | ||
| self.smtp_port = int(os.getenv("SMTP_PORT", 25)) | ||
| if "DEFAULT_MAILS" in os.environ: | ||
| DEFAULT_MAILS = os.environ["DEFAULT_MAILS"].split(",") | ||
| self.default_mails = os.environ["DEFAULT_MAILS"].split(",") | ||
| if "NIGHTLY_BUILDS_URL" in os.environ: | ||
| self.nightly_builds_url = os.environ("NIGHTLY_BUILDS_URL", "") | ||
| self.send_email = os.environ.get("SEND_EMAIL", False) | ||
| self.send_email = True | ||
|
|
||
| print(f"Loaded mails from environment: '{SCLORG_MAILS}'") | ||
| print(f"Default mails: '{DEFAULT_MAILS}'") | ||
| print(f"Default mails: '{self.default_mails}'") | ||
phracek marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| print(f"Send email: '{self.send_email}'") | ||
|
|
||
| def send_file_to_pastebin(self, log_path, log_name: Path): | ||
|
|
@@ -442,19 +442,23 @@ def generate_emails(self): | |
| """ | ||
| Generate email list based on collected data and predefined email lists for each container. | ||
| """ | ||
| print("generate_emails: ", self.data_dict) | ||
| print("GENERATE_MAILS: ", self.data_dict) | ||
| print("GENERATE_MAILS: Available test cases: ", self.available_test_case) | ||
| for test_case, plan, _ in self.available_test_case: | ||
|
Comment on lines
+445
to
447
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix unused loop variable and reduce noisy debug output. Line 447 has an unused Proposed fix- print("GENERATE_MAILS: ", self.data_dict)
- print("GENERATE_MAILS: Available test cases: ", self.available_test_case)
- for test_case, plan, _ in self.available_test_case:
+ print("GENERATE_MAILS: starting recipient aggregation")
+ for test_case, _plan, _ in self.available_test_case:
if test_case not in self.data_dict:
continue
for _, name in self.data_dict[test_case]:
for cont, mails in SCLORG_MAILS.items():
- print(
- f"generate_emails: Checking if container name '{name}' starts with '{cont}'"
- )
if str(Path(name).with_suffix("")) != cont:
continue
for ml in mails:
if ml in self.default_mails:
continue
self.default_mails.append(ml)
- print(f"GENERATE_MAILS: Additional emails: {self.default_mails}")
+ print(f"GENERATE_MAILS: total recipients={len(self.default_mails)}")Also applies to: 452-454, 461-461 🧰 Tools🪛 Ruff (0.15.2)[warning] 447-447: Loop control variable Rename unused (B007) 🤖 Prompt for AI Agents |
||
| if test_case not in self.data_dict: | ||
| continue | ||
| for _, name in self.data_dict[test_case]: | ||
| for cont, mails in SCLORG_MAILS.items(): | ||
| print( | ||
| f"generate_emails: Checking if container name '{name}' starts with '{cont}'" | ||
| ) | ||
| if str(Path(name).with_suffix("")) != cont: | ||
| continue | ||
| for ml in mails: | ||
| if ml in DEFAULT_MAILS: | ||
| if ml in self.default_mails: | ||
| continue | ||
| DEFAULT_MAILS.append(ml) | ||
| print(f"generate_emails: Additional emails: {DEFAULT_MAILS}") | ||
| self.default_mails.append(ml) | ||
| print(f"GENERATE_MAILS: Additional emails: {self.default_mails}") | ||
|
|
||
| def send_emails(self): | ||
| """ | ||
|
|
@@ -478,7 +482,7 @@ def send_emails(self): | |
| if self.args.upstream_tests: | ||
| send_to = SCLORG_MAILS.get("upstream-tests", []) | ||
| else: | ||
| send_to = DEFAULT_MAILS | ||
| send_to = self.default_mails | ||
|
|
||
| self.mime_msg["From"] = send_from | ||
| self.mime_msg["To"] = ", ".join(send_to) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sanitize
DEFAULT_MAILSbefore storing recipients.Line 187 can retain empty/whitespace entries (e.g., trailing commas), which may cause recipient validation failures later.
Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents