Fix four quality findings from re-review

sitecustomize.py: exec_module now records a FAIL status when the underlying
module load raises, instead of leaving hook_status.json unwritten. cmd_verify
will now show a diagnostic FAIL rather than the misleading "no status file".

sitecustomize.py: URL-fix loop covers --repository and --repository= in
addition to --repo/--repo=/-r; these are documented restic synonyms.

sitecustomize.py: _replace fallback now catches AttributeError in addition
to TypeError so an unrecognised ResticConfig return type silently falls back
to returning the unmodified result rather than crashing the backup job.

patch_ui.py: warns when FIND.subn produces a count other than 1, making
unexpected multi-replacement visible in the apply log.

uninstall.sh: find for JS bundle restore now includes /usr/share/truenas-ui,
matching all three entries in patch_ui.py's WEBUI_CANDIDATES.
This commit is contained in:
2026-06-15 03:58:06 +00:00
parent 91c607a707
commit 8829fbb9d4
3 changed files with 47 additions and 21 deletions
+6
View File
@@ -93,6 +93,12 @@ def main():
shutil.copy2(path, backup)
patched, count = FIND.subn(REPLACE, content)
if count != 1:
print(
f"[truecloud-patch] WARNING: {count} replacement(s) in {path}; "
f"expected exactly 1 — file an issue at "
f"https://github.com/sudolulo/truenas-truecloud-patch"
)
tmp = path + ".tmp"
try: