class AtlasProxyUserConfigCalculation extends AbstractUpgradeServerAction {

  @Override
  public CommandReport execute(ConcurrentMap<String, Object> requestSharedDataContext) throws AmbariException, InterruptedException {
    String clusterName = getExecutionCommand().getClusterName();
    Cluster cluster = getClusters().getCluster(clusterName);
    String outputMessage = "";

    Config atlasApplicationProperties = cluster.getDesiredConfigByType(ATLAS_APPLICATION_PROPERTIES_CONFIG_TYPE);
    if (null == atlasApplicationProperties) {
      return createCommandReport(0, HostRoleStatus.COMPLETED, "{}",
        MessageFormat.format("Config type {0} not found, skipping updating property in same.", ATLAS_APPLICATION_PROPERTIES_CONFIG_TYPE), "");
    }

    Config knoxEnvConfig = cluster.getDesiredConfigByType(KNOX_ENV_CONFIG_TYPE);
    String atlasProxyUsers = "knox";
    if (null != knoxEnvConfig && knoxEnvConfig.getProperties().containsKey(KNOX_USER_CONFIG)) {
      atlasProxyUsers = knoxEnvConfig.getProperties().get(KNOX_USER_CONFIG);
    }

    Map<String, String> currentAtlasApplicationProperties = atlasApplicationProperties.getProperties();
    currentAtlasApplicationProperties.put("atlas.proxyusers", atlasProxyUsers);
    atlasApplicationProperties.setProperties(currentAtlasApplicationProperties);
    atlasApplicationProperties.save();
    agentConfigsHolder.updateData(cluster.getClusterId(), cluster.getHosts().stream().map(Host::getHostId).collect(Collectors.toList()));

    outputMessage = outputMessage + MessageFormat.format("Successfully updated {0} config type.\n", ATLAS_APPLICATION_PROPERTIES_CONFIG_TYPE);
    return createCommandReport(0, HostRoleStatus.COMPLETED, "{}", outputMessage, "");
  }

}