@Override public void validateInstalatorData(VM vm, String token) throws InvalidInstallProductRequestException, NodeExecutionException { if (isSdcClientInstalled()) { if (!vm.canWorkWithChef()) { sdcClientUtils.checkIfSdcNodeIsReady(vm.getIp()); sdcClientUtils.setNodeCommands(vm); vm = ip2vm.getVm(vm.getIp(), vm.getFqn(), vm.getOsType()); // Configure the node with the corresponding node commands } } else { if (!vm.canWorkWithInstallatorServer()) { String message = "The VM does not include the node hostname required to Install " + "software"; throw new InvalidInstallProductRequestException(message); } isNodeRegistered(vm.getHostname(), token); } }
public void callService( ProductInstance productInstance, VM vm, List<Attribute> attributes, String action, String token) throws InstallatorException, NodeExecutionException { String process = productInstance.getProductRelease().getProduct().getName(); String recipe = ""; if ("install".equals(action)) { recipe = recipeNamingGenerator.getInstallRecipe(productInstance); } else if ("uninstall".equals(action)) { recipe = recipeNamingGenerator.getUninstallRecipe(productInstance); } else if ("configure".equals(action)) { recipe = recipeNamingGenerator.getConfigureRecipe(productInstance); } else if ("deployArtifact".equals(action)) { recipe = recipeNamingGenerator.getDeployArtifactRecipe(productInstance); } else if ("undeployArtifact".equals(action)) { recipe = recipeNamingGenerator.getUnDeployArtifactRecipe(productInstance); } else { throw new InstallatorException("Missing Action"); } configureNode(vm, attributes, process, recipe, token); try { log.info("Updating node with recipe " + recipe + " in " + vm.getIp()); if (isSdcClientInstalled()) { executeRecipes(vm); // unassignRecipes(vm, recipe); } else { isRecipeExecuted(vm, process, recipe, token); // unassignRecipes(vm, recipe); // eliminate the attribute } } catch (NodeExecutionException e) { // even if execution fails want to unassign the recipe throw new NodeExecutionException(e.getMessage()); } }