From 7f925aa8e5e9036037a6208da4feedcd84498a1f Mon Sep 17 00:00:00 2001 From: mpuckett Date: Thu, 25 Jun 2026 13:48:07 -0500 Subject: [PATCH] Initial --- README.md | 5 +- client/src/App.vue | 6 ++ .../components/hosts/VCenterTraceModal.vue | 10 +- client/src/style.css | 4 + server/config.js | 1 + server/services/vcenterService.js | 92 +++++++++++++++++-- server/settingsRegistry.js | 1 + server/test/vcenter.test.mjs | 18 ++++ 8 files changed, 128 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 2a5f6b4..07a74f2 100644 --- a/README.md +++ b/README.md @@ -162,6 +162,7 @@ Important environment variables: | `VCENTER_BASE_URL` | vCenter REST API root, for example `https://vcenter.contoso.local`. | | `VCENTER_USERNAME` | vCenter account used by the backend to create API sessions. | | `VCENTER_PASSWORD` | vCenter password. Prefer environment pinning for production deployments. | +| `VCENTER_API_MODE` | `auto`, `api`, or `rest`. Defaults to `auto`, which tries modern `/api` then legacy `/rest` on incompatible endpoints. | | `VCENTER_ALLOW_UNTRUSTED_TLS` | Set `true` to allow self-signed/private CA vCenter certificates. | | `CATALOG_CHECK_INTERVAL_MINUTES` | Minutes between catalog upstream-version checks. `0` disables. | | `AUTO_PROMOTE_INTERVAL_MINUTES` | Minutes between auto-promote soak checks. `0` disables. | @@ -531,7 +532,9 @@ Payload: `personal`, `shared`, or `group`; hosts default to `shared`. RunPlans can only target hosts visible to the operator who creates or edits them. -VMware vCenter import uses the effective Config / Integrations values (`vcenter_*` settings or the `VCENTER_*` environment variables). The backend creates a vCenter REST session with `POST /api/session`, lists VMs from `/api/vcenter/vm`, and then best-effort enriches each candidate from guest identity/networking endpoints. FQDN and IP discovery depends on VMware Tools data; when guest data is unavailable, the import falls back to the VM name as the host address and records the limitation in host notes. +VMware vCenter import uses the effective Config / Integrations values (`vcenter_*` settings or the `VCENTER_*` environment variables). `vcenter_api_mode` can be `auto`, `api`, or `rest`. `api` uses the current vSphere Automation API flow (`POST /api/session`, `GET /api/vcenter/vm`). `rest` uses the legacy/community vCenter REST flow (`POST /rest/com/vmware/cis/session`, `GET /rest/vcenter/vm`). `auto` tries the current `/api` profile first and falls back to `/rest` when the endpoint is not supported. + +For exact VM-name searches (`field: "name"`, `operator: "equals"`), POSHManager uses the documented server-side name filters: `names=` for `/api/vcenter/vm` and `filter.names=` for `/rest/vcenter/vm`. Contains/starts-with/ends-with searches are filtered locally because vCenter VM list filters do not provide wildcard contains semantics. FQDN and IP discovery depends on VMware Tools data; when guest data is unavailable, the import falls back to the VM name as the host address and records the limitation in host notes. For `field: "name"` filters, the API scans the full VM summary list returned by vCenter before guest enrichment, so large inventories are not accidentally missed by the preview limit. The preview response includes `diagnostics` with `totalFromVCenter`, `summaryMatched`, `scanned`, `resultLimit`, and `sampleNames`; the wizard displays those values when troubleshooting a no-result preview. diff --git a/client/src/App.vue b/client/src/App.vue index fd88f18..712b802 100644 --- a/client/src/App.vue +++ b/client/src/App.vue @@ -1136,6 +1136,12 @@ const settingMetadata = { section: 'Integrations', secret: true }, + vcenter_api_mode: { + label: 'vCenter API Mode', + description: 'Use auto for modern /api with fallback to legacy /rest. Set api or rest to force one contract.', + placeholder: 'auto', + section: 'Integrations' + }, vcenter_allow_untrusted_tls: { label: 'Allow Untrusted vCenter TLS', description: 'Permit self-signed or private CA vCenter certificates for lab and internal deployments.', diff --git a/client/src/components/hosts/VCenterTraceModal.vue b/client/src/components/hosts/VCenterTraceModal.vue index ad88b5f..fee9cbf 100644 --- a/client/src/components/hosts/VCenterTraceModal.vue +++ b/client/src/components/hosts/VCenterTraceModal.vue @@ -30,6 +30,14 @@

{{ entry.message }}

+