AMBARI-20257 Log Search upgrade to 2.5 should handle renamed properties safely (mgergely)
Change-Id: I162e210a02e9c56575f682cb6d65074c18efd8b9 Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7e2eb293 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7e2eb293 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7e2eb293 Branch: refs/heads/branch-feature-AMBARI-12556 Commit: 7e2eb293def46ee172c05471bc7fc6954eafd98b Parents: 74d3327 Author: Miklos Gergely <mgerg...@hortonworks.com> Authored: Fri Mar 3 01:38:11 2017 +0100 Committer: Miklos Gergely <mgerg...@hortonworks.com> Committed: Fri Mar 3 01:38:11 2017 +0100 ---------------------------------------------------------------------- .../org/apache/ambari/server/upgrade/UpgradeCatalog250.java | 9 ++++++--- .../LOGSEARCH/0.5.0/configuration/logsearch-properties.xml | 6 +++--- 2 files changed, 9 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/7e2eb293/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java index ad7490b..2a684dc 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java @@ -892,9 +892,12 @@ public class UpgradeCatalog250 extends AbstractUpgradeCatalog { Config logSearchProperties = cluster.getDesiredConfigByType("logsearch-properties"); if (logSearchProperties != null) { Map<String, String> newProperties = new HashMap<>(); - newProperties.put("logsearch.auth.external_auth.enabled", logSearchProperties.getProperties().get("logsearch.external.auth.enabled")); - newProperties.put("logsearch.auth.external_auth.host_url", logSearchProperties.getProperties().get("logsearch.external.auth.host_url")); - newProperties.put("logsearch.auth.external_auth.login_url", logSearchProperties.getProperties().get("logsearch.external.auth.login_url")); + if (!logSearchProperties.getProperties().containsKey("logsearch.auth.external_auth.enabled")) + newProperties.put("logsearch.auth.external_auth.enabled", logSearchProperties.getProperties().get("logsearch.external.auth.enabled")); + if (!logSearchProperties.getProperties().containsKey("logsearch.auth.external_auth.host_url")) + newProperties.put("logsearch.auth.external_auth.host_url", logSearchProperties.getProperties().get("logsearch.external.auth.host_url")); + if (!logSearchProperties.getProperties().containsKey("logsearch.auth.external_auth.login_url")) + newProperties.put("logsearch.auth.external_auth.login_url", logSearchProperties.getProperties().get("logsearch.external.auth.login_url")); Set<String> removeProperties = new HashSet<>(); removeProperties.add("logsearch.external.auth.enabled"); http://git-wip-us.apache.org/repos/asf/ambari/blob/7e2eb293/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logsearch-properties.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logsearch-properties.xml b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logsearch-properties.xml index d57b98b..a18c5c5 100644 --- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logsearch-properties.xml +++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/configuration/logsearch-properties.xml @@ -157,21 +157,21 @@ <value-attributes> <type>boolean</type> </value-attributes> - <on-ambari-upgrade add="true"/> + <on-ambari-upgrade add="false"/> </property> <property> <name>logsearch.auth.external_auth.host_url</name> <value>{ambari_server_auth_host_url}</value> <display-name>External authentication url - host and port</display-name> <description>The host and port of the external server used to authenticate</description> - <on-ambari-upgrade add="true"/> + <on-ambari-upgrade add="false"/> </property> <property> <name>logsearch.auth.external_auth.login_url</name> <value>/api/v1/users/$USERNAME/privileges?fields=*</value> <display-name>External authentication url - path and query</display-name> <description>The path and query of the external server used to authenticate</description> - <on-ambari-upgrade add="true"/> + <on-ambari-upgrade add="false"/> </property> <property> <name>logsearch.roles.allowed</name>