public void checkAllStageConfigsPresentInDesiredConfigs(Cluster cluster) throws AmbariException {
    StackId stackId = cluster.getDesiredStackVersion();
    Set<String> stackConfigTypes = ambariMetaInfo.getStack(stackId.getStackName(),
            stackId.getStackVersion()).getConfigTypeAttributes().keySet();
    Map<String, Config> actualConfigs = new HashMap<>();
    Map<String, DesiredConfig> desiredConfigs = cluster.getDesiredConfigs();

    for (Map.Entry<String, DesiredConfig> desiredConfigEntry : desiredConfigs.entrySet()) {
      String configType = desiredConfigEntry.getKey();
      DesiredConfig desiredConfig = desiredConfigEntry.getValue();
      actualConfigs.put(configType, cluster.getConfig(configType, desiredConfig.getTag()));
    }

    for (String stackConfigType : stackConfigTypes) {
      if (!actualConfigs.containsKey(stackConfigType)) {
        LOG.error(String.format("Unable to find stack configuration %s in ambari configs!", stackConfigType));
      }
    }

  }
Fetch all the property values of a given PropertyType. For eg: Fetch all cluster configs that are of type "user"
@param propertyType
@param cluster
@param desiredConfigs
@param servicesMap
@param stackProperties
@return
@throws AmbariException
ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java