Fix native-nested probe: guard message is split across string literals
The probe searched plugins/cloud/crud.py for the contiguous string
"no further nesting". Stock does not contain it. The message is split across
adjacent string literals:
verrors.add(f"{name}.snapshot", "This option is only available for datasets that have no further "
"nesting")
Python concatenates those at runtime, so the errmsg IS contiguous and CRUD_BLOCK's
runtime filter matches correctly -- but the SOURCE never contains the whole
phrase. The probe therefore found nothing, concluded iX had removed the guard, and
skipped the nested module as "already native" on every boot. apply.log would say
"TrueNAS now handles nesting natively" and the feature would never work.
It fails safe -- the stock guard stays in place, so no backup could be
misconfigured and no data was at risk -- but the module was 100% dead.
Verified against real middlewared on a live box: the probe returned native=yes
(wrong) before this change and native=no (correct) after.
The probe now strips whitespace and quote characters before matching, which is
robust to any wrapping or concatenation style. Added a regression test that
EXECUTES apply.sh's own probe code (extracted, not reimplemented -- a
reimplementation would pass while the shipped probe stayed broken) against the
real wrapped source, a single-line variant, and a three-way split.
75 tests, ruff and shellcheck clean.
This commit is contained in:
@@ -146,6 +146,25 @@
|
||||
only record that an interrupted run's snapshot tree is still on disk; both
|
||||
scripts now name the snapshot (`zfs destroy -r ...`) before clearing it.
|
||||
|
||||
- **The native-nested probe could never detect the guard, silently disabling the
|
||||
whole module.** Stock splits the message across adjacent string literals:
|
||||
|
||||
```python
|
||||
verrors.add(f"{name}.snapshot", "This option is only available for datasets that have no further "
|
||||
"nesting")
|
||||
```
|
||||
|
||||
Python concatenates those at runtime — so the *errmsg* is contiguous and the
|
||||
runtime filter works — but the **source never contains the whole phrase**. The
|
||||
probe's substring search found nothing, concluded iX had removed the guard, and
|
||||
skipped the nested module as "already native". `apply.log` would report
|
||||
*"TrueNAS now handles nesting natively"* and the feature would never work.
|
||||
It fails safe (the stock guard stays, so no data is at risk) but the module was
|
||||
100% dead. The probe now strips whitespace and quotes before matching, which is
|
||||
robust to any wrapping style. Caught only by running the probe against real
|
||||
middlewared; there is now a regression test that executes apply.sh's own probe
|
||||
code against the real wrapped source.
|
||||
|
||||
### Refactored
|
||||
|
||||
- Staging teardown had been copy-pasted into `uninstall.sh` and `recover.sh` —
|
||||
|
||||
Reference in New Issue
Block a user