From 241c16061af7d3175cd9b01aa6ef874eab3f5056 Mon Sep 17 00:00:00 2001 From: Aviv Turgeman Date: Wed, 18 Sep 2024 14:12:05 +0300 Subject: [PATCH] CNV-48451: Windows autoattend.xml can not be created as a regular user Signed-off-by: Aviv Turgeman --- src/utils/components/SysprepModal/hooks/useConfigMaps.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/utils/components/SysprepModal/hooks/useConfigMaps.ts b/src/utils/components/SysprepModal/hooks/useConfigMaps.ts index db096b088..99c11f08d 100644 --- a/src/utils/components/SysprepModal/hooks/useConfigMaps.ts +++ b/src/utils/components/SysprepModal/hooks/useConfigMaps.ts @@ -1,5 +1,6 @@ import { ConfigMapModel, modelToGroupVersionKind } from '@kubevirt-ui/kubevirt-api/console'; import { IoK8sApiCoreV1ConfigMap } from '@kubevirt-ui/kubevirt-api/kubernetes'; +import { isEmpty } from '@kubevirt-utils/utils/utils'; import { useK8sWatchResource, WatchK8sResult } from '@openshift-console/dynamic-plugin-sdk'; import { AUTOUNATTEND, UNATTEND } from '../sysprep-utils'; @@ -16,7 +17,10 @@ const useSysprepConfigMaps = (namespace: string): WatchK8sResult { + if (isEmpty(configmap?.data)) return false; + const dataKeys = Object.keys(configmap?.data); const hasSysprepXMLData = dataKeys.some((key) => { return (