vmware_guest_network add error rise and improve O(folder) description#2522
Open
GuideGlyph wants to merge 2 commits into
Open
vmware_guest_network add error rise and improve O(folder) description#2522GuideGlyph wants to merge 2 commits into
GuideGlyph wants to merge 2 commits into
Conversation
|
Build succeeded. ✔️ ansible-tox-linters SUCCESS in 4m 57s |
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
Raise an error when vm_obj not found and improve vmware_guest_network documentation. O(folder) does not work when O(datacenter) is set by default or incorrectly. This behavior is now documented.
ISSUE TYPE
COMPONENT NAME
vmware_guest_network.py
ADDITIONAL INFORMATION
The module searches for the VM using def get_vm(self).
If name is in self.params, it loops through all VMs:
When multiple VMs are found, it checks:
This code selects the first matching VM, which is not ideal, but changing this behavior is out of scope for this PR.
It checks if not actual_vm_folder_path.startswith("%s%s" % (dcpath, user_defined_dc)). Without a correct O(datacenter) value, it skips the VMs.
In my scenario, I had O(folder) specified and multiple VMs with the same name in different folders. O(datacenter) was left at its default value because it was not documented as required.
As a result, find_vm() returned None, and finally get_nics_from_vm() raised an error: AttributeError: 'NoneType' object has no attribute 'config'.