Skip to content

Commit

Permalink
Error string should not be capitalized
Browse files Browse the repository at this point in the history
  • Loading branch information
ChunyiLyu committed Mar 19, 2021
1 parent ca2e189 commit c6fc284
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions controllers/user_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,15 @@ func (r *UserReconciler) importCredentials(ctx context.Context, secretName, secr
var credentialsSecret corev1.Secret
err := r.Client.Get(ctx, types.NamespacedName{Name: secretName, Namespace: secretNamespace}, &credentialsSecret)
if err != nil {
return "", "", fmt.Errorf("Could not find password secret %s in namespace %s; Err: %w", secretName, secretNamespace, err)
return "", "", fmt.Errorf("could not find password secret %s in namespace %s; Err: %w", secretName, secretNamespace, err)
}
username, ok := credentialsSecret.Data["username"]
if !ok {
return "", "", fmt.Errorf("Could not find username key in credentials secret: %s", credentialsSecret.Name)
return "", "", fmt.Errorf("could not find username key in credentials secret: %s", credentialsSecret.Name)
}
password, ok := credentialsSecret.Data["password"]
if !ok {
return "", "", fmt.Errorf("Could not find password key in credentials secret: %s", credentialsSecret.Name)
return "", "", fmt.Errorf("could not find password key in credentials secret: %s", credentialsSecret.Name)
}

logger.Info("Retrieved credentials from Secret", "secretName", secretName, "retrievedUsername", string(username))
Expand Down Expand Up @@ -288,7 +288,7 @@ func (r *UserReconciler) addFinalizerIfNeeded(ctx context.Context, user *topolog
func (r *UserReconciler) getUserCredentials(ctx context.Context, user *topologyv1alpha1.User) (*corev1.Secret, error) {
logger := ctrl.LoggerFrom(ctx)
if user.Status.Credentials == nil {
return nil, fmt.Errorf("This User does not yet have a Credentials Secret created")
return nil, fmt.Errorf("this User does not yet have a Credentials Secret created")
}

credentials := &corev1.Secret{}
Expand Down
2 changes: 1 addition & 1 deletion controllers/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func managementPort(svc *corev1.Service) (int, error) {
func rabbitmqClusterFromReference(ctx context.Context, c client.Client, rmq v1alpha1.RabbitmqClusterReference) (*rabbitmqv1beta1.RabbitmqCluster, error) {
cluster := &rabbitmqv1beta1.RabbitmqCluster{}
if err := c.Get(ctx, types.NamespacedName{Name: rmq.Name, Namespace: rmq.Namespace}, cluster); err != nil {
return nil, fmt.Errorf("Failed to get cluster from reference: %s Error: %w", err, NoSuchRabbitmqClusterError)
return nil, fmt.Errorf("failed to get cluster from reference: %s Error: %w", err, NoSuchRabbitmqClusterError)
}
return cluster, nil
}
Expand Down
4 changes: 2 additions & 2 deletions internal/user_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import (
func GenerateUserSettings(credentials *corev1.Secret, tags []topologyv1alpha1.UserTag) (rabbithole.UserSettings, error) {
username, ok := credentials.Data["username"]
if !ok {
return rabbithole.UserSettings{}, fmt.Errorf("Could not find username in credentials secret %s", credentials.Name)
return rabbithole.UserSettings{}, fmt.Errorf("could not find username in credentials secret %s", credentials.Name)
}
password, ok := credentials.Data["password"]
if !ok {
return rabbithole.UserSettings{}, fmt.Errorf("Could not find password in credentials secret %s", credentials.Name)
return rabbithole.UserSettings{}, fmt.Errorf("could not find password in credentials secret %s", credentials.Name)
}

var userTagStrings []string
Expand Down

0 comments on commit c6fc284

Please sign in to comment.