Skip to content
Merged
Changes from 1 commit
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
12 changes: 11 additions & 1 deletion tribits/ci_support/CheckinTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,17 @@ def getExtraCommandOutputFileName():


def getHostname():
return getCmndOutput("hostname", True)
hostname = ""
try:
hostname = getCmndOutput("hostname", True)
except Exception:
pass
if hostname == "":
try:
hostname = getCmndOutput("cat /etc/hostname", True)
Comment thread
bartlettroscoe marked this conversation as resolved.
Outdated
except Exception:
Comment on lines +164 to +171
Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Catching Exception and silently pass will also swallow unexpected failures (e.g., coding errors, KeyboardInterrupt), making debugging hard. Prefer calling getCmndOutput(..., throwOnError=False) or only catching RuntimeError from getCmndOutput and handling that explicitly (optionally with a minimal fallback value).

Suggested change
except Exception:
pass
if hostname == "":
try:
hostname = getCmndOutput("cat /etc/hostname", True)
except Exception:
except RuntimeError:
pass
if hostname == "":
try:
hostname = getCmndOutput("cat /etc/hostname", True)
except RuntimeError:

Copilot uses AI. Check for mistakes.
pass
return hostname
Comment on lines +166 to +173
Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If both the hostname command and /etc/hostname fallback fail, this now returns an empty string. That propagates into email subjects/bodies (e.g., "...: %s: %s"), producing blank hostnames and making messages harder to interpret. Consider returning a clear sentinel like "unknown" (or using socket.gethostname() as a final fallback) instead of "".

Copilot uses AI. Check for mistakes.


def getEmailAddressesSpaceString(emailAddressesCommasStr):
Expand Down
Loading