private void createServicesDirectory(Path extractedMpackDirectory, Mpack mpack) throws IOException {
    File servicesDir = new File(extractedMpackDirectory.toAbsolutePath() + File.separator + MODULES_DIRECTORY);
    if (!servicesDir.exists()) {
      servicesDir.mkdir();
    }
    List<Module> modules = mpack.getModules();

    LOG.info("Creating services directory for mpack :" + mpack.getName());

    for (Module module : modules) {
      //if (module.getType() == Packlet.PackletType.SERVICE_PACKLET) { //Add back if there is going to be a view packlet
      String moduleDefinitionLocation = module.getDefinition();
      File serviceTargetDir = new File(servicesDir + File.separator + module.getName());
      extractTar(Paths.get(extractedMpackDirectory + File.separator + "modules" + File.separator + moduleDefinitionLocation), servicesDir);
      Path extractedServiceDirectory = Files.move(Paths.get(servicesDir + File.separator + moduleDefinitionLocation
                      .substring(moduleDefinitionLocation.indexOf("/") + 1, moduleDefinitionLocation.indexOf(".tar.gz"))),
              serviceTargetDir.toPath(), StandardCopyOption.REPLACE_EXISTING);

    }
  }
Create a services directory and extract all the services tar file inside it. This readies it for cluster deployment

@param extractedMpackDirectory
@param mpack
@throws IOException
ambari-server/src/test/java/org/apache/ambari/server/mpack/MpackManagerMock.java