cleanup: fix golint warnings in util, e2e

util: golint warns about exported methods to have a
comment or to unexport them.

e2e: golint warns about package comment to be of the form
"Package e2e ..."

Reported-by: https://goreportcard.com/report/github.com/ceph/ceph-csi

Updates: #975

Signed-off-by: Yug Gupta <ygupta@redhat.com>
This commit is contained in:
Yug Gupta
2020-05-20 12:51:01 +05:30
committed by mergify[bot]
parent 979f2b36ed
commit 753f6b7fec
4 changed files with 10 additions and 1 deletions

View File

@ -33,6 +33,7 @@ const (
tmpKeyFileNamePrefix = "keyfile-"
)
// Credentials struct represents credentials to access the ceph cluster.
type Credentials struct {
ID string
KeyFile string
@ -93,19 +94,23 @@ func newCredentialsFromSecret(idField, keyField string, secrets map[string]strin
return c, err
}
// DeleteCredentials removes the KeyFile.
func (cr *Credentials) DeleteCredentials() {
// don't complain about unhandled error
_ = os.Remove(cr.KeyFile)
}
// NewUserCredentials creates new user credentials from secret.
func NewUserCredentials(secrets map[string]string) (*Credentials, error) {
return newCredentialsFromSecret(credUserID, credUserKey, secrets)
}
// NewAdminCredentials creates new admin credentials from secret.
func NewAdminCredentials(secrets map[string]string) (*Credentials, error) {
return newCredentialsFromSecret(credAdminID, credAdminKey, secrets)
}
// NewCredentials generates new credentials when id and key are provided.
func NewCredentials(id, key string) (*Credentials, error) {
var c = &Credentials{}
@ -118,6 +123,7 @@ func NewCredentials(id, key string) (*Credentials, error) {
return c, err
}
// GetMonValFromSecret returns monitors from secret.
func GetMonValFromSecret(secrets map[string]string) (string, error) {
if mons, ok := secrets[credMonitors]; ok {
return mons, nil