Skip to content

Commit d87b745

Browse files
fix global config requirement for node-service (#2683)
Co-authored-by: pýrus <[email protected]>
1 parent 05bbdfe commit d87b745

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pkg/csi/cinder/openstack/openstack.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ func CreateOpenStackProvider(cloudName string, noClient bool) (IOpenStack, error
176176
return nil, err
177177
}
178178
logcfg(cfg)
179-
_, cloudNameDefined := cfg.Global[cloudName]
180-
if !cloudNameDefined {
179+
global := cfg.Global[cloudName]
180+
if global == nil && !noClient {
181181
return nil, fmt.Errorf("GetConfigFromFiles cloud name \"%s\" not found in configuration files: %s", cloudName, configFiles)
182182
}
183183

@@ -196,14 +196,14 @@ func CreateOpenStackProvider(cloudName string, noClient bool) (IOpenStack, error
196196
return NoopInstances[cloudName], nil
197197
}
198198

199-
provider, err := client.NewOpenStackClient(cfg.Global[cloudName], "cinder-csi-plugin", userAgentData...)
199+
provider, err := client.NewOpenStackClient(global, "cinder-csi-plugin", userAgentData...)
200200
if err != nil {
201201
return nil, err
202202
}
203203

204204
epOpts := gophercloud.EndpointOpts{
205-
Region: cfg.Global[cloudName].Region,
206-
Availability: cfg.Global[cloudName].EndpointType,
205+
Region: global.Region,
206+
Availability: global.EndpointType,
207207
}
208208

209209
// Init Nova ServiceClient

0 commit comments

Comments
 (0)