Skip to content

Commit 31a6b42

Browse files
pranavsriram8l-technicore
authored andcommitted
Fix bug in wrapper returning response for NSG rules
1 parent 2edd9b8 commit 31a6b42

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

pkg/cloudprovider/providers/oci/load_balancer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1994,7 +1994,7 @@ func (cp *CloudProvider) checkAllBackendNodesNotReady(nodeList []*v1.Node) bool
19941994
func (cp *CloudProvider) deleteNsg(ctx context.Context, logger *zap.SugaredLogger, id, etag string) (bool, error) {
19951995
opcRequestId, err := cp.client.Networking(nil).DeleteNetworkSecurityGroup(ctx, id, etag)
19961996
if err != nil {
1997-
logger.Errorf("failed to delete nsg %s OpcRequestId %s", id, pointer.StringDeref(opcRequestId, ""))
1997+
logger.Errorf("failed to delete nsg %s", id)
19981998
return false, err
19991999
}
20002000
logger.Infof("delete nsg OpcRequestId %s", pointer.StringDeref(opcRequestId, ""))

pkg/cloudprovider/providers/oci/load_balancer_network_security_group.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ func (s *CloudProvider) addNetworkSecurityGroupSecurityRules(ctx context.Context
242242
*nsgId,
243243
core.AddNetworkSecurityGroupSecurityRulesDetails{SecurityRules: securityRuleToAddSecurityRuleDetails(rulesInBatches[i])})
244244
if err != nil {
245-
return nil, errors.Wrapf(err, "failed to add security rules for nsg: %s OpcRequestId: %s", *nsgId, pointer.StringDeref(response.OpcRequestId, ""))
245+
return nil, errors.Wrapf(err, "failed to add security rules for nsg: %s", *nsgId)
246246
}
247247
s.logger.Infof("AddNetworkSecurityGroupSecurityRules OpcRequestId %s", pointer.StringDeref(response.OpcRequestId, ""))
248248
}
@@ -258,7 +258,7 @@ func (s *CloudProvider) removeNetworkSecurityGroupSecurityRules(ctx context.Cont
258258
response, err = s.client.Networking(nil).RemoveNetworkSecurityGroupSecurityRules(ctx, *nsgId,
259259
core.RemoveNetworkSecurityGroupSecurityRulesDetails{SecurityRuleIds: rulesInBatches[i]})
260260
if err != nil {
261-
return nil, errors.Wrapf(err, "failed to remove security rules for nsg: %s OpcRequestId: %s", *nsgId, pointer.StringDeref(response.OpcRequestId, ""))
261+
return nil, errors.Wrapf(err, "failed to remove security rules for nsg: %s", *nsgId)
262262
}
263263
s.logger.Infof("RemoveNetworkSecurityGroupSecurityRules OpcRequestId %s", pointer.StringDeref(response.OpcRequestId, ""))
264264
}

pkg/oci/client/networking.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ func (c *client) AddNetworkSecurityGroupSecurityRules(ctx context.Context, id st
478478

479479
if err != nil {
480480
c.logger.With(id).Infof("AddNetworkSecurityGroupSecurityRules failed %s", pointer.StringDeref(resp.OpcRequestId, ""))
481-
return nil, errors.WithStack(err)
481+
return &resp, errors.WithStack(err)
482482
}
483483
return &resp, nil
484484
}
@@ -497,7 +497,7 @@ func (c *client) RemoveNetworkSecurityGroupSecurityRules(ctx context.Context, id
497497

498498
if err != nil {
499499
c.logger.With(id).Infof("RemoveNetworkSecurityGroupSecurityRules failed %s", pointer.StringDeref(resp.OpcRequestId, ""))
500-
return nil, errors.WithStack(err)
500+
return &resp, errors.WithStack(err)
501501
}
502502
return &resp, nil
503503
}
@@ -519,7 +519,7 @@ func (c *client) ListNetworkSecurityGroupSecurityRules(ctx context.Context, id s
519519

520520
if err != nil {
521521
c.logger.With(id).Infof("ListNetworkSecurityGroupSecurityRules failed %s", pointer.StringDeref(resp.OpcRequestId, ""))
522-
return nil, errors.WithStack(err)
522+
return []core.SecurityRule{}, errors.WithStack(err)
523523
}
524524
for _, rule := range resp.Items {
525525
nsgRules = append(nsgRules, rule)
@@ -545,7 +545,7 @@ func (c *client) UpdateNetworkSecurityGroupSecurityRules(ctx context.Context, id
545545

546546
if err != nil {
547547
c.logger.With(id).Infof("UpdateNetworkSecurityGroupSecurityRules failed %s", pointer.StringDeref(resp.OpcRequestId, ""))
548-
return nil, errors.WithStack(err)
548+
return &resp, errors.WithStack(err)
549549
}
550550
return &resp, nil
551551
}

0 commit comments

Comments
 (0)