jclouds-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrea Turli <notificati...@github.com>
Subject Re: [jclouds-labs] [JCLOUDS-500] Initial commit for docker (#57)
Date Fri, 21 Mar 2014 17:20:50 GMT
> +   }
> +
> +   private int getLoginPort(Container container) {
> +      if (container.getNetworkSettings() != null) {
> +          Map<String, List<Map<String,String>>> ports = container.getNetworkSettings().getPorts();
> +          if(ports != null) {
> +            return Integer.parseInt(getOnlyElement(ports.get("22/tcp")).get("HostPort"));
> +          }
> +      } else if (container.getPorts() != null) {
> +         for (Port port : container.getPorts()) {
> +            if (port.getPrivatePort() == 22) {
> +               return port.getPublicPort();
> +            }
> +         }
> +      }
> +      throw new IllegalStateException("Cannot determine the login port for " + container.getId());

I think so as all the container will have a mapper port also for 22. In fact it is very much
unlikely that a container can get port 22 on the host.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/57/files#r10845029
Mime
View raw message