v0.5.0: TrueNAS alert when an update is available
Raises a real alert in the TrueNAS UI bell -- not a log line nobody reads. On by default, checked once a day. install.sh --no-update-alerts turns it off. It does not nag --------------- A release whose CHANGELOG contains only a "### Docs" section changed no code and raises nothing. Anything else raises INFO; a "### Security" section raises WARNING. The CHANGELOG's own section headings are the signal, and a security fix anywhere in the range escalates the whole span -- a docs-only release sitting on top of a security fix still reports as security rather than hiding it. Why an AlertSource and not midclt ---------------------------------- TrueNAS cannot raise an alert from the CLI. midclt exposes only alert.dismiss, alert.list, alert.list_categories, alert.list_policies and alert.restore -- alert CREATION is internal to middlewared, and none of its ~60 one-shot classes is generic enough to reuse. Registering an AlertSource is the only way. It is also the least invasive thing this patch does. The providers and nested modules both APPEND CODE TO STOCK middleware files; the alert source ADDS ONE FILE and modifies none. It is the native mechanism -- the same one every built-in TrueNAS alert uses -- and TrueNAS polls it itself, so there is no cron job and no systemd timer. - Fail-safe: every error path returns None; it cannot take middlewared down. - Read-only: `git ls-remote` plus an HTTPS fetch of the CHANGELOG. It never writes to .git, so it cannot leave root-owned objects behind the way a `git fetch` from middlewared (running as root) would. - Removed by uninstall.sh (mw_patch.revert_all). - It only tells you; it never updates anything. Verified against the real repo and remote, with middlewared stubbed: on v0.4.1, only a README-only v0.4.2 available -> NO ALERT on v0.4.0, v0.4.1 fixed real bugs -> INFO on v0.3.2, v0.3.3 was the password fix -> SECURITY / WARNING 139 tests, ruff and shellcheck -S style clean.
This commit is contained in:
@@ -59,6 +59,7 @@ that capability natively. See [Native support](#if-truenas-adds-native-support).
|
||||
| `patch/truecloud_nested.py` | Nested-dataset staging: plan, mount, verify, tear down, sweep snapshots. Also `… cleanup` as a CLI. |
|
||||
| `patch/patch_ui.py` | Widens the Angular credential dropdown. Refuses to write a bundle whose parens it unbalanced. |
|
||||
| `patch/create_task.py` | Create TrueCloud tasks with S3/B2 credentials; `verify` the patch state. |
|
||||
| `patch/alert_source.py` | The TrueNAS alert for "an update is available". Installed into `middlewared/alert/source/`. |
|
||||
| `patch/wait_restart.sh` | Waits for boot to actually settle before restarting middlewared. |
|
||||
| `tools/release_notes.py` | Extracts a version's CHANGELOG section; enforces version consistency. Used by CI. |
|
||||
|
||||
@@ -433,6 +434,51 @@ The manual step *is* the safety gate. If you want convenience, watch the
|
||||
[releases feed](https://github.com/sudolulo/truenas-truecloud-patch/releases);
|
||||
don't automate the pull.
|
||||
|
||||
## Update alerts
|
||||
|
||||
When a newer release exists, the patch raises a **TrueNAS alert** (the bell in the
|
||||
UI) telling you so. It's on by default and checks once a day.
|
||||
|
||||
```bash
|
||||
bash install.sh --no-update-alerts # turn it off
|
||||
bash install.sh --update-alerts # turn it back on
|
||||
```
|
||||
|
||||
**It will not nag you about a README.** A release whose CHANGELOG contains only a
|
||||
`### Docs` section changed no code, and raises nothing. Anything that touched the
|
||||
system raises an INFO alert; a release with a `### Security` section raises a
|
||||
WARNING. The CHANGELOG's own section headings are the signal, and a security fix
|
||||
anywhere in the range escalates the whole span — a docs-only release on top of a
|
||||
security fix still reports as security.
|
||||
|
||||
### How it works, and why it's built this way
|
||||
|
||||
TrueNAS **cannot raise an alert from the CLI** — `midclt` exposes only
|
||||
`alert.dismiss`, `alert.list`, `alert.list_categories`, `alert.list_policies` and
|
||||
`alert.restore`. Alert *creation* is internal to middlewared, and none of its ~60
|
||||
one-shot alert classes is generic enough to reuse. So the only way to get a real
|
||||
alert is to register an `AlertSource`, which is what `patch/alert_source.py` does.
|
||||
|
||||
That is also the **least invasive** thing this patch does:
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| providers module | **modifies** stock files (appends code to `b2.py`, `restic.py`) |
|
||||
| nested module | **modifies** stock files (3 middleware modules) |
|
||||
| **update alert** | **adds one file. Modifies nothing.** |
|
||||
|
||||
It's the native mechanism — the same one every built-in TrueNAS alert uses — and
|
||||
TrueNAS polls it itself, so there is no cron job and no systemd timer.
|
||||
|
||||
- **Fail-safe.** Every error path returns `None`. It cannot take middlewared down.
|
||||
- **Read-only.** `git ls-remote` plus an HTTPS fetch of the CHANGELOG. It never
|
||||
writes to `.git`, so it cannot leave root-owned objects behind the way a
|
||||
`git fetch` from middlewared (which runs as root) would.
|
||||
- **Removed by `uninstall.sh`.**
|
||||
|
||||
It only *tells* you. It never updates anything — see
|
||||
[Why there is no auto-update](#why-there-is-no-auto-update).
|
||||
|
||||
## Creating a task via CLI
|
||||
|
||||
If the UI still shows only Storj after refreshing (e.g. the JS bundle pattern
|
||||
|
||||
Reference in New Issue
Block a user