protected void moveAmbariPropertiesToAmbariConfiguration() throws AmbariException {
    LOG.info("Moving LDAP and SSO related properties from ambari.properties to ambari_configuration DB table...");
    final AmbariConfigurationDAO ambariConfigurationDAO = injector.getInstance(AmbariConfigurationDAO.class);
    final Map<AmbariServerConfigurationCategory, Map<String, String>> propertiesToBeMoved = new HashMap<>();

    final Map<AmbariServerConfigurationKey, String> configurationMap = getAmbariConfigurationMap();
    configurationMap.forEach((key, oldPropertyName) -> {
      String propertyValue = configuration.getProperty(oldPropertyName);
      if (propertyValue != null) { // Empty strings are ok
        if (AmbariServerConfigurationKey.SERVER_HOST == key || AmbariServerConfigurationKey.SECONDARY_SERVER_HOST == key) {
          final HostAndPort hostAndPort = HostAndPort.fromString(propertyValue);
          AmbariServerConfigurationKey keyToBesaved = AmbariServerConfigurationKey.SERVER_HOST == key ? AmbariServerConfigurationKey.SERVER_HOST
              : AmbariServerConfigurationKey.SECONDARY_SERVER_HOST;
          populateConfigurationToBeMoved(propertiesToBeMoved, oldPropertyName, keyToBesaved, hostAndPort.getHost());

          keyToBesaved = AmbariServerConfigurationKey.SERVER_HOST == key ? AmbariServerConfigurationKey.SERVER_PORT : AmbariServerConfigurationKey.SECONDARY_SERVER_PORT;
          populateConfigurationToBeMoved(propertiesToBeMoved, oldPropertyName, keyToBesaved, String.valueOf(hostAndPort.getPort()));
        } else if (AmbariServerConfigurationKey.SSO_PROVIDER_CERTIFICATE == key) {
          // Read in the PEM file and store the PEM data rather than the file path...
          StringBuilder contentBuilder = new StringBuilder();
          try (Stream<String> stream = Files.lines(Paths.get(propertyValue), StandardCharsets.UTF_8)) {
            stream.forEach(s -> contentBuilder.append(s).append("\n"));
          } catch (IOException e) {
            LOG.error(String.format("Failed to read the SSO provider's certificate file, %s: %s", propertyValue, e.getMessage()), e);
          }
          populateConfigurationToBeMoved(propertiesToBeMoved, oldPropertyName, key, contentBuilder.toString());
        } else if (AmbariServerConfigurationKey.SSO_AUTHENTICATION_ENABLED == key) {
          populateConfigurationToBeMoved(propertiesToBeMoved, oldPropertyName, key, propertyValue);

          if("true".equalsIgnoreCase(propertyValue)) {
            // Add the new properties to tell Ambari that SSO is enabled:
            populateConfigurationToBeMoved(propertiesToBeMoved, null, AmbariServerConfigurationKey.SSO_MANAGE_SERVICES, "true");
            populateConfigurationToBeMoved(propertiesToBeMoved, null, AmbariServerConfigurationKey.SSO_ENABLED_SERVICES, "AMBARI");
          }
        } else if (AmbariServerConfigurationKey.LDAP_ENABLED == key) {
          populateConfigurationToBeMoved(propertiesToBeMoved, oldPropertyName, key, propertyValue);

          if ("true".equalsIgnoreCase(propertyValue)) {
            // Add the new properties to tell Ambari that LDAP is enabled:
            populateConfigurationToBeMoved(propertiesToBeMoved, null, AmbariServerConfigurationKey.AMBARI_MANAGES_LDAP_CONFIGURATION, "true");
            populateConfigurationToBeMoved(propertiesToBeMoved, null, AmbariServerConfigurationKey.LDAP_ENABLED_SERVICES, "AMBARI");
          }
        } else {
          populateConfigurationToBeMoved(propertiesToBeMoved, oldPropertyName, key, propertyValue);
        }
      }
    });

    if (propertiesToBeMoved.isEmpty()) {
      LOG.info("There are no properties to be moved from ambari.properties to the Ambari DB; moved 0 elements");
    } else {
      for (Map.Entry<AmbariServerConfigurationCategory, Map<String, String>> entry : propertiesToBeMoved.entrySet()) {
        Map<String, String> properties = entry.getValue();

        if (properties != null) {
          String categoryName = entry.getKey().getCategoryName();
          ambariConfigurationDAO.reconcileCategory(categoryName, entry.getValue(), false);
          LOG.info("Moved {} properties to the {} Ambari Configuration category", properties.size(), categoryName);
        }
      }

      configuration.removePropertiesFromAmbariProperties(configurationMap.values());
    }
  }
Moves SSO and LDAP related properties from ambari.properties to ambari_configuration DB table

@throws AmbariException if there was any issue when clearing ambari.properties
ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog270.java