Skip to content

Commit

Permalink
refactor lookup plugins using top down method (ansible-collections#523)
Browse files Browse the repository at this point in the history
SUMMARY
This change rewrites the lookup plugin logic to use a top down approach to finding objects. The plugins will now step through an objects path and try to lookup each intermediate object until it gets to the final object.
The old method has a few issues:

The existing plugins use an incorrect search method  which yield inconsistent results (as described in ansible-collections#500)
They also cannot find resources with the same name, even if the paths given are unique. For example, if /datacenter/vms/my-folder and /datacenter/hosts/my-folder both exist, you can never find either one
Items with the same name will cause conflicts, even if those items have slightly different paths. For example: /datacenter/vms/foo and /datacenter/hosts/foo  existing at the same time makes it difficult to search for either folder

Fixes:
ansible-collections#500
ansible-collections#445
ansible-collections#324
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
all lookup plugins
ADDITIONAL INFORMATION
The original top down approach is described in ansible-collections#445. I tried to get that version working but ran into a few issues.

Reviewed-by: Danielle Barda
Reviewed-by: Ondra Machacek <machacek.ondra@gmail.com>
Reviewed-by: mikemorency
  • Loading branch information
mikemorency authored Sep 9, 2024
1 parent 01869ac commit 7ee65d2
Show file tree
Hide file tree
Showing 2 changed files with 247 additions and 499 deletions.
34 changes: 34 additions & 0 deletions changelogs/fragments/523-refactor-lookup-plugins.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
minor_changes:
- >-
cluster_moid - Fix bug where lookup would return incosistent results for objects in nested paths.
Fixes issues https://github.com/ansible-collections/vmware.vmware_rest/issues/500 https://github.com/ansible-collections/vmware.vmware_rest/pull/445
https://github.com/ansible-collections/vmware.vmware_rest/issues/324 (https://github.com/ansible-collections/vmware.vmware_rest/pull/523)
- >-
datacenter_moid - Fix bug where lookup would return incosistent results for objects in nested paths
Fixes issues https://github.com/ansible-collections/vmware.vmware_rest/issues/500 https://github.com/ansible-collections/vmware.vmware_rest/pull/445
https://github.com/ansible-collections/vmware.vmware_rest/issues/324 (https://github.com/ansible-collections/vmware.vmware_rest/pull/523)
- >-
datastore_moid - Fix bug where lookup would return incosistent results for objects in nested paths
Fixes issues https://github.com/ansible-collections/vmware.vmware_rest/issues/500 https://github.com/ansible-collections/vmware.vmware_rest/pull/445
https://github.com/ansible-collections/vmware.vmware_rest/issues/324 (https://github.com/ansible-collections/vmware.vmware_rest/pull/523)
- >-
folder_moid - Fix bug where lookup would return incosistent results for objects in nested paths
Fixes issues https://github.com/ansible-collections/vmware.vmware_rest/issues/500 https://github.com/ansible-collections/vmware.vmware_rest/pull/445
https://github.com/ansible-collections/vmware.vmware_rest/issues/324 (https://github.com/ansible-collections/vmware.vmware_rest/pull/523)
- >-
host_moid - Fix bug where lookup would return incosistent results for objects in nested paths
Fixes issues https://github.com/ansible-collections/vmware.vmware_rest/issues/500 https://github.com/ansible-collections/vmware.vmware_rest/pull/445
https://github.com/ansible-collections/vmware.vmware_rest/issues/324 (https://github.com/ansible-collections/vmware.vmware_rest/pull/523)
- >-
network_moid - Fix bug where lookup would return incosistent results for objects in nested paths
Fixes issues https://github.com/ansible-collections/vmware.vmware_rest/issues/500 https://github.com/ansible-collections/vmware.vmware_rest/pull/445
https://github.com/ansible-collections/vmware.vmware_rest/issues/324 (https://github.com/ansible-collections/vmware.vmware_rest/pull/523)
- >-
resource_pool_moid - Fix bug where lookup would return incosistent results for objects in nested paths
Fixes issues https://github.com/ansible-collections/vmware.vmware_rest/issues/500 https://github.com/ansible-collections/vmware.vmware_rest/pull/445
https://github.com/ansible-collections/vmware.vmware_rest/issues/324 (https://github.com/ansible-collections/vmware.vmware_rest/pull/523)
- >-
vm_moid - Fix bug where lookup would return incosistent results for objects in nested paths
Fixes issues https://github.com/ansible-collections/vmware.vmware_rest/issues/500 https://github.com/ansible-collections/vmware.vmware_rest/pull/445
https://github.com/ansible-collections/vmware.vmware_rest/issues/324 (https://github.com/ansible-collections/vmware.vmware_rest/pull/523)
Loading

0 comments on commit 7ee65d2

Please sign in to comment.