feat(v2): MTV query inventory role - #75
Conversation
jeffcpullen
left a comment
There was a problem hiding this comment.
This is some really pretty Ansible. I reviewed the code but did not test it. Left feedback and comments inline.
Higher level feedback:
- I don't see a changelog fragment in this PR.
- This leverages collection level variables but I don't see where those are defined at the main README or mentioned explicitly in the variable descriptions in this role.
3952e44 to
9d63988
Compare
5e2c52c to
6e967ef
Compare
tech2734
left a comment
There was a problem hiding this comment.
Tested on homelab environment (Forklift 2.8.7 / OCP 4.14)
Ran both retrieval methods against the homelab MTV cluster with secure_logging: false to verify output.
api method
- Route discovery worked — found
forklift-inventoryinopenshift-mtvnamespace - Constructed URL:
https://forklift-inventory-openshift-mtv.apps.homelab-ocp.local.jmb - HTTP GET
/providersreturned200with full provider inventory
exec method
- EndpointSlice lookup found the correct pod (
forklift-controller-7599bf6845-bqkwf) kubectl execcurl returned identical JSON to theapimethod
Results (both methods identical)
| Type | Provider Name |
|---|---|
| openshift | host |
| vsphere | vmware-target-1 |
Variable cascade
The defaults correctly resolve from generic inventory variables (openshift_host, openshift_temporary_api_key) — no extra role-specific vars needed in inventory.
Summary
- Argument spec validation: ✅
apiretrieval method: ✅execretrieval method: ✅- Result consistency across methods: ✅
- Play recap:
ok=18 changed=0 unreachable=0 failed=0 skipped=3 rescued=0 ignored=0
LGTM
Signed-off-by: Andrew Block <andy.block@gmail.com>
6e967ef to
568c9ba
Compare
|
Hey, I ran into an issue while integrating The endpoint path validation regex in mtv_query_inventory_endpoint_path is ansible.builtin.match('^/[a-zA-Z0-9_\\-/]*$')rejects query parameters. The MTV inventory API requires The regex also doesn't allow Suggested fix — expand the regex to cover query parameters and dots: mtv_query_inventory_endpoint_path is ansible.builtin.match('^/[a-zA-Z0-9_.\\-/]+(\\?[a-zA-Z0-9_.=&\\-]*)?$')I worked around it locally for testing by patching the regex, and all 5 queries completed successfully against my homelab (Forklift 2.8.7). |
Description
New reusable role for querying MTV inventory
Type of Change
How to invoke
The invocation will query the
/providers endpoint on the MTV inventory service and return the result in a variable called_mtv_providers`