mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
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:
@ -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
|
||||
|
Reference in New Issue
Block a user