// securityGroups = openstackComputeClient.root().servers().server(server.getId()).listSecurityGroups();
// } catch (OpenstackException e) {
// throw new OpsException("Error getting security groups for server", e);
// }
SecurityGroupList securityGroups;
try {
log.info("Listing security groups");
securityGroups = openstackComputeClient.root().securityGroups().list();
} catch (OpenstackException e) {
throw new OpsException("Error getting security groups for server", e);
}
SecurityGroup securityGroup = null;
if (securityGroups != null && securityGroups.getList() != null) {
for (SecurityGroup candidate : securityGroups.getList()) {
if (candidate.getName() == null) {
continue;
}
if (candidate.getName().equals(OpenstackCloudContext.SECURITY_GROUP_PREFIX + server.getName())) {