Wrap original get_restic_config instead of replacing it; add hook status file
sitecustomize.py: _patch_restic no longer reimplements get_restic_config. It now wraps the original: calls _orig(cloud_backup) to get a ResticConfig, then post-processes only the -r argument to fix "b2:/bucket" → "b2:bucket" when the URL contains a stray leading slash (the stock bug for empty-hostname providers). Uses dataclasses.replace() to build the corrected result so new ResticConfig fields added in future TrueNAS versions pass through unchanged. This eliminates the transfer_setting gap, env dict mutation, and frozen-copy drift that would occur over time. Also adds a status file mechanism: sitecustomize.py writes /data/truecloud-patch/hook_status.json atomically after both patches have reported success or failure. This gives a machine-readable signal that the hook fired correctly — without requiring log scraping. create_task.py: new "verify" subcommand reads the status file and prints a human-readable summary. Does not require --host or --api-key. --host and --api-key are now optional at the parser level and validated only for subcommands that actually need an API connection. README: update troubleshooting to use "create_task.py verify" instead of the manual Python introspection one-liner.
This commit is contained in:
@@ -206,11 +206,11 @@ cat /data/truecloud-patch/apply.log
|
||||
|
||||
**Verify backend patch is loaded** (while middlewared is running):
|
||||
```bash
|
||||
python3 -c "
|
||||
from middlewared.rclone.remote.b2 import B2RcloneRemote
|
||||
print('B2 restic support:', hasattr(B2RcloneRemote, 'get_restic_config'))
|
||||
"
|
||||
python3 /data/truecloud-patch/create_task.py verify
|
||||
```
|
||||
This reads `/data/truecloud-patch/hook_status.json`, written by the import hook
|
||||
at middlewared startup. It shows which patches applied and any failure details.
|
||||
Does not require `--host` or `--api-key`.
|
||||
|
||||
**Verify the UI patch** (should print your TrueNAS version):
|
||||
```bash
|
||||
|
||||
Reference in New Issue
Block a user