Skip to content

Commit

Permalink
Merge pull request openshift#783 from zvikorn/sda-6170a
Browse files Browse the repository at this point in the history
removing htpasswd idp even if there are no users in this idp
  • Loading branch information
openshift-ci[bot] authored Jul 11, 2022
2 parents 8fd25d0 + f9f80ad commit 60f4b95
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/ocm/idps.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package ocm

import (
"fmt"
"net/http"

cmv1 "github.com/openshift-online/ocm-sdk-go/clustersmgmt/v1"
)
Expand Down Expand Up @@ -60,6 +61,9 @@ func (c *Client) GetHTPasswdUserList(clusterID, htpasswdIDPId string) (*cmv1.HTP
listResponse, err := c.ocm.ClustersMgmt().V1().Clusters().Cluster(clusterID).
IdentityProviders().IdentityProvider(htpasswdIDPId).HtpasswdUsers().List().Send()
if err != nil {
if listResponse.Error().Status() == http.StatusNotFound {
return nil, nil
}
return nil, handleErr(listResponse.Error(), err)
}
return listResponse.Items(), nil
Expand All @@ -80,6 +84,9 @@ func (c *Client) DeleteHTPasswdUser(username, clusterID string, htpasswdIDP *cmv
listResponse, err := c.ocm.ClustersMgmt().V1().Clusters().Cluster(clusterID).
IdentityProviders().IdentityProvider(htpasswdIDP.ID()).HtpasswdUsers().List().Send()
if err != nil {
if listResponse.Error().Status() == http.StatusNotFound {
return nil
}
return handleErr(listResponse.Error(), err)
}
listResponse.Items().Each(func(user *cmv1.HTPasswdUser) bool {
Expand Down

0 comments on commit 60f4b95

Please sign in to comment.