Skip to content

Commit

Permalink
Merge pull request #1883 from gdbranco/chore/revert-ocm-6883
Browse files Browse the repository at this point in the history
Revert ocm-6883
  • Loading branch information
openshift-merge-bot[bot] committed Mar 28, 2024
2 parents 0c0f1c3 + 93d752f commit d88d6b1
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 17 deletions.
6 changes: 3 additions & 3 deletions cmd/create/admin/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ const MaxPasswordLength = 23

var Cmd = &cobra.Command{
Use: "admin",
Short: "Creates the 'cluster-admin' user to login to the cluster",
Long: "Creates the 'cluster-admin' user with an auto-generated password to login to the cluster",
Example: ` # Create the 'cluster-admin' user to login to the cluster
Short: "Creates an admin user to login to the cluster",
Long: "Creates a cluster-admin user with an auto-generated password to login to the cluster",
Example: ` # Create an admin user to login to the cluster
rosa create admin -c mycluster -p MasterKey123`,
Run: run,
Args: cobra.NoArgs,
Expand Down
21 changes: 10 additions & 11 deletions cmd/describe/admin/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
cmv1 "github.com/openshift-online/ocm-sdk-go/clustersmgmt/v1"
"github.com/spf13/cobra"

"github.com/openshift/rosa/cmd/create/admin"
cadmin "github.com/openshift/rosa/cmd/create/admin"
"github.com/openshift/rosa/pkg/ocm"
"github.com/openshift/rosa/pkg/rosa"
Expand Down Expand Up @@ -56,24 +55,24 @@ func run(_ *cobra.Command, _ []string) {

if cluster.ExternalAuthConfig().Enabled() {
r.Reporter.Errorf(
"Describing the 'cluster-admin' user is not supported for clusters with external authentication configured.")
"Describing the 'cluster-admin' user is not supported for clusters with external authentication configured.",
)
os.Exit(1)
}

admins, err := r.OCMClient.GetUsers(cluster.ID(), admin.ClusterAdminGroupname)
// Try to find an existing htpasswd identity provider and
// check if cluster-admin user already exists
existingClusterAdminIdp, _, err := cadmin.FindIDPWithAdmin(cluster, r)
if err != nil {
r.Reporter.Errorf(err.Error())
os.Exit(1)
}

if len(admins) != 0 {
for _, admin := range admins {
r.Reporter.Infof("There is '%s' user on cluster '%s'. To login, run the following command:\n"+
" oc login %s --username %s",
admin.ID(), clusterKey, cluster.API().URL(), admin.ID())
}
if existingClusterAdminIdp != nil {
r.Reporter.Infof("There is '%s' user on cluster '%s'. To login, run the following command:\n"+
" oc login %s --username %s",
cadmin.ClusterAdminUsername, clusterKey, cluster.API().URL(), cadmin.ClusterAdminUsername)
} else {
r.Reporter.Warnf("There is no %s user on cluster '%s'. To create it run the following command:\n"+
r.Reporter.Warnf("There is no '%s' user on cluster '%s'. To create it run the following command:\n"+
" rosa create admin -c %s", cadmin.ClusterAdminUsername, clusterKey, clusterKey)
os.Exit(0)
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/dlt/admin/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ func (d *DeleteUserAdminFromIDP) deleteAdmin(r *rosa.Runtime, identityProvider *

var Cmd = &cobra.Command{
Use: "admin",
Short: "Deletes the 'cluster-admin' user",
Long: "Deletes the 'cluster-admin' user used to login to the cluster",
Example: ` # Delete the 'cluster-admin' user
Short: "Deletes the admin user",
Long: "Deletes the cluster-admin user used to login to the cluster",
Example: ` # Delete the admin user
rosa delete admin --cluster=mycluster`,
Run: run,
Args: cobra.NoArgs,
Expand Down
3 changes: 3 additions & 0 deletions hack/commit-msg-verify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ do
exit 0
fi
done

pattern="^(Revert \")?[A-Z]+-[0-9]+ \| (feat|fix|docs|style|refactor|test|chore|build|ci|perf): .*$"

commits=$(git rev-list --no-merges $PULL_BASE_SHA..$PULL_PULL_SHA)

for sha in $commits; do
Expand Down

0 comments on commit d88d6b1

Please sign in to comment.