Fix five quality findings; expand recovery and restore documentation
patch_ui.py: - Write Angular bundle atomically via tmp + os.replace, matching the pattern already used by _record_status. Prevents a corrupt bundle if the write is interrupted mid-boot. sitecustomize.py: - Tighten _record_status count barrier comment to name _Finder._targets as the canonical count, making the coupling visible to future editors. uninstall.sh: - Verify middlewared restarted cleanly after uninstall, with journalctl guidance on failure — matching recover.sh's existing pattern. apply.sh: - Change second line of site-packages error block from WARNING: prefix (misleading for an instructional message) to a plain Run: hint. create_task.py: - Guard __doc__ against None in epilog extraction so -OO does not crash. README.md: - Split Emergency recovery into three named subsections: middlewared won't start, web UI is blank or broken (corrupt bundle recovery), and backend verify shows FAIL. Each gives direct commands and escalation steps. - Add Restoring from a TrueCloud Backup section: finding the restic binary, gathering credentials, provider-specific env var setup for B2 and S3, listing and restoring snapshots, and operational notes on restore hygiene. - Clarify that hook_status.json is written once both target modules have loaded (not necessarily at the instant middlewared starts).
This commit is contained in:
+7
-1
@@ -109,11 +109,17 @@ def main():
|
||||
|
||||
patched, count = FIND.subn(REPLACE, content)
|
||||
|
||||
tmp = path + ".tmp"
|
||||
try:
|
||||
with open(path, "w", encoding="utf-8") as fh:
|
||||
with open(tmp, "w", encoding="utf-8") as fh:
|
||||
fh.write(patched)
|
||||
os.replace(tmp, path)
|
||||
except OSError as exc:
|
||||
print(f"[truecloud-patch] ERROR: Could not write {path}: {exc}")
|
||||
try:
|
||||
os.unlink(tmp)
|
||||
except OSError:
|
||||
pass
|
||||
return
|
||||
|
||||
print(f"[truecloud-patch] UI bundle patched ({count} replacement(s)): {path}")
|
||||
|
||||
Reference in New Issue
Block a user