/**
  * Create a new {@link Slave} from the given {@link Droplet}
  *
  * @param droplet the droplet being created
  * @param privateKey the RSA private key being used
  * @return the provisioned {@link Slave}
  * @throws IOException
  * @throws Descriptor.FormException
  */
 private Slave newSlave(String cloudName, Droplet droplet, String privateKey)
     throws IOException, Descriptor.FormException {
   LOGGER.log(Level.INFO, "Creating new slave...");
   return new Slave(
       cloudName,
       droplet.getName(),
       "Computer running on DigitalOcean with name: " + droplet.getName(),
       droplet.getId(),
       privateKey,
       username,
       workspacePath,
       sshPort,
       numExecutors,
       idleTerminationInMinutes,
       Node.Mode.NORMAL,
       labels,
       new ComputerLauncher(),
       new RetentionStrategy(),
       Collections.<NodeProperty<?>>emptyList(),
       Util.fixNull(initScript),
       "");
 }
  public boolean isInstanceCapReachedRemote(List<Droplet> droplets, String cloudName)
      throws DigitalOceanException {
    LOGGER.log(Level.INFO, "slave limit check");
    int count = 0;
    for (Droplet droplet : droplets) {
      if ((droplet.isActive() || droplet.isNew())) {
        if (DropletName.isDropletInstanceOfSlave(droplet.getName(), cloudName, name)) {
          count++;
        }
      }
    }

    return count >= instanceCap;
  }