From 06f95dd93d161519089fef85b273530bb276a83b Mon Sep 17 00:00:00 2001 From: Marcin Franczyk Date: Wed, 7 Oct 2020 15:57:46 +0200 Subject: [PATCH] fix errs check condition for spec and secrets validator Signed-off-by: Marcin Franczyk --- pkg/kubevirt/machine_server_util.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/kubevirt/machine_server_util.go b/pkg/kubevirt/machine_server_util.go index b40772a..f259883 100644 --- a/pkg/kubevirt/machine_server_util.go +++ b/pkg/kubevirt/machine_server_util.go @@ -30,13 +30,13 @@ func decodeProviderSpecAndSecret(machineClass *v1alpha1.MachineClass, secret *co return nil, status.Error(codes.Internal, wrapped.Error()) } - if errs := validation.ValidateKubevirtProviderSpec(providerSpec); errs != nil { + if errs := validation.ValidateKubevirtProviderSpec(providerSpec); len(errs) > 0 { err = fmt.Errorf("could not validate provider spec: %v", errs) klog.V(2).Infof(err.Error()) return nil, status.Error(codes.Internal, err.Error()) } - if errs := validation.ValidateKubevirtProviderSecrets(secret); errs != nil { + if errs := validation.ValidateKubevirtProviderSecrets(secret); len(errs) > 0 { err = fmt.Errorf("could not validate provider secrets: %v", errs) klog.V(2).Infof(err.Error()) return nil, status.Error(codes.Internal, err.Error())