@@ -195,7 +195,10 @@ func (d *Driver) updateSubnetServiceEndpoints(ctx context.Context) error {
195
195
vnetName := d .cloud .VnetName
196
196
subnetName := d .cloud .SubnetName
197
197
198
- klog .V (2 ).Infof ("updateSubnetServiceEndpoints on VnetName: %s, SubnetName: %s" , vnetName , subnetName )
198
+ klog .V (2 ).Infof ("updateSubnetServiceEndpoints on vnetName: %s, subnetName: %s, location: %s" , vnetName , subnetName , location )
199
+ if subnetName == "" || vnetName == "" || location == "" {
200
+ return fmt .Errorf ("value of subnetName, vnetName or location is empty" )
201
+ }
199
202
200
203
lockKey := resourceGroup + vnetName + subnetName
201
204
d .subnetLockMap .LockEntry (lockKey )
@@ -230,8 +233,7 @@ func (d *Driver) updateSubnetServiceEndpoints(ctx context.Context) error {
230
233
serviceEndpoints = append (serviceEndpoints , storageServiceEndpoint )
231
234
subnet .SubnetPropertiesFormat .ServiceEndpoints = & serviceEndpoints
232
235
233
- err = d .cloud .SubnetsClient .CreateOrUpdate (context .Background (), resourceGroup , vnetName , subnetName , subnet )
234
- if err != nil {
236
+ if err := d .cloud .SubnetsClient .CreateOrUpdate (ctx , resourceGroup , vnetName , subnetName , subnet ); err != nil {
235
237
return fmt .Errorf ("failed to update the subnet %s under vnet %s: %v" , subnetName , vnetName , err )
236
238
}
237
239
klog .V (2 ).Infof ("serviceEndpoint(%s) is appended in subnet(%s)" , storageService , subnetName )
0 commit comments