Skip to content

vmware: add tag_name_include_category option - #518

Merged
semx merged 1 commit into
bb-Ricardo:feature/vcenter-tag-categoryfrom
ifrantic:feature/vmware-tag-category-in-name
Sep 9, 2026
Merged

semx merged 1 commit into
bb-Ricardo:feature/vcenter-tag-categoryfrom
ifrantic:feature/vmware-tag-category-in-name

Conversation

@ifrantic

Copy link
Copy Markdown

vCenter tags have both a name and a category, but only the tag name was previously synced to NetBox. This loses context and makes it hard to distinguish tags that share a name across different categories.

Changes

  • Add new config option tag_name_include_category (bool, default False) in the VMware source config. When enabled, tags are synced to NetBox as CategoryName:TagName instead of just TagName.

  • The option is backward compatible — existing behaviour is preserved when False.

  • On first run after enabling, old bare-name tags are cleanly removed from objects and replaced with the prefixed format. Old orphaned tags in NetBox must be deleted manually as before.

Config example
tag_name_include_category = True

  • With a vCenter tag named HR in category Department, NetBox will store the tag as Department:HR.

Note:
if vm_exclude_by_tag_filter is in use and tag_name_include_category is enabled, filter entries must be updated to the CategoryName:TagName format.

Include vCenter tag category as name prefix (CategoryName:TagName).
Also fix vm_exclude_by_tag_filter comparing strings to NBTag objects.

@semx semx left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified: merges onto development and the suite passes. Two things before I can take it. First, part of the change is not behind the flag: with tag_name_include_category off (the default), the tag description is now rewritten to "<category>: <description>" (or to the bare category name), and a Category.get() call is made for every tag. That changes what every existing user sees on the next run, so please keep both the description rewrite and the extra lookup under the option, so the default path stays byte-identical. Second, the PR targets main; please retarget it to development. The option itself looks good.

@semx
semx changed the base branch from main to feature/vcenter-tag-category September 9, 2026 23:12
@semx
semx requested a review from bb-Ricardo as a code owner September 9, 2026 23:12
@semx
semx merged commit beae1ad into bb-Ricardo:feature/vcenter-tag-category Sep 9, 2026
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