tests, Fix CDIInsecureRegistryConfig logic
In case CDI insecure registries wasnt found,
the Get command still returns a non nil ptr.
The logic would then panic when it wont find
this config map on UpdateCDIConfigMap.
It also fixes SRIOV lane where no CDI and no
CDI insecure registries exists.
@@ -805,10 +805,15 @@ func AdjustKubeVirtResource() {
PanicOnError(err)
KubeVirtDefaultConfig = adjustedKV.Spec.Configuration
CDIInsecureRegistryConfig, err = virtClient.CoreV1().ConfigMaps(flags.ContainerizedDataImporterNamespace).Get(insecureRegistryConfigName, metav1.GetOptions{})
- if err != nil && !errors.IsNotFound(err) {
+ if err != nil {
+ if errors.IsNotFound(err) {
+ // force it to nil, independent of what the client returned
+ CDIInsecureRegistryConfig = nil
+ } else {
PanicOnError(err)
}
}
+}
func RestoreKubeVirtResource() {
if originalKV != nil {
