@@ -155,6 +155,7 @@ func (c *client) CreateIsolatedNetwork(fd *infrav1.CloudStackFailureDomain, isoN
155155// OpenFirewallRules opens a CloudStack egress firewall for an isolated network.
156156func (c * client ) OpenFirewallRules (isoNet * infrav1.CloudStackIsolatedNetwork ) (retErr error ) {
157157 // Early return if VPC is present
158+ // Firewall rules are not opened for isolated networks within a VPC because VPCs have their own mechanisms for managing firewall rules.
158159 if isoNet .Spec .VPC != nil && isoNet .Spec .VPC .ID != "" {
159160 return nil
160161 }
@@ -283,12 +284,19 @@ func (c *client) createFirewallRule(isoNet *infrav1.CloudStackIsolatedNetwork, p
283284 return nil
284285}
285286
287+ // Named constants for ignorable error substrings
288+ const (
289+ ErrAlreadyExists = "there is already"
290+ ErrRuleConflict = "conflicts with rule"
291+ ErrNewRuleConflict = "new rule conflicts with existing rule"
292+ )
293+
286294// Helper function to check if an error is ignorable
287295func (c * client ) isIgnorableError (err error ) bool {
288296 errorMsg := strings .ToLower (err .Error ())
289- return strings .Contains (errorMsg , "there is already" ) ||
290- strings .Contains (errorMsg , "conflicts with rule" ) ||
291- strings .Contains (errorMsg , "new rule conflicts with existing rule" )
297+ return strings .Contains (errorMsg , ErrAlreadyExists ) ||
298+ strings .Contains (errorMsg , ErrRuleConflict ) ||
299+ strings .Contains (errorMsg , ErrNewRuleConflict )
292300}
293301
294302// GetPublicIP gets a public IP with ID for cluster endpoint.
0 commit comments