public Set<String> getPropertyValuesWithPropertyType(PropertyType propertyType,
                                                       Cluster cluster, Map<String, DesiredConfig> desiredConfigs,
                                                       Map<String, ServiceInfo> servicesMap,
                                                       Set<PropertyInfo> stackProperties) throws AmbariException {
    Map<String, Config> actualConfigs = new HashMap<>();
    Set<String> result = new HashSet<>();

    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 (Service service : cluster.getServices().values()) {
      // !!! the services map is from the stack, which may not contain services in the cluster.
      // This is the case for upgrades where the target stack may remove services
      if (!servicesMap.containsKey(service.getName())) {
        continue;
      }

      Set<PropertyInfo> serviceProperties = new HashSet<>(servicesMap.get(service.getName()).getProperties());
      for (PropertyInfo serviceProperty : serviceProperties) {
        if (serviceProperty.getPropertyTypes().contains(propertyType)) {
          String stackPropertyConfigType = fileNameToConfigType(serviceProperty.getFilename());
          try {
            String property = actualConfigs.get(stackPropertyConfigType).getProperties().get(serviceProperty.getName());
            if (null == property){
              LOG.error(String.format("Unable to obtain property values for %s with property attribute %s. "
                  + "The property does not exist in version %s of %s configuration.",
                  serviceProperty.getName(),
                  propertyType,
                  desiredConfigs.get(stackPropertyConfigType),
                  stackPropertyConfigType
                  ));
            } else {
              result.add(property);
            }
          } catch (Exception ignored) {
          }
        }
      }
    }


    for (PropertyInfo stackProperty : stackProperties) {
      if (stackProperty.getPropertyTypes().contains(propertyType)) {
        String stackPropertyConfigType = fileNameToConfigType(stackProperty.getFilename());
        if (actualConfigs.containsKey(stackPropertyConfigType)) {
          result.add(actualConfigs.get(stackPropertyConfigType).getProperties().get(stackProperty.getName()));
        }
      }
    }

    return result;
  }
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