Skip to content

Commit

Permalink
handle error when listing resources on restore (#962)
Browse files Browse the repository at this point in the history
* handle error when listing resources on restore
  • Loading branch information
sgalsaleh committed Aug 18, 2020
1 parent c681a92 commit 60641da
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion kotsadm/operator/pkg/client/deploy.go
Expand Up @@ -361,7 +361,13 @@ func (c *Client) clearNamespace(slug string, namespace string) (bool, error) {
continue
}
// there may be other resources that can't be listed besides what's in the skip set so ignore error
unstructuredList, _ := dyn.Resource(gvr).Namespace(namespace).List(context.TODO(), metav1.ListOptions{})
unstructuredList, err := dyn.Resource(gvr).Namespace(namespace).List(context.TODO(), metav1.ListOptions{})
if unstructuredList == nil {
if err != nil {
log.Printf("failed to list namespace resources: %s", err.Error())
}
continue
}
for _, u := range unstructuredList.Items {
annotations := u.GetAnnotations()
if annotations["kots.io/app-slug"] == slug {
Expand Down

0 comments on commit 60641da

Please sign in to comment.