Skip to content

Commit

Permalink
Refactor 1
Browse files Browse the repository at this point in the history
  • Loading branch information
bartam1 committed Aug 2, 2022
1 parent 1fc54b7 commit 3fb43bc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions controllers/kafkauser_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,9 @@ func (r *KafkaUserReconciler) Reconcile(ctx context.Context, request reconcile.R
return requeueWithError(reqLogger, "failed to reconcile user secret", err)
}
}
kafkaUser, err = user.DN()
kafkaUser, err = user.GetDistinguishedName()
if err != nil {
reqLogger.Error(err, "could not get Distinguished Name from the generated TLS certificate")
reqLogger.Error(err, "could not get Distinguished Name from the generated TLS certificate", "cert", string(user.Certificate))
return ctrl.Result{
Requeue: false,
}, err
Expand Down
4 changes: 2 additions & 2 deletions pkg/util/pki/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ type UserCertificate struct {
Password []byte
}

// DN returns the Distinguished Name of a TLS certificate
func (u *UserCertificate) DN() (string, error) {
// GetDistinguishedName returns the Distinguished Name of a TLS certificate
func (u *UserCertificate) GetDistinguishedName() (string, error) {
// cert has already been validated so we can assume no error
cert, err := certutil.DecodeCertificate(u.Certificate)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/pki/pki_common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestDN(t *testing.T) {
userCert := &UserCertificate{
Certificate: cert,
}
dn, err := userCert.DN()
dn, err := userCert.GetDistinguishedName()
if err != nil {
t.Errorf("error should be nil, got: %s", err)
}
Expand Down

0 comments on commit 3fb43bc

Please sign in to comment.