fix: strip all whitespace from relation key/value parsing#511
Closed
dirtycache wants to merge 5 commits into
Closed
fix: strip all whitespace from relation key/value parsing#511dirtycache wants to merge 5 commits into
dirtycache wants to merge 5 commits into
Conversation
added 5 commits
June 17, 2026 16:57
Allows overriding a VM's platform in NetBox based on a regex match against the vCenter annotation (notes) field. Useful when vSphere misreports the guest OS — F5 BIG-IP/BIG-IQ VE VMs identify as CentOS but carry identifying text in their annotation. Patterns are compiled with re.DOTALL and matched via re.search so they span newlines and match anywhere in the annotation without anchoring. Takes priority over vm_platform_relation when both would match. The annotation is now always read from vCenter regardless of the skip_vm_comments setting, so platform detection works even when comment syncing is disabled.
Introduces a new config option that allows the same IP address to appear on multiple VM interfaces simultaneously without triggering duplicate-assignment warnings or being skipped. A common real-world scenario is isolated HA peer-to-peer VLANs where the same /30 addressing scheme is reused across many VM pairs. The IPs are unique within each link VLAN but overlap globally, causing netbox-sync's in-memory duplicate check to warn and skip the second (and subsequent) interface assignments. When an IP falls within a configured overlapping subnet, netbox-sync creates a separate NetBox IP address object per interface rather than sharing a single object. The existing duplicate-check logic for all other IPs is unchanged.
vmware-vapi-runtime 2.52.0 imports pkg_resources at runtime in vmware/vapi/l10n/bundle.py. setuptools >= 81 added a DeprecationWarning to pkg_resources, causing a UserWarning to be emitted on every run when the vSphere source is configured. Suppress the specific warning at startup until the vapi stack is upgraded to 9.x, where the import is replaced with importlib.resources.
…rsing
configparser joins multi-line values with \n, so relation entries on
continuation lines start with a leading newline. The previous strip(' "')
left that newline in the regex pattern, causing matches to fail unless
the annotation itself started with a newline.
Using strip() fixes multi-line *_relation config values in settings.ini.
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.
Summary
configparserjoins multi-line config values with\n, so relation entries on continuation lines start with a leading newline character.strip(' "')only stripped spaces and quotes, leaving the\nin the compiled regex patternre.search()to silently fail for any multi-linevm_platform_from_annotation_relationvalue — the regex required a literal newline before the pattern text.strip()which strips all whitespace including newlines; fixes both the annotation-specific block and the general*_relationblockTest plan
vm_platform_from_annotation_relationwritten across multiple continuation lines insettings.inicorrectly matches VM annotations on the next sync