public String getPropertyValueFromStackDefinitions(Cluster cluster, String configType, String propertyName) throws AmbariException {

    Set<StackId> stackIds = new HashSet<>();

    for (Service service : cluster.getServices().values()) {
      stackIds.add(service.getDesiredStackId());
    }

    for (StackId stackId : stackIds) {

      StackInfo stack = ambariMetaInfo.getStack(stackId.getStackName(),
          stackId.getStackVersion());

      for (ServiceInfo serviceInfo : stack.getServices()) {
        Set<PropertyInfo> serviceProperties = ambariMetaInfo.getServiceProperties(stack.getName(), stack.getVersion(), serviceInfo.getName());
        Set<PropertyInfo> stackProperties = ambariMetaInfo.getStackProperties(stack.getName(), stack.getVersion());
        serviceProperties.addAll(stackProperties);

        for (PropertyInfo stackProperty : serviceProperties) {
          String stackPropertyConfigType = fileNameToConfigType(stackProperty.getFilename());

          if (stackProperty.getName().equals(propertyName) && stackPropertyConfigType.equals(configType)) {
            return stackProperty.getValue();
          }
        }
      }
    }

    return null;
  }
Fetch all the config values of a given PropertyType. For eg: Fetch all stack configs that are of type "user"
@param cluster
@param configType
@param propertyName
@return
@throws AmbariException
ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java