Skip to content

Commit

Permalink
Merge branch 'main' into updatek8s
Browse files Browse the repository at this point in the history
  • Loading branch information
outscale-hmi authored Sep 11, 2024
2 parents d283c9c + 42e6213 commit 93fea5e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cloud/services/security/securitygroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ func (s *Service) CreateSecurityGroupRule(securityGroupId string, flow string, i
securityGroupRuleResponse, httpRes, err = oscApiClient.SecurityGroupRuleApi.CreateSecurityGroupRule(oscAuthClient).CreateSecurityGroupRuleRequest(createSecurityGroupRuleRequest).Execute()
if err != nil {
if httpRes != nil {
if httpRes.StatusCode == 409 {
return true, nil
}
return false, fmt.Errorf("error %w httpRes %s", err, httpRes.Status)
}
requestStr := fmt.Sprintf("%v", createSecurityGroupRuleRequest)
Expand All @@ -177,7 +180,10 @@ func (s *Service) CreateSecurityGroupRule(securityGroupId string, flow string, i
}
securityGroupRule, ok := securityGroupRuleResponse.GetSecurityGroupOk()
if !ok {
return nil, errors.New("Can not get securityGroup")
// if CreateSecurityGroupRule return 409, the response not contain the conflicted SecurityGroup.
// workarround to a Outscale API issue
return s.GetSecurityGroup(securityGroupId)

}
return securityGroupRule, nil
}
Expand Down

0 comments on commit 93fea5e

Please sign in to comment.