Skip to content

Commit

Permalink
Open SSH port (#44)
Browse files Browse the repository at this point in the history
* Add functionality to open ports in OpenStack IA

* Open SSh port as default
  • Loading branch information
wederbn authored Nov 18, 2023
1 parent 7c8a9b3 commit 5af79e6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Git LFS file not shown
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,13 @@ public void createVM(@RequestPayload CreateVMRequest request, MessageContext mes
logger.info("Created new security group with name: {}", securityGroup);

// open ports within security group
String[] ports = request.getVMOpenPorts().split(",");
logger.info("Opening {} ports...", ports.length);
for (String port :ports){
List<String> ports = Arrays.asList(request.getVMOpenPorts().split(","));
if (ports.contains("22")){
// add SSH port if not defined
ports.add("22");
}
logger.info("Opening {} ports...", ports.size());
for (String port : ports){
logger.info("Opening port: {}", port);
osClient.compute().securityGroups()
.createRule(Builders.secGroupRule()
Expand Down

0 comments on commit 5af79e6

Please sign in to comment.