Fixed scope of confStore

Signed-off-by: ShyamsundarR <srangana@redhat.com>
This commit is contained in:
ShyamsundarR 2019-03-11 08:36:33 -04:00 committed by mergify[bot]
parent c9c1c871fc
commit e1c685ef39
2 changed files with 7 additions and 7 deletions

View File

@ -47,8 +47,8 @@ type Driver struct {
var ( var (
version = "1.0.0" version = "1.0.0"
// ConfStore is the global config store // confStore is the global config store
ConfStore *util.ConfigStore confStore *util.ConfigStore
) )
// NewDriver returns new rbd driver // NewDriver returns new rbd driver
@ -94,7 +94,7 @@ func (r *Driver) Run(driverName, nodeID, endpoint string, containerized bool, co
klog.Infof("Driver: %v version: %v", driverName, version) klog.Infof("Driver: %v version: %v", driverName, version)
// Initialize config store // Initialize config store
ConfStore, err = util.NewConfigStore(configroot) confStore, err = util.NewConfigStore(configroot)
if err != nil { if err != nil {
klog.Fatalln("Failed to initialize config store.") klog.Fatalln("Failed to initialize config store.")
} }

View File

@ -94,7 +94,7 @@ func getRBDKey(fsid string, id string, credentials map[string]string) (string, e
if key, ok = credentials[id]; !ok { if key, ok = credentials[id]; !ok {
if fsid != "" { if fsid != "" {
key, err = ConfStore.CredentialForUser(fsid, id) key, err = confStore.CredentialForUser(fsid, id)
if err != nil { if err != nil {
klog.Errorf("failed getting credentials (%s)", err) klog.Errorf("failed getting credentials (%s)", err)
return "", fmt.Errorf("RBD key for ID: %s not found in config store", id) return "", fmt.Errorf("RBD key for ID: %s not found in config store", id)
@ -254,7 +254,7 @@ func getMonsAndFsID(options map[string]string) (monitors, fsID, monInSecret stri
return return
} }
if monitors, err = ConfStore.Mons(fsID); err != nil { if monitors, err = confStore.Mons(fsID); err != nil {
klog.Errorf("failed getting mons (%s)", err) klog.Errorf("failed getting mons (%s)", err)
err = fmt.Errorf("failed to fetch monitor list using clusterID (%s)", fsID) err = fmt.Errorf("failed to fetch monitor list using clusterID (%s)", fsID)
return return
@ -272,7 +272,7 @@ func getIDs(options map[string]string, fsID string) (adminID, userID string, err
switch { switch {
case ok: case ok:
case fsID != "": case fsID != "":
if adminID, err = ConfStore.AdminID(fsID); err != nil { if adminID, err = confStore.AdminID(fsID); err != nil {
klog.Errorf("failed getting subject (%s)", err) klog.Errorf("failed getting subject (%s)", err)
return "", "", fmt.Errorf("failed to fetch provisioner ID using clusterID (%s)", fsID) return "", "", fmt.Errorf("failed to fetch provisioner ID using clusterID (%s)", fsID)
} }
@ -284,7 +284,7 @@ func getIDs(options map[string]string, fsID string) (adminID, userID string, err
switch { switch {
case ok: case ok:
case fsID != "": case fsID != "":
if userID, err = ConfStore.UserID(fsID); err != nil { if userID, err = confStore.UserID(fsID); err != nil {
klog.Errorf("failed getting subject (%s)", err) klog.Errorf("failed getting subject (%s)", err)
return "", "", fmt.Errorf("failed to fetch publisher ID using clusterID (%s)", fsID) return "", "", fmt.Errorf("failed to fetch publisher ID using clusterID (%s)", fsID)
} }