vmware: add tag_name_include_category, and fix vm_exclude_by_tag_filter - #562
Merged
Merged
Conversation
Include vCenter tag category as name prefix (CategoryName:TagName). Also fix vm_exclude_by_tag_filter comparing strings to NBTag objects.
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.
Closes #518 by @ifrantic, commits are his.
The option itself is what he wrote: with
tag_name_include_categoryon, a vCenter tag is synced asCategory: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 andvm_exclude_by_tag_filtercompared them against the plain strings from the config, so the filter never excluded anything. Hisextract_tag_name()comparison fixes it. There is a test for that which fails on development and passes here.tests/test_vmware_tag_category.pyfakes 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 givesenv:prod, and the exclude filter actually excludes. Suite 118.