Skip to content

Commit a46973f

Browse files
committed
MGMT-15591 fix vCenter cluster being empty
1 parent e8aa70c commit a46973f

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

frontend/packages/vsphere-plugin/src/hooks/use-connection-form.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { K8sModel, k8sGet } from '@console/dynamic-plugin-sdk/src/api/core-api';
33
import { useConnectionFormContext } from '../components/ConnectionFormContext';
44
import { ConnectionFormContextSetters } from '../components/types';
55
import { decodeBase64, parseKeyValue } from '../components/utils';
6-
import { FAILURE_DOMAIN_NAME } from '../constants';
76
import { ConfigMap, Infrastructure, Secret } from '../resources';
87
import { useConnectionModels } from './use-connection-models';
98

@@ -64,9 +63,10 @@ export const initialLoad = async (
6463
});
6564

6665
const domain = infrastructure?.spec?.platformSpec?.vsphere?.failureDomains?.find(
67-
(d) => d.name === FAILURE_DOMAIN_NAME,
66+
(d) => d.server === server,
6867
);
69-
vCenterCluster = domain?.topology?.networks?.[0] || '';
68+
const computeCluster = domain?.topology?.computeCluster?.split('/');
69+
vCenterCluster = (computeCluster?.length && computeCluster[computeCluster.length - 1]) || '';
7070
} catch (e) {
7171
// eslint-disable-next-line no-console
7272
console.error('Failed to fetch infrastructure resource', e);

0 commit comments

Comments
 (0)