Edit autostart, startup order and tags from the info screen
The info screen's Resources table shows Autostart (yes/no), Startup (order, up and down delays) and Tags. o opens a dialog to change them. Only keys that differ are sent, in one `set <kind> config` call through the existing set_net. A confirm lists the old and new value of each key. Tags are removed with `--delete tags` on set config. The CLI also has a `delete ct|vm ... tags` command, but it shares the form that destroys the whole guest, so the app never uses it; nothing in the code builds a delete ct|vm argv. Inputs are validated before sending: startup values must be ints >= 0, and tags must match [A-Za-z0-9_][A-Za-z0-9_+.-]*. They are split on ; , or whitespace and deduplicated. Live test on CT 104: onboot 1 -> 0, startup order=5,up=10, tag tui-test added, then all set back through the dialog. The config ended identical to the baseline. Closes #18 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit was merged in pull request #30.
This commit is contained in:
1 parent
d97ad22c78
commit
f5f3effce5
6 files changed
+634
No files matched your search
@@ -657,3 +657,43 @@ CLI facts (read-only probes):
|
||||
|
||||
- Pure function `guest_matches(guest: dict, query: str) -> bool` in `app.py` (or
|
||||
`cli.py`-free module-level helper) so it can be tested without the UI.
|
||||
|
||||
---
|
||||
|
||||
# Autostart, startup order and tags (issue #18)
|
||||
|
||||
## Decision
|
||||
|
||||
Shown on the info screen; edited with key `o` (options) there. LXC and VM.
|
||||
|
||||
CLI facts (read-only probes, PVE 9.2):
|
||||
|
||||
- Config keys: `onboot` (0/1, absent = 0), `startup` (`[[order=]N][,up=S][,down=S]`,
|
||||
absent = none), `tags` (`;`-separated, e.g. `172.16.41.200;community-script;os`).
|
||||
- Write with `set <kind> config <node> <vmid> --onboot 0|1 --startup <s> --tags <t>
|
||||
[--delete startup,tags] --wait` - i.e. the existing `cli.set_net(guest, changes)` (one
|
||||
call; `None` values go to `--delete`).
|
||||
- DANGER: `delete ct|vm ... tags` exists but shares the guest-destroying `delete ct|vm
|
||||
<node> <vmid>` form. Never use it; removing tags = `--delete tags` on `set config`.
|
||||
|
||||
### `cli.py`
|
||||
|
||||
- `startup_value(order, up, down) -> str | None` - ints >= 0 or None; builds
|
||||
`order=N[,up=S][,down=S]` (only the given parts); all None -> None. ValueError for
|
||||
negatives/non-ints. `parse_startup(s) -> (order, up, down)` (accepts a bare leading
|
||||
number as order).
|
||||
- `tags_value(text) -> str | None` - split on `;`, `,` or whitespace, drop empties and
|
||||
duplicates (order kept); each tag must match `[A-Za-z0-9_][A-Za-z0-9_+.-]*` else
|
||||
ValueError; joined with `;`; none -> None.
|
||||
|
||||
### `app.py` (UI contract)
|
||||
|
||||
- Info screen Resources table gets rows "Autostart" (`yes`/`no`), "Startup" (e.g.
|
||||
`order 2, up 10 s, down 30 s` or `-`), "Tags" (`a, b, c` or `-`); In use `-`.
|
||||
- `o`: `BootScreen` dialog (DialogScreen style, title "Boot and tags: <name> (<vmid>)"):
|
||||
`Checkbox#onboot`, `Input#order`, `Input#up`, `Input#down` (empty = not set),
|
||||
`Input#tags` (prefilled `a; b; c`), buttons `#apply`/`#cancel`, escape = cancel.
|
||||
Apply: build changes for keys whose value differs (`onboot` "1"/"0", `startup` string
|
||||
or None, `tags` string or None); invalid -> error notify, dialog stays, no call; no
|
||||
change -> info notify; else `ConfirmScreen` titled "Boot and tags" listing old -> new
|
||||
per key; yes -> busy guard, `cli.set_net(guest, changes)` via start_job, info reloads.
|
||||
Reference in new issue
Block a user