/**
   * Make remote slave log directory.
   *
   * @param logCollection the log collection
   * @throws JSchException the j sch exception
   * @throws IOException Signals that an I/O exception has occurred.
   * @throws InterruptedException the interrupted exception
   */
  private static void makeRemoteSlaveLogDirectory(LogConsolidationInfo logCollection)
      throws JSchException, IOException, InterruptedException {

    List<Slave> listSlave = logCollection.getSlaves();
    Master master = logCollection.getMaster();
    String masterHost = master.getHost();
    Integer agentPort = Integer.valueOf(master.getAgentPort());

    Remoter remoter = new Remoter(masterHost, agentPort);
    for (Slave slaveDefinition : listSlave) {

      String[] hostsNode = slaveDefinition.getHosts();
      String locationNode = slaveDefinition.getLocation();

      for (String hostNode : hostsNode) {
        String command = Constants.MKDIR_P_CMD + getFolderName(locationNode);
        LOGGER.debug("Log directory generation command on WorkerNode [" + command + "]");

        CommandWritableBuilder builder = new CommandWritableBuilder();
        builder
            .addCommand(command, false, null, CommandType.FS)
            .populateFromLogConsolidationInfo(logCollection, hostNode);
        String parentOfLocationNode = null;
        if (locationNode.lastIndexOf(File.separator) > -1) {
          parentOfLocationNode =
              locationNode.substring(0, locationNode.lastIndexOf(File.separator));
          LOGGER.info("Location Node " + locationNode);
          LOGGER.info("Parent of Location Node " + parentOfLocationNode);
          builder
              .addCommand(Constants.CHMOD_CMD + parentOfLocationNode, false, null, CommandType.FS)
              .populateFromLogConsolidationInfo(logCollection, hostNode);
        }
        remoter.fireAndForgetCommand(builder.getCommandWritable());
      }
      LOGGER.info("Log directory created on WorkerNodes ");
      CONSOLELOGGER.info("Log directory generation on WorkerNodes ");
    }
    remoter.close();
  }