Skip to content

Commit 03b6160

Browse files
committed
Make DisablePortSecurity compatible with platforms not using the port security extension
1 parent 78939ac commit 03b6160

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

pkg/cloud/services/networking/network.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,19 @@ func (s *Service) ReconcileNetwork(clusterName string, openStackCluster *infrav1
5858
}
5959

6060
var portSecurityEnabled gophercloud.EnabledState
61+
var opts createOpts
6162
if openStackCluster.Spec.DisablePortSecurity {
6263
portSecurityEnabled = gophercloud.Disabled
64+
opts = createOpts{
65+
AdminStateUp: gophercloud.Enabled,
66+
Name: networkName,
67+
PortSecurityEnabled: portSecurityEnabled,
68+
}
6369
} else {
64-
portSecurityEnabled = gophercloud.Enabled
65-
}
66-
opts := createOpts{
67-
AdminStateUp: gophercloud.Enabled,
68-
Name: networkName,
69-
PortSecurityEnabled: portSecurityEnabled,
70+
opts = createOpts{
71+
AdminStateUp: gophercloud.Enabled,
72+
Name: networkName,
73+
}
7074
}
7175
network, err := networks.Create(s.client, opts).Extract()
7276
if err != nil {

0 commit comments

Comments
 (0)