Skip to content

Commit

Permalink
Revert a temporary test fix for the router cmd
Browse files Browse the repository at this point in the history
Also clarify related ignoreError comments.

Signed-off-by: Matt Rogers <[email protected]>
  • Loading branch information
Matt Rogers committed Aug 22, 2017
1 parent a9a401c commit 5636a0c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions pkg/oc/admin/router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ func RunCmdRouter(f *clientcmd.Factory, cmd *cobra.Command, out, errout io.Write
}

levelPrefixFilter := func(e error) string {
// ignore SA/RB errors if we were creating the service account
// Avoid failing when service accounts or role bindings already exist.
if ignoreError(e, cfg.ServiceAccount, generateRoleBindingName(cfg.Name)) {
return "warning"
}
Expand All @@ -849,8 +849,8 @@ func RunCmdRouter(f *clientcmd.Factory, cmd *cobra.Command, out, errout io.Write
}

// ignoreError will return true if the error is an already exists status error and
// 1. it is for a cluster role binding named roleBindingName
// 2. it is for a serivce account name saName
// 1. it is for a cluster role binding named roleBindingName, or
// 2. it is for a service account name saName
func ignoreError(e error, saName string, roleBindingName string) bool {
if !errors.IsAlreadyExists(e) {
return false
Expand All @@ -864,8 +864,7 @@ func ignoreError(e error, saName string, roleBindingName string) bool {
return false
}
return (details.Kind == "serviceaccounts" && details.Name == saName) ||
(details.Kind == "clusterrolebinding" && details.Name == roleBindingName) ||
(details.Kind == "clusterrolebindings" && details.Name == roleBindingName) // TODO we should not need to do this
(details.Kind == "clusterrolebinding" && details.Name == roleBindingName)
}

// generateRoleBindingName generates a name for the rolebinding object if it is
Expand Down

0 comments on commit 5636a0c

Please sign in to comment.