[03/50] [abbrv] ambari git commit: AMBARI-21910 Ranger Usersync config to support nested group evaluation for LDAP Sync source property (mugdha)

2017-09-28 Thread aonishuk
AMBARI-21910 Ranger Usersync config to support nested group evaluation for LDAP 
Sync source property (mugdha)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ea892443
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ea892443
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ea892443

Branch: refs/heads/branch-3.0-perf
Commit: ea892443513fa730dad2ef3af06069ef618e0225
Parents: f067ec8
Author: Mugdha Varadkar 
Authored: Fri Sep 22 18:03:25 2017 +0530
Committer: Mugdha Varadkar 
Committed: Fri Sep 22 18:14:00 2017 +0530

--
 .../RangerUsersyncConfigCalculation.java|  96 ++
 .../RANGER/0.7.0/configuration/ranger-env.xml   |  23 
 .../0.7.0/configuration/ranger-ugsync-site.xml  |   7 ++
 .../RANGER/0.7.0/themes/theme_version_5.json|  40 ++
 .../1.0.0.3.0/configuration/ranger-env.xml  |  23 
 .../configuration/ranger-ugsync-site.xml|   7 ++
 .../1.0.0.3.0/themes/theme_version_1.json   |  40 ++
 .../HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml |   7 ++
 .../stacks/HDP/2.6/upgrades/upgrade-2.6.xml |   8 ++
 .../RangerUsersyncConfigCalculationTest.java| 126 +++
 10 files changed, 377 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/ea892443/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerUsersyncConfigCalculation.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerUsersyncConfigCalculation.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerUsersyncConfigCalculation.java
new file mode 100644
index 000..3573748
--- /dev/null
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerUsersyncConfigCalculation.java
@@ -0,0 +1,96 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.server.serveraction.upgrades;
+
+import java.text.MessageFormat;
+import java.util.Map;
+import java.util.concurrent.ConcurrentMap;
+
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.actionmanager.HostRoleStatus;
+import org.apache.ambari.server.agent.CommandReport;
+import org.apache.ambari.server.serveraction.AbstractServerAction;
+import org.apache.ambari.server.state.Cluster;
+import org.apache.ambari.server.state.Clusters;
+import org.apache.ambari.server.state.Config;
+
+import com.google.inject.Inject;
+
+/**
+ * Computes Ranger Usersync ldap grouphierarchylevels property. This class is 
only used when upgrading from
+ * HDP-2.6.x to HDP-2.6.y.
+ */
+
+public class RangerUsersyncConfigCalculation extends AbstractServerAction {
+  private static final String RANGER_USERSYNC_CONFIG_TYPE = 
"ranger-ugsync-site";
+  private static final String RANGER_ENV_CONFIG_TYPE = "ranger-env";
+
+  @Inject
+  private Clusters m_clusters;
+
+  @Override
+  public CommandReport execute(ConcurrentMap 
requestSharedDataContext) throws AmbariException, InterruptedException {
+
+  String clusterName = getExecutionCommand().getClusterName();
+  Cluster cluster = m_clusters.getCluster(clusterName);
+  String outputMsg = "";
+
+  Config rangerUsersyncConfig = 
cluster.getDesiredConfigByType(RANGER_USERSYNC_CONFIG_TYPE);
+
+  if (null == rangerUsersyncConfig) {
+return createCommandReport(0, HostRoleStatus.COMPLETED, "{}",
+  MessageFormat.format("Config type {0} not found, skipping updating 
property in same.", RANGER_USERSYNC_CONFIG_TYPE), "");
+  }
+
+  String ldapGroupHierarchy = "0";
+
+  if 
(rangerUsersyncConfig.getProperties().containsKey("ranger.usersync.ldap.grouphierarchylevels"))
 {
+ldapGroupHierarchy = 
rangerUsersyncConfig.getProperties().get("ranger.usersync.ldap.grouphierarchylevels");
+  } else {
+Map targetRangerUsersyncConfig = 
rangerUsersyncConfig.getProperties();
+

[16/50] [abbrv] ambari git commit: AMBARI-21910 Ranger Usersync config to support nested group evaluation for LDAP Sync source property (mugdha)

2017-09-26 Thread swagle
AMBARI-21910 Ranger Usersync config to support nested group evaluation for LDAP 
Sync source property (mugdha)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ea892443
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ea892443
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ea892443

Branch: refs/heads/branch-3.0-ams
Commit: ea892443513fa730dad2ef3af06069ef618e0225
Parents: f067ec8
Author: Mugdha Varadkar 
Authored: Fri Sep 22 18:03:25 2017 +0530
Committer: Mugdha Varadkar 
Committed: Fri Sep 22 18:14:00 2017 +0530

--
 .../RangerUsersyncConfigCalculation.java|  96 ++
 .../RANGER/0.7.0/configuration/ranger-env.xml   |  23 
 .../0.7.0/configuration/ranger-ugsync-site.xml  |   7 ++
 .../RANGER/0.7.0/themes/theme_version_5.json|  40 ++
 .../1.0.0.3.0/configuration/ranger-env.xml  |  23 
 .../configuration/ranger-ugsync-site.xml|   7 ++
 .../1.0.0.3.0/themes/theme_version_1.json   |  40 ++
 .../HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml |   7 ++
 .../stacks/HDP/2.6/upgrades/upgrade-2.6.xml |   8 ++
 .../RangerUsersyncConfigCalculationTest.java| 126 +++
 10 files changed, 377 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/ea892443/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerUsersyncConfigCalculation.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerUsersyncConfigCalculation.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerUsersyncConfigCalculation.java
new file mode 100644
index 000..3573748
--- /dev/null
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerUsersyncConfigCalculation.java
@@ -0,0 +1,96 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.server.serveraction.upgrades;
+
+import java.text.MessageFormat;
+import java.util.Map;
+import java.util.concurrent.ConcurrentMap;
+
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.actionmanager.HostRoleStatus;
+import org.apache.ambari.server.agent.CommandReport;
+import org.apache.ambari.server.serveraction.AbstractServerAction;
+import org.apache.ambari.server.state.Cluster;
+import org.apache.ambari.server.state.Clusters;
+import org.apache.ambari.server.state.Config;
+
+import com.google.inject.Inject;
+
+/**
+ * Computes Ranger Usersync ldap grouphierarchylevels property. This class is 
only used when upgrading from
+ * HDP-2.6.x to HDP-2.6.y.
+ */
+
+public class RangerUsersyncConfigCalculation extends AbstractServerAction {
+  private static final String RANGER_USERSYNC_CONFIG_TYPE = 
"ranger-ugsync-site";
+  private static final String RANGER_ENV_CONFIG_TYPE = "ranger-env";
+
+  @Inject
+  private Clusters m_clusters;
+
+  @Override
+  public CommandReport execute(ConcurrentMap 
requestSharedDataContext) throws AmbariException, InterruptedException {
+
+  String clusterName = getExecutionCommand().getClusterName();
+  Cluster cluster = m_clusters.getCluster(clusterName);
+  String outputMsg = "";
+
+  Config rangerUsersyncConfig = 
cluster.getDesiredConfigByType(RANGER_USERSYNC_CONFIG_TYPE);
+
+  if (null == rangerUsersyncConfig) {
+return createCommandReport(0, HostRoleStatus.COMPLETED, "{}",
+  MessageFormat.format("Config type {0} not found, skipping updating 
property in same.", RANGER_USERSYNC_CONFIG_TYPE), "");
+  }
+
+  String ldapGroupHierarchy = "0";
+
+  if 
(rangerUsersyncConfig.getProperties().containsKey("ranger.usersync.ldap.grouphierarchylevels"))
 {
+ldapGroupHierarchy = 
rangerUsersyncConfig.getProperties().get("ranger.usersync.ldap.grouphierarchylevels");
+  } else {
+Map targetRangerUsersyncConfig = 
rangerUsersyncConfig.getProperties();
+

[30/50] [abbrv] ambari git commit: AMBARI-21910 Ranger Usersync config to support nested group evaluation for LDAP Sync source property (mugdha)

2017-09-25 Thread jluniya
AMBARI-21910 Ranger Usersync config to support nested group evaluation for LDAP 
Sync source property (mugdha)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ea892443
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ea892443
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ea892443

Branch: refs/heads/branch-feature-AMBARI-14714
Commit: ea892443513fa730dad2ef3af06069ef618e0225
Parents: f067ec8
Author: Mugdha Varadkar 
Authored: Fri Sep 22 18:03:25 2017 +0530
Committer: Mugdha Varadkar 
Committed: Fri Sep 22 18:14:00 2017 +0530

--
 .../RangerUsersyncConfigCalculation.java|  96 ++
 .../RANGER/0.7.0/configuration/ranger-env.xml   |  23 
 .../0.7.0/configuration/ranger-ugsync-site.xml  |   7 ++
 .../RANGER/0.7.0/themes/theme_version_5.json|  40 ++
 .../1.0.0.3.0/configuration/ranger-env.xml  |  23 
 .../configuration/ranger-ugsync-site.xml|   7 ++
 .../1.0.0.3.0/themes/theme_version_1.json   |  40 ++
 .../HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml |   7 ++
 .../stacks/HDP/2.6/upgrades/upgrade-2.6.xml |   8 ++
 .../RangerUsersyncConfigCalculationTest.java| 126 +++
 10 files changed, 377 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/ea892443/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerUsersyncConfigCalculation.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerUsersyncConfigCalculation.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerUsersyncConfigCalculation.java
new file mode 100644
index 000..3573748
--- /dev/null
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerUsersyncConfigCalculation.java
@@ -0,0 +1,96 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.server.serveraction.upgrades;
+
+import java.text.MessageFormat;
+import java.util.Map;
+import java.util.concurrent.ConcurrentMap;
+
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.actionmanager.HostRoleStatus;
+import org.apache.ambari.server.agent.CommandReport;
+import org.apache.ambari.server.serveraction.AbstractServerAction;
+import org.apache.ambari.server.state.Cluster;
+import org.apache.ambari.server.state.Clusters;
+import org.apache.ambari.server.state.Config;
+
+import com.google.inject.Inject;
+
+/**
+ * Computes Ranger Usersync ldap grouphierarchylevels property. This class is 
only used when upgrading from
+ * HDP-2.6.x to HDP-2.6.y.
+ */
+
+public class RangerUsersyncConfigCalculation extends AbstractServerAction {
+  private static final String RANGER_USERSYNC_CONFIG_TYPE = 
"ranger-ugsync-site";
+  private static final String RANGER_ENV_CONFIG_TYPE = "ranger-env";
+
+  @Inject
+  private Clusters m_clusters;
+
+  @Override
+  public CommandReport execute(ConcurrentMap 
requestSharedDataContext) throws AmbariException, InterruptedException {
+
+  String clusterName = getExecutionCommand().getClusterName();
+  Cluster cluster = m_clusters.getCluster(clusterName);
+  String outputMsg = "";
+
+  Config rangerUsersyncConfig = 
cluster.getDesiredConfigByType(RANGER_USERSYNC_CONFIG_TYPE);
+
+  if (null == rangerUsersyncConfig) {
+return createCommandReport(0, HostRoleStatus.COMPLETED, "{}",
+  MessageFormat.format("Config type {0} not found, skipping updating 
property in same.", RANGER_USERSYNC_CONFIG_TYPE), "");
+  }
+
+  String ldapGroupHierarchy = "0";
+
+  if 
(rangerUsersyncConfig.getProperties().containsKey("ranger.usersync.ldap.grouphierarchylevels"))
 {
+ldapGroupHierarchy = 
rangerUsersyncConfig.getProperties().get("ranger.usersync.ldap.grouphierarchylevels");
+  } else {
+Map targetRangerUsersyncConfig = 
rangerUsersyncConfig.getProperties();
+

ambari git commit: AMBARI-21910 Ranger Usersync config to support nested group evaluation for LDAP Sync source property (mugdha)

2017-09-22 Thread mugdha
Repository: ambari
Updated Branches:
  refs/heads/trunk f067ec8c3 -> ea8924435


AMBARI-21910 Ranger Usersync config to support nested group evaluation for LDAP 
Sync source property (mugdha)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ea892443
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ea892443
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ea892443

Branch: refs/heads/trunk
Commit: ea892443513fa730dad2ef3af06069ef618e0225
Parents: f067ec8
Author: Mugdha Varadkar 
Authored: Fri Sep 22 18:03:25 2017 +0530
Committer: Mugdha Varadkar 
Committed: Fri Sep 22 18:14:00 2017 +0530

--
 .../RangerUsersyncConfigCalculation.java|  96 ++
 .../RANGER/0.7.0/configuration/ranger-env.xml   |  23 
 .../0.7.0/configuration/ranger-ugsync-site.xml  |   7 ++
 .../RANGER/0.7.0/themes/theme_version_5.json|  40 ++
 .../1.0.0.3.0/configuration/ranger-env.xml  |  23 
 .../configuration/ranger-ugsync-site.xml|   7 ++
 .../1.0.0.3.0/themes/theme_version_1.json   |  40 ++
 .../HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml |   7 ++
 .../stacks/HDP/2.6/upgrades/upgrade-2.6.xml |   8 ++
 .../RangerUsersyncConfigCalculationTest.java| 126 +++
 10 files changed, 377 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/ea892443/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerUsersyncConfigCalculation.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerUsersyncConfigCalculation.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerUsersyncConfigCalculation.java
new file mode 100644
index 000..3573748
--- /dev/null
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerUsersyncConfigCalculation.java
@@ -0,0 +1,96 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.server.serveraction.upgrades;
+
+import java.text.MessageFormat;
+import java.util.Map;
+import java.util.concurrent.ConcurrentMap;
+
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.actionmanager.HostRoleStatus;
+import org.apache.ambari.server.agent.CommandReport;
+import org.apache.ambari.server.serveraction.AbstractServerAction;
+import org.apache.ambari.server.state.Cluster;
+import org.apache.ambari.server.state.Clusters;
+import org.apache.ambari.server.state.Config;
+
+import com.google.inject.Inject;
+
+/**
+ * Computes Ranger Usersync ldap grouphierarchylevels property. This class is 
only used when upgrading from
+ * HDP-2.6.x to HDP-2.6.y.
+ */
+
+public class RangerUsersyncConfigCalculation extends AbstractServerAction {
+  private static final String RANGER_USERSYNC_CONFIG_TYPE = 
"ranger-ugsync-site";
+  private static final String RANGER_ENV_CONFIG_TYPE = "ranger-env";
+
+  @Inject
+  private Clusters m_clusters;
+
+  @Override
+  public CommandReport execute(ConcurrentMap 
requestSharedDataContext) throws AmbariException, InterruptedException {
+
+  String clusterName = getExecutionCommand().getClusterName();
+  Cluster cluster = m_clusters.getCluster(clusterName);
+  String outputMsg = "";
+
+  Config rangerUsersyncConfig = 
cluster.getDesiredConfigByType(RANGER_USERSYNC_CONFIG_TYPE);
+
+  if (null == rangerUsersyncConfig) {
+return createCommandReport(0, HostRoleStatus.COMPLETED, "{}",
+  MessageFormat.format("Config type {0} not found, skipping updating 
property in same.", RANGER_USERSYNC_CONFIG_TYPE), "");
+  }
+
+  String ldapGroupHierarchy = "0";
+
+  if 
(rangerUsersyncConfig.getProperties().containsKey("ranger.usersync.ldap.grouphierarchylevels"))
 {
+ldapGroupHierarchy = 
rangerUsersyncConfig.getProperties().get("ranger.usersync.ldap.grouphierarchylevels");
+  } else {
+Map targetRangerUsersyncConfig 

ambari git commit: AMBARI-21910 Ranger Usersync config to support nested group evaluation for LDAP Sync source property (mugdha)

2017-09-22 Thread mugdha
Repository: ambari
Updated Branches:
  refs/heads/branch-2.6 29e6213d1 -> f5ec32912


AMBARI-21910 Ranger Usersync config to support nested group evaluation for LDAP 
Sync source property (mugdha)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f5ec3291
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f5ec3291
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f5ec3291

Branch: refs/heads/branch-2.6
Commit: f5ec3291215aae8320f99b542be7648fec1b7fd1
Parents: 29e6213
Author: Mugdha Varadkar 
Authored: Fri Sep 22 17:59:51 2017 +0530
Committer: Mugdha Varadkar 
Committed: Fri Sep 22 18:12:22 2017 +0530

--
 .../RangerUsersyncConfigCalculation.java|  96 ++
 .../RANGER/0.7.0/configuration/ranger-env.xml   |  23 
 .../0.7.0/configuration/ranger-ugsync-site.xml  |   7 ++
 .../RANGER/0.7.0/themes/theme_version_5.json|  40 ++
 .../HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml |   7 ++
 .../stacks/HDP/2.6/upgrades/upgrade-2.6.xml |   8 ++
 .../RangerUsersyncConfigCalculationTest.java| 126 +++
 7 files changed, 307 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/f5ec3291/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerUsersyncConfigCalculation.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerUsersyncConfigCalculation.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerUsersyncConfigCalculation.java
new file mode 100644
index 000..3573748
--- /dev/null
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/RangerUsersyncConfigCalculation.java
@@ -0,0 +1,96 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.server.serveraction.upgrades;
+
+import java.text.MessageFormat;
+import java.util.Map;
+import java.util.concurrent.ConcurrentMap;
+
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.actionmanager.HostRoleStatus;
+import org.apache.ambari.server.agent.CommandReport;
+import org.apache.ambari.server.serveraction.AbstractServerAction;
+import org.apache.ambari.server.state.Cluster;
+import org.apache.ambari.server.state.Clusters;
+import org.apache.ambari.server.state.Config;
+
+import com.google.inject.Inject;
+
+/**
+ * Computes Ranger Usersync ldap grouphierarchylevels property. This class is 
only used when upgrading from
+ * HDP-2.6.x to HDP-2.6.y.
+ */
+
+public class RangerUsersyncConfigCalculation extends AbstractServerAction {
+  private static final String RANGER_USERSYNC_CONFIG_TYPE = 
"ranger-ugsync-site";
+  private static final String RANGER_ENV_CONFIG_TYPE = "ranger-env";
+
+  @Inject
+  private Clusters m_clusters;
+
+  @Override
+  public CommandReport execute(ConcurrentMap 
requestSharedDataContext) throws AmbariException, InterruptedException {
+
+  String clusterName = getExecutionCommand().getClusterName();
+  Cluster cluster = m_clusters.getCluster(clusterName);
+  String outputMsg = "";
+
+  Config rangerUsersyncConfig = 
cluster.getDesiredConfigByType(RANGER_USERSYNC_CONFIG_TYPE);
+
+  if (null == rangerUsersyncConfig) {
+return createCommandReport(0, HostRoleStatus.COMPLETED, "{}",
+  MessageFormat.format("Config type {0} not found, skipping updating 
property in same.", RANGER_USERSYNC_CONFIG_TYPE), "");
+  }
+
+  String ldapGroupHierarchy = "0";
+
+  if 
(rangerUsersyncConfig.getProperties().containsKey("ranger.usersync.ldap.grouphierarchylevels"))
 {
+ldapGroupHierarchy = 
rangerUsersyncConfig.getProperties().get("ranger.usersync.ldap.grouphierarchylevels");
+  } else {
+Map targetRangerUsersyncConfig = 
rangerUsersyncConfig.getProperties();
+
targetRangerUsersyncConfig.put("ranger.usersync.ldap.grouphierarchylevels", 
ldapGroupHierarchy);
+