class PostUserCreationHookServerAction extends AbstractServerAction {

  @Override
  public CommandReport execute(ConcurrentMap<String, Object> requestSharedDataContext) throws AmbariException, InterruptedException {
    LOGGER.debug("Executing custom script server action; Context: {}", requestSharedDataContext);
    ShellCommandUtil.Result result = null;
    CommandReport cmdReport = null;

    try {

      Map<String, String> commandParams = getCommandParameters();
      validateCommandParams(commandParams);

      //persist user data to csv
      CollectionPersisterService<String, List<String>> csvPersisterService = collectionPersisterServiceFactory.createCsvFilePersisterService(commandParams.get(UserHookParams.CMD_INPUT_FILE.param()));
      csvPersisterService.persistMap(getPayload(commandParams));

      String[] cmd = assembleCommand(commandParams);

      result = shellCommandUtilityWrapper.runCommand(cmd);

      // long command results need to be split to chunks to feed external log processors (eg.: syslog)
      logCommandResult(Arrays.asList(cmd).toString(), result);

      cmdReport = createCommandReport(result.getExitCode(), result.isSuccessful() ?
          HostRoleStatus.COMPLETED : HostRoleStatus.FAILED, "{}", result.getStdout(), result.getStderr());

      LOGGER.debug("Command report: {}", cmdReport);


    } catch (InterruptedException e) {
      LOGGER.error("The server action thread has been interrupted", e);
      throw e;
    } catch (Exception e) {
      LOGGER.error("Server action is about to quit due to an exception.", e);
      throw new AmbariException("Server action execution failed to complete!", e);
    }

    return cmdReport;
  }

  @Inject public  PostUserCreationHookServerAction();

}