Skip to content

Commit

Permalink
check for error first
Browse files Browse the repository at this point in the history
Signed-off-by: Jesse Nelson <jesse@swirldslabs.com>
  • Loading branch information
jnels124 committed Nov 2, 2023
1 parent 54c47b2 commit 153a256
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/mgmt/zfsnode/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ func Start(controllerMtx *sync.RWMutex, stopCh <-chan struct{}) error {
k8sNodeCandidate, err := kubeClient.CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{
LabelSelector: topologySelector,
})
if k8sNodeCandidate == nil || len(k8sNodeCandidate.Items) != 1 {
return fmt.Errorf("unable to retrieve a single node by %s for %s", zfs.ZFSTopologyKey, zfs.NodeID)
}
if err != nil {
return errors.Wrapf(err, "error trying to find node with label %s having value %s", zfs.ZFSTopologyKey, zfs.NodeID)
}
if k8sNodeCandidate == nil || len(k8sNodeCandidate.Items) != 1 {
return fmt.Errorf("unable to retrieve a single node by %s for %s", zfs.ZFSTopologyKey, zfs.NodeID)
}
k8sNode = k8sNodeCandidate.Items[0]
}

Expand Down

0 comments on commit 153a256

Please sign in to comment.