/**
   * Tell Chef the previously assigned recipes are ready to be installed.
   *
   * @param osInstance
   * @throws
   * @throws ShellCommandException
   */
  public void isRecipeExecuted(VM vm, String process, String recipe, String token)
      throws NodeExecutionException {
    boolean isExecuted = false;
    int time = 5000;
    Date fechaAhora = new Date();
    while (!isExecuted) {
      log.info("MAX_TIME: " + MAX_TIME + " and time: " + time);
      try {
        if (time > MAX_TIME) {
          String errorMesg =
              "Recipe " + process + " coub not be executed in " + vm.getChefClientName();
          log.info(errorMesg);
          // unassignRecipes(vm, recipe, token);
          throw new NodeExecutionException(errorMesg);
        }

        Thread.sleep(time);

        ChefNode node = chefNodeDao.loadNodeFromHostname(vm.getHostname(), token);

        long last_recipeexecution_timestamp = getLastRecipeExecutionTimeStamp(node);
        log.info(
            "last_recipeexecution_timestamp:"
                + last_recipeexecution_timestamp
                + "fechaAhora:"
                + fechaAhora.getTime());
        if (last_recipeexecution_timestamp > fechaAhora.getTime()) {
          // if (isRecipeExecutedOK(process, node))
          isExecuted = true;
          /*else{
              String message =" Recipe Execution failed";
              unassignRecipes(vm, recipe);
              throw new NodeExecutionException( new ChefRecipeExecutionException(message));
          }*/
        }
        time += time;
      } catch (EntityNotFoundException e) {
        throw new NodeExecutionException(e);
      } catch (CanNotCallChefException e) {
        throw new NodeExecutionException(e);
      } catch (InterruptedException ie) {
        throw new NodeExecutionException(ie);
      } /*catch (InstallatorException ie2){
            throw new NodeExecutionException(ie2);
        }*/
    }
  }