feat(incus/proxmox): tag managed containers and filter sync by default#76
Merged
Conversation
Mark remo-created Incus/Proxmox containers with a fixed provider-native marker (Incus user.remo=true config key; Proxmox `remo` guest tag) at provision time, and make `sync` filter on it by default — bringing the two hypervisor providers in line with AWS (tag:remo=true) and Hetzner (label_selector=remo). - create/update apply the marker host-side (idempotent; Proxmox preserves existing tags via a tag-set union); failure warns but never fails the command - sync registers only marked containers by default and names any skipped ones with both remedies (--all, `update <name>`); --all restores the pre-feature adopt-everything behavior and flags adopted-unmarked counts - sync stays read-only and uses a single bulk marker query per provider - no change to AWS/Hetzner, the registry line format, or the connect path Implements spec 013-managed-instance-tags (FR-001..FR-013, SC-001..SC-006). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HAPB5GA4NVUgKFsVFVJDxN
Address code-review findings on feature 013: - _read_tags_by_vmid dumped every LXC conf and grepped `^tags:`, which also matched snapshot-section tag lines; dict last-wins could let an old snapshot's tags shadow the live tags and mis-classify a marked container (silently dropping it from a default sync). Read only the current-config tags — the `tags:` line above the first `[snapshot]` section — with the section logic in Python so it is unit-tested. - Add a regression test for snapshot-section tag shadowing. - Replace a vacuous incus `--all` assertion (a literal-newline substring that could never match) with a real check on the adopted-unmarked summary. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HAPB5GA4NVUgKFsVFVJDxN
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
remo's four providers split into two mental models forsync: AWS/Hetznerfilter on a provider-native marker (
tag:remo=true/label_selector=remo) andonly touch remo-created instances, while Incus/Proxmox marked nothing and
imported every container on the host. This closes that gap.
Incus/Proxmox containers
remocreates are now marked at provision time, andsyncfilters on that marker by default, with an explicit--allopt-out.Implements spec
013-managed-instance-tags(FR-001…FR-013, SC-001…SC-006).Behavior
(Incus
user.remo=trueconfig key; Proxmoxremoguest tag). Idempotent;Proxmox preserves existing tags via a tag-set union. A marking failure warns
but never fails the command (FR-005).
unmarked ones with both remedies (
--all,update <name>).the adopted-unmarked count.
syncstays read-only; one bulk marker query per provider (FR-013).Design note
The marker is applied host-side in the Python provider layer, not Ansible,
because
update's dev-tools playbook connects to the container's IP, not thehypervisor host — only the provider layer holds a host/node SSH context at both
createandupdatetime.Follow-up
Proxmox host access remains root SSH (
pct/conf parsing). Migrating that to theProxmox REST API is tracked in #75 — that would also expose
tagsas structureddata, retiring the conf-parsing this PR hardened.
Tests
New unit suites for both providers (marker apply/read, create/update wiring,
filtered sync,
--all, FR-010 read-only, FR-013 bounded queries, and aregression test for snapshot-section tag shadowing). Full suite green locally
(1125 passed); ruff + mypy clean.
🤖 Generated with Claude Code