Skip to content

vmware: add tag_name_include_category, and fix vm_exclude_by_tag_filter - #562

Merged
semx merged 3 commits into
developmentfrom
feature/vcenter-tag-category
Sep 9, 2026
Merged

semx merged 3 commits into
developmentfrom
feature/vcenter-tag-category

Conversation

@semx

@semx semx commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Closes #518 by @ifrantic, commits are his.

The option itself is what he wrote: with tag_name_include_category on, a vCenter tag is synced as Category:Tag. I only made it stay inside the option. On his branch the category was fetched for every tag on every run whether or not the option was set, and with the option off the tag description was rewritten to "<category>: <description>", which would have changed the tags of everyone who upgraded. Now the category is only looked up when the option is on, and it only affects the name, which is what the option says it does. A failing category lookup no longer logs at error level, it just leaves the name alone.

The part of his change I kept as is turned out to fix a real bug: collect_object_tags() returns NBTag objects and vm_exclude_by_tag_filter compared them against the plain strings from the config, so the filter never excluded anything. His extract_tag_name() comparison fixes it. There is a test for that which fails on development and passes here.

tests/test_vmware_tag_category.py fakes the tagging API since vcsim has none: default path leaves name and description untouched and does not touch the category API at all, option on gives env:prod, and the exclude filter actually excludes. Suite 118.

ifrantic and others added 3 commits July 28, 2026 12:42
Include vCenter tag category as name prefix (CategoryName:TagName).
Also fix vm_exclude_by_tag_filter comparing strings to NBTag objects.
@semx
semx requested a review from bb-Ricardo as a code owner September 9, 2026 23:16
@semx
semx merged commit a23684b into development Sep 9, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants