ambari git commit: AMBARI-20488 Config types are validated before the cluster resources are persisted

2017-03-20 Thread lpuskas
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 ea8dff324 -> 7cbad939f


AMBARI-20488 Config types are validated before the cluster resources are 
persisted


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

Branch: refs/heads/branch-2.5
Commit: 7cbad939f6cf3ebdde59c3829672683f334dd32b
Parents: ea8dff3
Author: lpuskas 
Authored: Fri Mar 17 17:53:58 2017 +0100
Committer: lpuskas 
Committed: Mon Mar 20 16:31:01 2017 +0100

--
 .../internal/ProvisionClusterRequest.java   |  47 +++---
 .../topology/RequiredPasswordValidator.java | 156 --
 .../validators/ClusterConfigTypeValidator.java  |  76 +
 .../validators/RequiredPasswordValidator.java   | 161 +++
 .../internal/ProvisionClusterRequestTest.java   |  12 +-
 .../topology/RequiredPasswordValidatorTest.java |  23 +--
 .../ClusterConfigTypeValidatorTest.java | 110 +
 7 files changed, 390 insertions(+), 195 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/7cbad939/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
index 2c8d09a..a63013a 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
@@ -18,7 +18,6 @@
 package org.apache.ambari.server.controller.internal;
 
 import java.util.Collection;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -36,15 +35,17 @@ import org.apache.ambari.server.topology.Credential;
 import org.apache.ambari.server.topology.HostGroupInfo;
 import org.apache.ambari.server.topology.InvalidTopologyTemplateException;
 import org.apache.ambari.server.topology.NoSuchBlueprintException;
-import org.apache.ambari.server.topology.RequiredPasswordValidator;
 import org.apache.ambari.server.topology.SecurityConfiguration;
 import org.apache.ambari.server.topology.TopologyValidator;
+import org.apache.ambari.server.topology.validators.ClusterConfigTypeValidator;
+import org.apache.ambari.server.topology.validators.RequiredPasswordValidator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import com.google.common.base.Enums;
 import com.google.common.base.Optional;
 import com.google.common.base.Strings;
+import com.google.common.collect.ImmutableList;
 
 /**
  * Request for provisioning a cluster.
@@ -118,7 +119,6 @@ public class ProvisionClusterRequest extends 
BaseClusterRequest {
   public static final String QUICKLINKS_PROFILE_SERVICES_PROPERTY = 
"quicklinks_profile/services";
 
 
-
   /**
* configuration factory
*/
@@ -145,6 +145,8 @@ public class ProvisionClusterRequest extends 
BaseClusterRequest {
 
   private final String quickLinksProfileJson;
 
+  private final List topologyValidators;
+
   private final static Logger LOG = 
LoggerFactory.getLogger(ProvisionClusterRequest.class);
 
   /**
@@ -177,7 +179,7 @@ public class ProvisionClusterRequest extends 
BaseClusterRequest {
 this.securityConfiguration = securityConfiguration;
 
 Configuration configuration = configurationFactory.getConfiguration(
-(Collection>) 
properties.get(CONFIGURATIONS_PROPERTY));
+  (Collection>) 
properties.get(CONFIGURATIONS_PROPERTY));
 configuration.setParentConfiguration(blueprint.getConfiguration());
 setConfiguration(configuration);
 
@@ -191,10 +193,11 @@ public class ProvisionClusterRequest extends 
BaseClusterRequest {
 
 try {
   this.quickLinksProfileJson = processQuickLinksProfile(properties);
-}
-catch (QuickLinksProfileEvaluationException ex) {
+} catch (QuickLinksProfileEvaluationException ex) {
   throw new InvalidTopologyTemplateException("Invalid quick links 
profile", ex);
 }
+
+topologyValidators = ImmutableList.of(new 
RequiredPasswordValidator(defaultPassword), new ClusterConfigTypeValidator());
   }
 
   private String processQuickLinksProfile(Map properties) 
throws QuickLinksProfileEvaluationException {
@@ -269,7 +272,7 @@ public class ProvisionClusterRequest extends 
BaseClusterRequest {
 
   @Override
   public List getTopologyValidators() {
-return Collections.singletonList(new 
RequiredPasswordValidator(d

ambari git commit: BUG-74324 rebalance hdfs custom command supports individual timeout - draft

2017-03-20 Thread lpuskas
Repository: ambari
Updated Branches:
  refs/heads/trunk fd75adfad -> 0c7dd9383


BUG-74324 rebalance hdfs custom command supports individual timeout - draft


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

Branch: refs/heads/trunk
Commit: 0c7dd9383038b53cfe65c21b885fd6e901834821
Parents: fd75adf
Author: lpuskas 
Authored: Wed Feb 22 15:36:08 2017 +0100
Committer: lpuskas 
Committed: Mon Mar 20 17:15:59 2017 +0100

--
 ambari-server/pom.xml   | 22 
 .../AmbariCustomCommandExecutionHelper.java | 11 +-
 .../common-services/HDFS/2.1.0.2.0/metainfo.xml |  1 +
 3 files changed, 33 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/0c7dd938/ambari-server/pom.xml
--
diff --git a/ambari-server/pom.xml b/ambari-server/pom.xml
index 8b4c8d6..cb687e0 100644
--- a/ambari-server/pom.xml
+++ b/ambari-server/pom.xml
@@ -50,9 +50,31 @@
 ALL 
 none 
   
+  
+
+  
+org.apache.maven.plugins
+maven-jxr-plugin
+2.5
+  
+  
+org.apache.maven.plugins
+maven-pmd-plugin
+3.7
+
+true
+
+  
+
+  
   
 
   
+org.apache.maven.plugins
+maven-pmd-plugin
+3.7
+  
+  
 org.codehaus.mojo
 build-helper-maven-plugin
 1.8

http://git-wip-us.apache.org/repos/asf/ambari/blob/0c7dd938/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
index 77d5bf8..db18394 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
@@ -448,7 +448,16 @@ public class AmbariCustomCommandExecutionHelper {
 
   if 
(serviceInfo.getSchemaVersion().equals(AmbariMetaInfo.SCHEMA_VERSION_2)) {
 // Service check command is not custom command
-CommandScriptDefinition script = componentInfo.getCommandScript();
+CommandScriptDefinition script = null;
+
+if (customCommandDefinition != null) {
+  LOG.debug("Getting command script for custom command {}", 
customCommandDefinition.getName());
+  script = customCommandDefinition.getCommandScript();
+} else {
+  LOG.debug("Getting command script for component {}", 
componentInfo.getDisplayName());
+  // Service check command is not custom command
+  script = componentInfo.getCommandScript();
+}
 
 if (script != null) {
   commandParams.put(SCRIPT, script.getScript());

http://git-wip-us.apache.org/repos/asf/ambari/blob/0c7dd938/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/metainfo.xml
--
diff --git 
a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/metainfo.xml 
b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/metainfo.xml
index 3026938..d9b542f 100644
--- 
a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/metainfo.xml
+++ 
b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/metainfo.xml
@@ -102,6 +102,7 @@
   
 scripts/namenode.py
 PYTHON
+1
   
 
   



ambari git commit: Revert "BUG-74324 rebalance hdfs custom command supports individual timeout - draft"

2017-03-20 Thread lpuskas
Repository: ambari
Updated Branches:
  refs/heads/trunk 0c7dd9383 -> f1113a261


Revert "BUG-74324 rebalance hdfs custom command supports individual timeout - 
draft"

This reverts commit 0c7dd9383038b53cfe65c21b885fd6e901834821.


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

Branch: refs/heads/trunk
Commit: f1113a26136a9349cb50aed80de3fe74819ee8b7
Parents: 0c7dd93
Author: lpuskas 
Authored: Mon Mar 20 17:20:30 2017 +0100
Committer: lpuskas 
Committed: Mon Mar 20 17:20:30 2017 +0100

--
 ambari-server/pom.xml   | 22 
 .../AmbariCustomCommandExecutionHelper.java | 11 +-
 .../common-services/HDFS/2.1.0.2.0/metainfo.xml |  1 -
 3 files changed, 1 insertion(+), 33 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/f1113a26/ambari-server/pom.xml
--
diff --git a/ambari-server/pom.xml b/ambari-server/pom.xml
index cb687e0..8b4c8d6 100644
--- a/ambari-server/pom.xml
+++ b/ambari-server/pom.xml
@@ -50,31 +50,9 @@
 ALL 
 none 
   
-  
-
-  
-org.apache.maven.plugins
-maven-jxr-plugin
-2.5
-  
-  
-org.apache.maven.plugins
-maven-pmd-plugin
-3.7
-
-true
-
-  
-
-  
   
 
   
-org.apache.maven.plugins
-maven-pmd-plugin
-3.7
-  
-  
 org.codehaus.mojo
 build-helper-maven-plugin
 1.8

http://git-wip-us.apache.org/repos/asf/ambari/blob/f1113a26/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
index db18394..77d5bf8 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
@@ -448,16 +448,7 @@ public class AmbariCustomCommandExecutionHelper {
 
   if 
(serviceInfo.getSchemaVersion().equals(AmbariMetaInfo.SCHEMA_VERSION_2)) {
 // Service check command is not custom command
-CommandScriptDefinition script = null;
-
-if (customCommandDefinition != null) {
-  LOG.debug("Getting command script for custom command {}", 
customCommandDefinition.getName());
-  script = customCommandDefinition.getCommandScript();
-} else {
-  LOG.debug("Getting command script for component {}", 
componentInfo.getDisplayName());
-  // Service check command is not custom command
-  script = componentInfo.getCommandScript();
-}
+CommandScriptDefinition script = componentInfo.getCommandScript();
 
 if (script != null) {
   commandParams.put(SCRIPT, script.getScript());

http://git-wip-us.apache.org/repos/asf/ambari/blob/f1113a26/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/metainfo.xml
--
diff --git 
a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/metainfo.xml 
b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/metainfo.xml
index d9b542f..3026938 100644
--- 
a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/metainfo.xml
+++ 
b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/metainfo.xml
@@ -102,7 +102,6 @@
   
 scripts/namenode.py
 PYTHON
-1
   
 
   



ambari git commit: AMBARI-20488 Config types are validated before the cluster resources are persisted

2017-03-20 Thread lpuskas
Repository: ambari
Updated Branches:
  refs/heads/trunk f1113a261 -> 403d59324


AMBARI-20488 Config types are validated before the cluster resources are 
persisted


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

Branch: refs/heads/trunk
Commit: 403d59324b8a537337f83274274610963241cf33
Parents: f1113a2
Author: lpuskas 
Authored: Fri Mar 17 17:53:58 2017 +0100
Committer: lpuskas 
Committed: Mon Mar 20 17:23:57 2017 +0100

--
 .../internal/ProvisionClusterRequest.java   |  47 +++---
 .../topology/RequiredPasswordValidator.java | 156 --
 .../validators/ClusterConfigTypeValidator.java  |  76 +
 .../validators/RequiredPasswordValidator.java   | 157 +++
 .../internal/ProvisionClusterRequestTest.java   |  12 +-
 .../topology/RequiredPasswordValidatorTest.java |   1 +
 .../ClusterConfigTypeValidatorTest.java | 110 +
 7 files changed, 375 insertions(+), 184 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/403d5932/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
index 2c8d09a..a63013a 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
@@ -18,7 +18,6 @@
 package org.apache.ambari.server.controller.internal;
 
 import java.util.Collection;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -36,15 +35,17 @@ import org.apache.ambari.server.topology.Credential;
 import org.apache.ambari.server.topology.HostGroupInfo;
 import org.apache.ambari.server.topology.InvalidTopologyTemplateException;
 import org.apache.ambari.server.topology.NoSuchBlueprintException;
-import org.apache.ambari.server.topology.RequiredPasswordValidator;
 import org.apache.ambari.server.topology.SecurityConfiguration;
 import org.apache.ambari.server.topology.TopologyValidator;
+import org.apache.ambari.server.topology.validators.ClusterConfigTypeValidator;
+import org.apache.ambari.server.topology.validators.RequiredPasswordValidator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import com.google.common.base.Enums;
 import com.google.common.base.Optional;
 import com.google.common.base.Strings;
+import com.google.common.collect.ImmutableList;
 
 /**
  * Request for provisioning a cluster.
@@ -118,7 +119,6 @@ public class ProvisionClusterRequest extends 
BaseClusterRequest {
   public static final String QUICKLINKS_PROFILE_SERVICES_PROPERTY = 
"quicklinks_profile/services";
 
 
-
   /**
* configuration factory
*/
@@ -145,6 +145,8 @@ public class ProvisionClusterRequest extends 
BaseClusterRequest {
 
   private final String quickLinksProfileJson;
 
+  private final List topologyValidators;
+
   private final static Logger LOG = 
LoggerFactory.getLogger(ProvisionClusterRequest.class);
 
   /**
@@ -177,7 +179,7 @@ public class ProvisionClusterRequest extends 
BaseClusterRequest {
 this.securityConfiguration = securityConfiguration;
 
 Configuration configuration = configurationFactory.getConfiguration(
-(Collection>) 
properties.get(CONFIGURATIONS_PROPERTY));
+  (Collection>) 
properties.get(CONFIGURATIONS_PROPERTY));
 configuration.setParentConfiguration(blueprint.getConfiguration());
 setConfiguration(configuration);
 
@@ -191,10 +193,11 @@ public class ProvisionClusterRequest extends 
BaseClusterRequest {
 
 try {
   this.quickLinksProfileJson = processQuickLinksProfile(properties);
-}
-catch (QuickLinksProfileEvaluationException ex) {
+} catch (QuickLinksProfileEvaluationException ex) {
   throw new InvalidTopologyTemplateException("Invalid quick links 
profile", ex);
 }
+
+topologyValidators = ImmutableList.of(new 
RequiredPasswordValidator(defaultPassword), new ClusterConfigTypeValidator());
   }
 
   private String processQuickLinksProfile(Map properties) 
throws QuickLinksProfileEvaluationException {
@@ -269,7 +272,7 @@ public class ProvisionClusterRequest extends 
BaseClusterRequest {
 
   @Override
   public List getTopologyValidators() {
-return Collections.singletonList(new 
RequiredPasswordValidator(defaultPassword));
+

ambari git commit: AMBARI-20542 Fixed configuration type validation in case of blueprint deployments.

2017-03-23 Thread lpuskas
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 280b050ef -> 50b192979


AMBARI-20542 Fixed configuration type validation in case of blueprint 
deployments.


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

Branch: refs/heads/branch-2.5
Commit: 50b192979eca936bdb8ea1ecb9a1bb624c28e7fc
Parents: 280b050
Author: lpuskas 
Authored: Thu Mar 23 13:57:58 2017 +0100
Committer: lpuskas 
Committed: Thu Mar 23 13:57:58 2017 +0100

--
 .../validators/ClusterConfigTypeValidator.java  | 19 ++--
 .../ClusterConfigTypeValidatorTest.java | 31 
 2 files changed, 34 insertions(+), 16 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/50b19297/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidator.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidator.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidator.java
index 18d08b9..305c88e 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidator.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidator.java
@@ -44,29 +44,28 @@ public class ClusterConfigTypeValidator implements 
TopologyValidator {
 }
 
 // config types in from the request
-Set clusterConfigTypes = 
topology.getConfiguration().getProperties().keySet();
-LOGGER.debug("Cluster config types: {}", clusterConfigTypes);
+Set topologyClusterConfigTypes = new 
HashSet(topology.getConfiguration().getAllConfigTypes());
+LOGGER.debug("Cluster config types: {}", topologyClusterConfigTypes);
 
-if (clusterConfigTypes == null || clusterConfigTypes.isEmpty()) {
+if (topologyClusterConfigTypes == null || 
topologyClusterConfigTypes.isEmpty()) {
   LOGGER.debug("No config types to be checked.");
   return;
 }
 
 // collecting all config types for services in the blueprint (from the 
related stack)
-Set serviceConfigTypes = new HashSet<>();
+Set stackServiceConfigTypes = new HashSet<>();
 for (String serviceName : topology.getBlueprint().getServices()) {
-  
serviceConfigTypes.addAll(topology.getBlueprint().getStack().getConfigurationTypes(serviceName));
+  
stackServiceConfigTypes.addAll(topology.getBlueprint().getStack().getConfigurationTypes(serviceName));
 }
 
 // identifying invalid config types
-Set configTypeIntersection = new 
HashSet(serviceConfigTypes);
+Set configTypeIntersection = new 
HashSet(topologyClusterConfigTypes);
 
-// if the intersection is changed, there's been some wrong config type 
provided in the cluster configuration
-if (configTypeIntersection.retainAll(clusterConfigTypes)) {
-  LOGGER.debug("Valid config types: {}", configTypeIntersection);
+if (configTypeIntersection.retainAll(stackServiceConfigTypes)) {
+  // there are config types not present in the stack for the services 
listed in the blueprint
 
   // get the wrong  config types
-  Set invalidConfigTypes = new HashSet<>(clusterConfigTypes);
+  Set invalidConfigTypes = new 
HashSet<>(topologyClusterConfigTypes);
   invalidConfigTypes.removeAll(configTypeIntersection);
 
   LOGGER.error("The following config typess are wrong: {}", 
invalidConfigTypes);

http://git-wip-us.apache.org/repos/asf/ambari/blob/50b19297/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidatorTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidatorTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidatorTest.java
index 24fa8b8..bb10df9 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidatorTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidatorTest.java
@@ -74,8 +74,19 @@ public class ClusterConfigTypeValidatorTest extends 
EasyMockSupport {
 resetAll();
   }
 
+
+  @Test
+  public void testShouldValidationPassIfNoConfigTypesSpecifiedInCCTemplate() 
throws Exception {
+//GIVEN
+
EasyMock.expect(clusterConfigurationMapMock.keySet()).andReturn(Collections.emp

ambari git commit: AMBARI-20542 Fixed configuration type validation in case of blueprint deployments.

2017-03-23 Thread lpuskas
Repository: ambari
Updated Branches:
  refs/heads/trunk ad8767063 -> 549783cde


AMBARI-20542 Fixed configuration type validation in case of blueprint 
deployments.


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

Branch: refs/heads/trunk
Commit: 549783cde2ce8abb3aca055eb2de5da28e92f344
Parents: ad87670
Author: lpuskas 
Authored: Thu Mar 23 13:57:58 2017 +0100
Committer: lpuskas 
Committed: Thu Mar 23 17:01:27 2017 +0100

--
 .../validators/ClusterConfigTypeValidator.java  | 19 ++--
 .../ClusterConfigTypeValidatorTest.java | 31 
 2 files changed, 34 insertions(+), 16 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/549783cd/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidator.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidator.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidator.java
index 18d08b9..305c88e 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidator.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidator.java
@@ -44,29 +44,28 @@ public class ClusterConfigTypeValidator implements 
TopologyValidator {
 }
 
 // config types in from the request
-Set clusterConfigTypes = 
topology.getConfiguration().getProperties().keySet();
-LOGGER.debug("Cluster config types: {}", clusterConfigTypes);
+Set topologyClusterConfigTypes = new 
HashSet(topology.getConfiguration().getAllConfigTypes());
+LOGGER.debug("Cluster config types: {}", topologyClusterConfigTypes);
 
-if (clusterConfigTypes == null || clusterConfigTypes.isEmpty()) {
+if (topologyClusterConfigTypes == null || 
topologyClusterConfigTypes.isEmpty()) {
   LOGGER.debug("No config types to be checked.");
   return;
 }
 
 // collecting all config types for services in the blueprint (from the 
related stack)
-Set serviceConfigTypes = new HashSet<>();
+Set stackServiceConfigTypes = new HashSet<>();
 for (String serviceName : topology.getBlueprint().getServices()) {
-  
serviceConfigTypes.addAll(topology.getBlueprint().getStack().getConfigurationTypes(serviceName));
+  
stackServiceConfigTypes.addAll(topology.getBlueprint().getStack().getConfigurationTypes(serviceName));
 }
 
 // identifying invalid config types
-Set configTypeIntersection = new 
HashSet(serviceConfigTypes);
+Set configTypeIntersection = new 
HashSet(topologyClusterConfigTypes);
 
-// if the intersection is changed, there's been some wrong config type 
provided in the cluster configuration
-if (configTypeIntersection.retainAll(clusterConfigTypes)) {
-  LOGGER.debug("Valid config types: {}", configTypeIntersection);
+if (configTypeIntersection.retainAll(stackServiceConfigTypes)) {
+  // there are config types not present in the stack for the services 
listed in the blueprint
 
   // get the wrong  config types
-  Set invalidConfigTypes = new HashSet<>(clusterConfigTypes);
+  Set invalidConfigTypes = new 
HashSet<>(topologyClusterConfigTypes);
   invalidConfigTypes.removeAll(configTypeIntersection);
 
   LOGGER.error("The following config typess are wrong: {}", 
invalidConfigTypes);

http://git-wip-us.apache.org/repos/asf/ambari/blob/549783cd/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidatorTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidatorTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidatorTest.java
index 24fa8b8..bb10df9 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidatorTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidatorTest.java
@@ -74,8 +74,19 @@ public class ClusterConfigTypeValidatorTest extends 
EasyMockSupport {
 resetAll();
   }
 
+
+  @Test
+  public void testShouldValidationPassIfNoConfigTypesSpecifiedInCCTemplate() 
throws Exception {
+//GIVEN
+
EasyMock.expect(clusterConfigurationMapMock.keySet()).andReturn(Collections.emp

[2/2] ambari git commit: Revert "AMBARI-20488 Config types are validated before the cluster resources are persisted"

2017-03-23 Thread lpuskas
Revert "AMBARI-20488 Config types are validated before the cluster resources 
are persisted"

This reverts commit 7cbad939f6cf3ebdde59c3829672683f334dd32b.


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

Branch: refs/heads/branch-2.5
Commit: 7bb1e3335d41ab7adaf0c66ae5fd8df454178cd7
Parents: 95d7cc2
Author: lpuskas 
Authored: Thu Mar 23 18:14:05 2017 +0100
Committer: lpuskas 
Committed: Thu Mar 23 18:14:05 2017 +0100

--
 .../internal/ProvisionClusterRequest.java   |  47 +++---
 .../topology/RequiredPasswordValidator.java | 156 ++
 .../validators/ClusterConfigTypeValidator.java  |  76 -
 .../validators/RequiredPasswordValidator.java   | 161 ---
 .../internal/ProvisionClusterRequestTest.java   |  12 +-
 .../topology/RequiredPasswordValidatorTest.java |  23 ++-
 .../ClusterConfigTypeValidatorTest.java | 110 -
 7 files changed, 195 insertions(+), 390 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/7bb1e333/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
index a63013a..2c8d09a 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
@@ -18,6 +18,7 @@
 package org.apache.ambari.server.controller.internal;
 
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -35,17 +36,15 @@ import org.apache.ambari.server.topology.Credential;
 import org.apache.ambari.server.topology.HostGroupInfo;
 import org.apache.ambari.server.topology.InvalidTopologyTemplateException;
 import org.apache.ambari.server.topology.NoSuchBlueprintException;
+import org.apache.ambari.server.topology.RequiredPasswordValidator;
 import org.apache.ambari.server.topology.SecurityConfiguration;
 import org.apache.ambari.server.topology.TopologyValidator;
-import org.apache.ambari.server.topology.validators.ClusterConfigTypeValidator;
-import org.apache.ambari.server.topology.validators.RequiredPasswordValidator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import com.google.common.base.Enums;
 import com.google.common.base.Optional;
 import com.google.common.base.Strings;
-import com.google.common.collect.ImmutableList;
 
 /**
  * Request for provisioning a cluster.
@@ -119,6 +118,7 @@ public class ProvisionClusterRequest extends 
BaseClusterRequest {
   public static final String QUICKLINKS_PROFILE_SERVICES_PROPERTY = 
"quicklinks_profile/services";
 
 
+
   /**
* configuration factory
*/
@@ -145,8 +145,6 @@ public class ProvisionClusterRequest extends 
BaseClusterRequest {
 
   private final String quickLinksProfileJson;
 
-  private final List topologyValidators;
-
   private final static Logger LOG = 
LoggerFactory.getLogger(ProvisionClusterRequest.class);
 
   /**
@@ -179,7 +177,7 @@ public class ProvisionClusterRequest extends 
BaseClusterRequest {
 this.securityConfiguration = securityConfiguration;
 
 Configuration configuration = configurationFactory.getConfiguration(
-  (Collection>) 
properties.get(CONFIGURATIONS_PROPERTY));
+(Collection>) 
properties.get(CONFIGURATIONS_PROPERTY));
 configuration.setParentConfiguration(blueprint.getConfiguration());
 setConfiguration(configuration);
 
@@ -193,11 +191,10 @@ public class ProvisionClusterRequest extends 
BaseClusterRequest {
 
 try {
   this.quickLinksProfileJson = processQuickLinksProfile(properties);
-} catch (QuickLinksProfileEvaluationException ex) {
+}
+catch (QuickLinksProfileEvaluationException ex) {
   throw new InvalidTopologyTemplateException("Invalid quick links 
profile", ex);
 }
-
-topologyValidators = ImmutableList.of(new 
RequiredPasswordValidator(defaultPassword), new ClusterConfigTypeValidator());
   }
 
   private String processQuickLinksProfile(Map properties) 
throws QuickLinksProfileEvaluationException {
@@ -272,7 +269,7 @@ public class ProvisionClusterRequest extends 
BaseClusterRequest {
 
   @Override
   public List getTopologyValidators() {
-return topologyValidators;
+return Collections.singletonList(new 
Requi

[1/2] ambari git commit: Revert "AMBARI-20542 Fixed configuration type validation in case of blueprint deployments."

2017-03-23 Thread lpuskas
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 50b192979 -> 7bb1e3335


Revert "AMBARI-20542 Fixed configuration type validation in case of blueprint 
deployments."

This reverts commit 50b192979eca936bdb8ea1ecb9a1bb624c28e7fc.


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

Branch: refs/heads/branch-2.5
Commit: 95d7cc2c000c350dc0e5efa5a0660098f21da547
Parents: 50b1929
Author: lpuskas 
Authored: Thu Mar 23 18:13:08 2017 +0100
Committer: lpuskas 
Committed: Thu Mar 23 18:13:08 2017 +0100

--
 .../validators/ClusterConfigTypeValidator.java  | 19 ++--
 .../ClusterConfigTypeValidatorTest.java | 31 
 2 files changed, 16 insertions(+), 34 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/95d7cc2c/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidator.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidator.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidator.java
index 305c88e..18d08b9 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidator.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidator.java
@@ -44,28 +44,29 @@ public class ClusterConfigTypeValidator implements 
TopologyValidator {
 }
 
 // config types in from the request
-Set topologyClusterConfigTypes = new 
HashSet(topology.getConfiguration().getAllConfigTypes());
-LOGGER.debug("Cluster config types: {}", topologyClusterConfigTypes);
+Set clusterConfigTypes = 
topology.getConfiguration().getProperties().keySet();
+LOGGER.debug("Cluster config types: {}", clusterConfigTypes);
 
-if (topologyClusterConfigTypes == null || 
topologyClusterConfigTypes.isEmpty()) {
+if (clusterConfigTypes == null || clusterConfigTypes.isEmpty()) {
   LOGGER.debug("No config types to be checked.");
   return;
 }
 
 // collecting all config types for services in the blueprint (from the 
related stack)
-Set stackServiceConfigTypes = new HashSet<>();
+Set serviceConfigTypes = new HashSet<>();
 for (String serviceName : topology.getBlueprint().getServices()) {
-  
stackServiceConfigTypes.addAll(topology.getBlueprint().getStack().getConfigurationTypes(serviceName));
+  
serviceConfigTypes.addAll(topology.getBlueprint().getStack().getConfigurationTypes(serviceName));
 }
 
 // identifying invalid config types
-Set configTypeIntersection = new 
HashSet(topologyClusterConfigTypes);
+Set configTypeIntersection = new 
HashSet(serviceConfigTypes);
 
-if (configTypeIntersection.retainAll(stackServiceConfigTypes)) {
-  // there are config types not present in the stack for the services 
listed in the blueprint
+// if the intersection is changed, there's been some wrong config type 
provided in the cluster configuration
+if (configTypeIntersection.retainAll(clusterConfigTypes)) {
+  LOGGER.debug("Valid config types: {}", configTypeIntersection);
 
   // get the wrong  config types
-  Set invalidConfigTypes = new 
HashSet<>(topologyClusterConfigTypes);
+  Set invalidConfigTypes = new HashSet<>(clusterConfigTypes);
   invalidConfigTypes.removeAll(configTypeIntersection);
 
   LOGGER.error("The following config typess are wrong: {}", 
invalidConfigTypes);

http://git-wip-us.apache.org/repos/asf/ambari/blob/95d7cc2c/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidatorTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidatorTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidatorTest.java
index bb10df9..24fa8b8 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidatorTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidatorTest.java
@@ -74,19 +74,8 @@ public class ClusterConfigTypeValidatorTest extends 
EasyMockSupport {
 resetAll();
   }
 
-
-  @Test
-  public void testShouldValidationPassIfNoConfigTypesSpecifiedInCCTemplate() 
throws Exception {
-//GIVE

ambari git commit: AMBARI-20319 Server startup script keeps waiting even if DB consistency has failed

2017-03-07 Thread lpuskas
Repository: ambari
Updated Branches:
  refs/heads/trunk e6dcdf633 -> c21f77dfb


AMBARI-20319 Server startup script keeps waiting even if DB consistency has 
failed


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

Branch: refs/heads/trunk
Commit: c21f77dfb6ca4fdd012af4313696eabcc11c1fbc
Parents: e6dcdf6
Author: Balazs Bence Sari 
Authored: Tue Mar 7 11:30:12 2017 +0100
Committer: lpuskas 
Committed: Tue Mar 7 12:04:04 2017 +0100

--
 .../ambari/server/controller/AmbariServer.java  |  4 +++
 .../src/main/python/ambari_server/utils.py  | 14 +++---
 .../src/main/python/ambari_server_main.py   | 28 +---
 3 files changed, 32 insertions(+), 14 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/c21f77df/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
index 9540ca3..a2441bd 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
@@ -1072,6 +1072,10 @@ public class AmbariServer {
   ComponentSSLConfiguration.instance().init(server.configs);
   server.run();
 } catch (Throwable t) {
+  // Writing to system console is needed because loggers may not get 
flushed on exit and diagnostic information
+  // may get lost.
+  System.err.println("An unexpected error occured during starting Ambari 
Server.");
+  t.printStackTrace();
   LOG.error("Failed to run the Ambari Server", t);
   if (server != null) {
 server.stop();

http://git-wip-us.apache.org/repos/asf/ambari/blob/c21f77df/ambari-server/src/main/python/ambari_server/utils.py
--
diff --git a/ambari-server/src/main/python/ambari_server/utils.py 
b/ambari-server/src/main/python/ambari_server/utils.py
index 6408285..b51e37e 100644
--- a/ambari-server/src/main/python/ambari_server/utils.py
+++ b/ambari-server/src/main/python/ambari_server/utils.py
@@ -122,7 +122,10 @@ def save_pid(pid, pidfile):
 
 def save_main_pid_ex(pids, pidfile, exclude_list=[], skip_daemonize=False):
   """
-Save pid which is not included to exclude_list to pidfile.
+Saves and returns the first (and supposingly only) pid from the list of 
pids
+which is not included in the exclude_list.
+
+pidfile is the name of the file to save the pid to
 
 exclude_list contains list of full executable paths which should be 
excluded
   """
@@ -133,7 +136,7 @@ def save_main_pid_ex(pids, pidfile, exclude_list=[], 
skip_daemonize=False):
   for item in pids:
 if pid_exists(item["pid"]) and (item["exe"] not in exclude_list):
   pfile.write("%s\n" % item["pid"])
-  pid_saved = True
+  pid_saved = item["pid"]
   logger.info("Ambari server started with PID " + str(item["pid"]))
 if pid_exists(item["pid"]) and (item["exe"] in exclude_list) and not 
skip_daemonize:
   try:
@@ -157,7 +160,7 @@ def get_live_pids_count(pids):
   """
   return len([pid for pid in pids if pid_exists(pid)])
 
-def wait_for_ui_start(ambari_server_ui_port, timeout=1):
+def wait_for_ui_start(ambari_server_ui_port, pid, timeout=1):
 
   tstart = time.time()
   while int(time.time()-tstart) <= timeout:
@@ -173,7 +176,10 @@ def wait_for_ui_start(ambari_server_ui_port, timeout=1):
 
 sys.stdout.write('.')
 sys.stdout.flush()
-time.sleep(1)
+if pid_exists(pid):
+  time.sleep(1)
+else:
+  break
 
   return False
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/c21f77df/ambari-server/src/main/python/ambari_server_main.py
--
diff --git a/ambari-server/src/main/python/ambari_server_main.py 
b/ambari-server/src/main/python/ambari_server_main.py
index 0cd19cc..0eb4243 100644
--- a/ambari-server/src/main/python/ambari_server_main.py
+++ b/ambari-server/src/main/python/ambari_server_main.py
@@ -21,6 +21,7 @@ import os
 import subprocess
 import sys
 import logging
+import time
 
 from ambari_commons.exceptions import FatalException
 from ambari_commons.logging_utils import get_debug_mode, print_warning

ambari git commit: AMBARI-20319 Server startup script keeps waiting even if DB consistency has failed

2017-03-07 Thread lpuskas
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 b9451a4b8 -> 4df38c35f


AMBARI-20319 Server startup script keeps waiting even if DB consistency has 
failed


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

Branch: refs/heads/branch-2.5
Commit: 4df38c35f42a632dd822c6c59e4e520f6caad8fd
Parents: b9451a4
Author: Balazs Bence Sari 
Authored: Tue Mar 7 11:30:12 2017 +0100
Committer: lpuskas 
Committed: Tue Mar 7 13:32:28 2017 +0100

--
 .../ambari/server/controller/AmbariServer.java  |  4 +++
 .../src/main/python/ambari_server/utils.py  | 14 +++---
 .../src/main/python/ambari_server_main.py   | 28 +---
 3 files changed, 32 insertions(+), 14 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/4df38c35/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
index b5acdce..17d9695 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
@@ -1004,6 +1004,10 @@ public class AmbariServer {
   ComponentSSLConfiguration.instance().init(server.configs);
   server.run();
 } catch (Throwable t) {
+  // Writing to system console is needed because loggers may not get 
flushed on exit and diagnostic information
+  // may get lost.
+  System.err.println("An unexpected error occured during starting Ambari 
Server.");
+  t.printStackTrace();
   LOG.error("Failed to run the Ambari Server", t);
   if (server != null) {
 server.stop();

http://git-wip-us.apache.org/repos/asf/ambari/blob/4df38c35/ambari-server/src/main/python/ambari_server/utils.py
--
diff --git a/ambari-server/src/main/python/ambari_server/utils.py 
b/ambari-server/src/main/python/ambari_server/utils.py
index 6408285..b51e37e 100644
--- a/ambari-server/src/main/python/ambari_server/utils.py
+++ b/ambari-server/src/main/python/ambari_server/utils.py
@@ -122,7 +122,10 @@ def save_pid(pid, pidfile):
 
 def save_main_pid_ex(pids, pidfile, exclude_list=[], skip_daemonize=False):
   """
-Save pid which is not included to exclude_list to pidfile.
+Saves and returns the first (and supposingly only) pid from the list of 
pids
+which is not included in the exclude_list.
+
+pidfile is the name of the file to save the pid to
 
 exclude_list contains list of full executable paths which should be 
excluded
   """
@@ -133,7 +136,7 @@ def save_main_pid_ex(pids, pidfile, exclude_list=[], 
skip_daemonize=False):
   for item in pids:
 if pid_exists(item["pid"]) and (item["exe"] not in exclude_list):
   pfile.write("%s\n" % item["pid"])
-  pid_saved = True
+  pid_saved = item["pid"]
   logger.info("Ambari server started with PID " + str(item["pid"]))
 if pid_exists(item["pid"]) and (item["exe"] in exclude_list) and not 
skip_daemonize:
   try:
@@ -157,7 +160,7 @@ def get_live_pids_count(pids):
   """
   return len([pid for pid in pids if pid_exists(pid)])
 
-def wait_for_ui_start(ambari_server_ui_port, timeout=1):
+def wait_for_ui_start(ambari_server_ui_port, pid, timeout=1):
 
   tstart = time.time()
   while int(time.time()-tstart) <= timeout:
@@ -173,7 +176,10 @@ def wait_for_ui_start(ambari_server_ui_port, timeout=1):
 
 sys.stdout.write('.')
 sys.stdout.flush()
-time.sleep(1)
+if pid_exists(pid):
+  time.sleep(1)
+else:
+  break
 
   return False
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/4df38c35/ambari-server/src/main/python/ambari_server_main.py
--
diff --git a/ambari-server/src/main/python/ambari_server_main.py 
b/ambari-server/src/main/python/ambari_server_main.py
index 0cd19cc..0eb4243 100644
--- a/ambari-server/src/main/python/ambari_server_main.py
+++ b/ambari-server/src/main/python/ambari_server_main.py
@@ -21,6 +21,7 @@ import os
 import subprocess
 import sys
 import logging
+import time
 
 from ambari_commons.exceptions import FatalException
 from ambari_commons.logging_utils import get_debug_mode, print_

ambari git commit: AMBARI-20542 Fixed configuration type validation in case of blueprint deployments (unit tests added, removed unnecessary NP checks).

2017-03-27 Thread lpuskas
Repository: ambari
Updated Branches:
  refs/heads/trunk b7d5ef70a -> fb153e3e9


AMBARI-20542 Fixed configuration type validation in case of blueprint 
deployments (unit tests added, removed unnecessary NP checks).


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

Branch: refs/heads/trunk
Commit: fb153e3e9ea9cafafb2c793d6ca2fa56da0a8533
Parents: b7d5ef7
Author: lpuskas 
Authored: Mon Mar 27 13:03:29 2017 +0200
Committer: lpuskas 
Committed: Mon Mar 27 13:03:29 2017 +0200

--
 .../validators/ClusterConfigTypeValidator.java  | 14 +---
 .../ClusterConfigTypeValidatorTest.java | 70 ++--
 2 files changed, 52 insertions(+), 32 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/fb153e3e/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidator.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidator.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidator.java
index 305c88e..634ab08 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidator.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidator.java
@@ -33,21 +33,11 @@ public class ClusterConfigTypeValidator implements 
TopologyValidator {
   @Override
   public void validate(ClusterTopology topology) throws 
InvalidTopologyException {
 
-if (topology.getConfiguration() == null) {
-  LOGGER.debug("No configuration is set into the topology");
-  return;
-}
-
-if (topology.getConfiguration().getProperties() == null) {
-  LOGGER.debug("No properties is set into the topology configuration");
-  return;
-}
-
-// config types in from the request
+// config types in from the request / configuration is always set in the 
request instance
 Set topologyClusterConfigTypes = new 
HashSet(topology.getConfiguration().getAllConfigTypes());
 LOGGER.debug("Cluster config types: {}", topologyClusterConfigTypes);
 
-if (topologyClusterConfigTypes == null || 
topologyClusterConfigTypes.isEmpty()) {
+if (topologyClusterConfigTypes.isEmpty()) {
   LOGGER.debug("No config types to be checked.");
   return;
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/fb153e3e/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidatorTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidatorTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidatorTest.java
index bb10df9..a701507 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidatorTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidatorTest.java
@@ -17,7 +17,7 @@ package org.apache.ambari.server.topology.validators;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashSet;
-import java.util.Map;
+import java.util.Set;
 
 import org.apache.ambari.server.controller.internal.Stack;
 import org.apache.ambari.server.topology.Blueprint;
@@ -41,14 +41,10 @@ public class ClusterConfigTypeValidatorTest extends 
EasyMockSupport {
   @Rule
   public EasyMockRule mocks = new EasyMockRule(this);
 
-
   @Mock
   private Configuration clusterConfigurationMock;
 
   @Mock
-  private Map> clusterConfigurationMapMock;
-
-  @Mock
   private Blueprint blueprintMock;
 
   @Mock
@@ -57,13 +53,14 @@ public class ClusterConfigTypeValidatorTest extends 
EasyMockSupport {
   @Mock
   private ClusterTopology clusterTopologyMock;
 
+  private Set clusterRequestConfigTypes;
+
   @TestSubject
   private ClusterConfigTypeValidator clusterConfigTypeValidator = new 
ClusterConfigTypeValidator();
 
   @Before
   public void before() {
 
EasyMock.expect(clusterTopologyMock.getConfiguration()).andReturn(clusterConfigurationMock).anyTimes();
-
EasyMock.expect(clusterConfigurationMock.getProperties()).andReturn(clusterConfigurationMapMock).anyTimes();
 
 
EasyMock.expect(clusterTopologyMock.getBlueprint()).andReturn(blueprintMock).anyTimes();
 EasyMock.expect(blueprintMock.getStack()).andReturn(stackMock).anyTimes();
@@ -76,38 +73,71 @@ public class ClusterCo

ambari git commit: AMBARI-20594 Added hive service validator impelemtation to signal invalid blueprint / cluster template

2017-03-28 Thread lpuskas
Repository: ambari
Updated Branches:
  refs/heads/trunk 993cd02a9 -> fa6aa0782


AMBARI-20594 Added hive service validator impelemtation to signal invalid 
blueprint / cluster template


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

Branch: refs/heads/trunk
Commit: fa6aa0782e973ff975c7a6b69b410d7a3c5204d4
Parents: 993cd02
Author: lpuskas 
Authored: Mon Mar 27 20:31:31 2017 +0200
Committer: lpuskas 
Committed: Tue Mar 28 16:23:40 2017 +0200

--
 .../internal/ProvisionClusterRequest.java   |   4 +-
 .../validators/HiveServiceValidator.java|  70 
 .../internal/ProvisionClusterRequestTest.java   |  10 +-
 .../validators/HiveServiceValidatorTest.java| 158 +++
 4 files changed, 236 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/fa6aa078/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
index a63013a..1a14b01 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java
@@ -38,6 +38,7 @@ import 
org.apache.ambari.server.topology.NoSuchBlueprintException;
 import org.apache.ambari.server.topology.SecurityConfiguration;
 import org.apache.ambari.server.topology.TopologyValidator;
 import org.apache.ambari.server.topology.validators.ClusterConfigTypeValidator;
+import org.apache.ambari.server.topology.validators.HiveServiceValidator;
 import org.apache.ambari.server.topology.validators.RequiredPasswordValidator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -197,7 +198,8 @@ public class ProvisionClusterRequest extends 
BaseClusterRequest {
   throw new InvalidTopologyTemplateException("Invalid quick links 
profile", ex);
 }
 
-topologyValidators = ImmutableList.of(new 
RequiredPasswordValidator(defaultPassword), new ClusterConfigTypeValidator());
+topologyValidators = ImmutableList.of(new 
RequiredPasswordValidator(defaultPassword),
+  new ClusterConfigTypeValidator(), new HiveServiceValidator());
   }
 
   private String processQuickLinksProfile(Map properties) 
throws QuickLinksProfileEvaluationException {

http://git-wip-us.apache.org/repos/asf/ambari/blob/fa6aa078/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/HiveServiceValidator.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/HiveServiceValidator.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/HiveServiceValidator.java
new file mode 100644
index 000..1351739
--- /dev/null
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/validators/HiveServiceValidator.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed 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.topology.validators;
+
+import org.apache.ambari.server.topology.ClusterTopology;
+import org.apache.ambari.server.topology.Configuration;
+import org.apache.ambari.server.topology.InvalidTopologyException;
+import org.apache.ambari.server.topology.TopologyValidator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Validates hive service related setup before provisioning the cluster.
+ */
+public class HiveServiceValidator implements TopologyValidator {
+
+  private static final Logger LOGGER = 
LoggerFactory.getLogger(HiveServiceValidator.class);
+  private static final String HIVE_ENV = "hive-env";
+  private static final String HIVE_DB_DEFAULT = "New MySQL Database";
+  private static final String HIVE_DB_PROPERTY = "hive_database";
+  private static 

[15/33] ambari git commit: AMBARI-21307 AddedLDAP configuration provider for loading and maintaining the LDAP configuration in the application

2017-10-13 Thread lpuskas
AMBARI-21307 AddedLDAP configuration provider for loading and maintaining the 
LDAP configuration in the application


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: a5397e2b91515bc75242112b13bdfd11715b2b24
Parents: 176356b
Author: lpuskas 
Authored: Tue Aug 29 14:55:09 2017 +0200
Committer: lpuskas 
Committed: Fri Oct 13 17:20:50 2017 +0200

--
 .../services/ldap/LdapConfigurationService.java |   1 +
 .../AmbariConfigurationResourceProvider.java|  35 +-
 .../ambari/server/events/AmbariEvent.java   |  11 +-
 .../events/AmbariLdapConfigChangedEvent.java|  37 ++
 .../server/ldap/LdapConfigurationFactory.java   |   2 +-
 .../apache/ambari/server/ldap/LdapModule.java   |   3 +
 .../AmbariLdapConfigurationProvider.java| 114 +++
 .../server/ldap/service/AmbariLdapFacade.java   |   7 +-
 .../server/orm/dao/AmbariConfigurationDAO.java  |  48 
 .../orm/entities/AmbariConfigurationEntity.java |   4 +-
 .../DefaultLdapConfigurationServiceTest.java|  10 +-
 11 files changed, 260 insertions(+), 12 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/a5397e2b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
index fc6bd41..1b8427b 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
@@ -82,6 +82,7 @@ public class LdapConfigurationService extends 
AmbariConfigurationService {
   @Produces(MediaType.APPLICATION_JSON)
   public Response validateConfiguration(LdapConfigurationRequest 
ldapConfigurationRequest) {
 
+// check if the user is authorized to perform the operation
 authorize();
 
 Set groups = Sets.newHashSet();

http://git-wip-us.apache.org/repos/asf/ambari/blob/a5397e2b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariConfigurationResourceProvider.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariConfigurationResourceProvider.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariConfigurationResourceProvider.java
index 2302d8b..4f4cc70 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariConfigurationResourceProvider.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariConfigurationResourceProvider.java
@@ -35,6 +35,9 @@ import 
org.apache.ambari.server.controller.spi.ResourceAlreadyExistsException;
 import org.apache.ambari.server.controller.spi.SystemException;
 import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
 import org.apache.ambari.server.controller.utilities.PredicateHelper;
+import org.apache.ambari.server.events.AmbariEvent;
+import org.apache.ambari.server.events.AmbariLdapConfigChangedEvent;
+import org.apache.ambari.server.events.publishers.AmbariEventPublisher;
 import org.apache.ambari.server.orm.dao.AmbariConfigurationDAO;
 import org.apache.ambari.server.orm.entities.AmbariConfigurationEntity;
 import org.apache.ambari.server.orm.entities.ConfigurationBaseEntity;
@@ -113,6 +116,10 @@ public class AmbariConfigurationResourceProvider extends 
AbstractAuthorizedResou
   @Inject
   private AmbariConfigurationDAO ambariConfigurationDAO;
 
+  @Inject
+  private AmbariEventPublisher publisher;
+
+
   private Gson gson;
 
   @AssistedInject
@@ -142,7 +149,18 @@ public class AmbariConfigurationResourceProvider extends 
AbstractAuthorizedResou
 }
 
 LOGGER.info("Persisting new ambari configuration: {} ", 
ambariConfigurationEntity);
-ambariConfigurationDAO.create(ambariConfigurationEntity);
+
+try {
+  ambariConfigurationDAO.create(ambariConfigurationEntity);
+} catch (Exception e) {
+  LOGGER.error("Failed to create resource", e);
+  throw new ResourceAlreadyExistsException(e.getMessage());
+}
+
+// todo filter by configuration type
+// notify subscribers about the configuration changes
+publisher.publish(new 
AmbariLdapConfigChangedEvent(AmbariEvent.AmbariEventType

[03/33] ambari git commit: AMBARI-22230 Hosts and Alerts tables UI tweaks. (atkach)

2017-10-13 Thread lpuskas
AMBARI-22230 Hosts and Alerts tables UI tweaks. (atkach)


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 8f53bc453c47a4f95d5e58825feb77d69e6a6a22
Parents: a8ba5e6
Author: Andrii Tkach 
Authored: Fri Oct 13 13:45:06 2017 +0300
Committer: Andrii Tkach 
Committed: Fri Oct 13 13:45:06 2017 +0300

--
 ambari-web/app/models/alerts/alert_group.js |   2 +-
 ambari-web/app/styles/application.less  |   5 +
 ambari-web/app/styles/dashboard.less|   6 +-
 .../app/styles/theme/bootstrap-ambari.css   |   3 +-
 ambari-web/app/templates/main/alerts.hbs|   3 +-
 .../main/alerts/alert_definitions_actions.hbs   |   2 +-
 ambari-web/app/templates/main/dashboard.hbs |   2 +-
 .../templates/main/dashboard/config_history.hbs |   2 +-
 ambari-web/app/templates/main/host.hbs  |   2 +-
 .../templates/main/host/bulk_operation_menu.hbs | 132 ++-
 .../views/main/host/hosts_table_menu_view.js|   4 +-
 .../app/views/main/host/stack_versions_view.js  |   2 +-
 .../test/models/alerts/alert_group_test.js  |   5 +-
 13 files changed, 93 insertions(+), 77 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/8f53bc45/ambari-web/app/models/alerts/alert_group.js
--
diff --git a/ambari-web/app/models/alerts/alert_group.js 
b/ambari-web/app/models/alerts/alert_group.js
index 49a850f..3277fc8 100644
--- a/ambari-web/app/models/alerts/alert_group.js
+++ b/ambari-web/app/models/alerts/alert_group.js
@@ -55,7 +55,7 @@ App.AlertGroup = DS.Model.extend({
* @type {string}
*/
   displayName: function () {
-var name = App.config.truncateGroupName(this.get('name'));
+var name = App.config.truncateGroupName(App.format.role(this.get('name'), 
true));
 return this.get('default') ? name + ' Default' : name;
   }.property('name', 'default'),
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/8f53bc45/ambari-web/app/styles/application.less
--
diff --git a/ambari-web/app/styles/application.less 
b/ambari-web/app/styles/application.less
index 7c9cc8e..099f3cf 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -2802,4 +2802,9 @@ a.abort-icon:hover {
 .breadcrumbs-forward-slash {
   display: inline;
   color: #D2D3D5;
+}
+
+.container-wrap-table {
+  padding: 0 10px;
+  background-color: @diff-background-equal;
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/8f53bc45/ambari-web/app/styles/dashboard.less
--
diff --git a/ambari-web/app/styles/dashboard.less 
b/ambari-web/app/styles/dashboard.less
index 02835bd..6deb30c 100644
--- a/ambari-web/app/styles/dashboard.less
+++ b/ambari-web/app/styles/dashboard.less
@@ -18,14 +18,12 @@
 
 @import 'common.less';
 
-#dashboard-widgets-container{
-  .tabs-left {
-float: left;
-  }
+#dashboard-widgets-container {
   .btn-toolbar {
 float: right;
 padding-top: 5px;
 margin-bottom: 20px;
+margin-top: -60px;
   }
   .dashboard-widgets-box {
 clear: both;

http://git-wip-us.apache.org/repos/asf/ambari/blob/8f53bc45/ambari-web/app/styles/theme/bootstrap-ambari.css
--
diff --git a/ambari-web/app/styles/theme/bootstrap-ambari.css 
b/ambari-web/app/styles/theme/bootstrap-ambari.css
index 70579e7..cff73ad 100644
--- a/ambari-web/app/styles/theme/bootstrap-ambari.css
+++ b/ambari-web/app/styles/theme/bootstrap-ambari.css
@@ -479,11 +479,12 @@ h2.table-title {
 }
 .nav.nav-tabs li a .badge.badge-important {
   display: inline;
+  vertical-align: baseline;
 }
 .nav.nav-tabs li.active a {
   color: #333;
   border-bottom: 3px solid #3FAE2A;
-  padding-bottom: 1px;
+  padding-bottom: 2px;
 }
 .nav-tabs-left li,
 .nav-tabs-right li {

http://git-wip-us.apache.org/repos/asf/ambari/blob/8f53bc45/ambari-web/app/templates/main/alerts.hbs
--
diff --git a/ambari-web/app/templates/main/alerts.hbs 
b/ambari-web/app/templates/main/alerts.hbs
index 40469d3..0f85e27 100644
--- a/ambari-web/app/templates/main/alerts.hbs
+++ b/ambari-web/app/templates/main/alerts.hbs
@@ -16,7 +16,7 @@
 * limitations under the License.
 }}
 
-
+
   
 {{t menu.item.alerts}}
 
@@ -56,7 +56,6 @@
   {{view App.AlertDefinitionSummary 
contentBinding="alertDefinition"}}
 
 
- 

[29/33] ambari git commit: AMBARI-21307 Added unit test for the LdapFacade

2017-10-13 Thread lpuskas
AMBARI-21307 Added unit test for the LdapFacade


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 2f059df32d74fbc32385838ff459eac481069647
Parents: 060b85c
Author: lpuskas 
Authored: Thu Oct 12 16:53:31 2017 +0200
Committer: lpuskas 
Committed: Fri Oct 13 17:20:53 2017 +0200

--
 .../services/AmbariConfigurationService.java|   2 +-
 .../ldap/domain/AmbariLdapConfiguration.java|  22 ++
 .../server/ldap/service/AmbariLdapFacade.java   |  10 +-
 .../ldap/service/AmbariLdapFacadeTest.java  | 215 +++
 4 files changed, 245 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/2f059df3/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java
index 492509f..38ae766 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java
@@ -150,7 +150,7 @@ public class AmbariConfigurationService extends BaseService 
{
   @PUT
   @Path("{configurationId}")
   @Produces(MediaType.TEXT_PLAIN)
-  @ApiOperation(value = "Updates ambari configuration resources - Not 
implemented yet",
+  @ApiOperation(value = "Updates ambari configuration resources ",
 nickname = "AmbariConfigurationService#updateAmbariConfiguration")
   @ApiImplicitParams({
 @ApiImplicitParam(dataType = AMBARI_CONFIGURATION_REQUEST_TYPE, paramType 
= PARAM_TYPE_BODY),

http://git-wip-us.apache.org/repos/asf/ambari/blob/2f059df3/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfiguration.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfiguration.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfiguration.java
index d071ebe..8b26cd3 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfiguration.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfiguration.java
@@ -19,6 +19,8 @@ import java.util.Map;
 
 import javax.inject.Inject;
 
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -174,4 +176,24 @@ public class AmbariLdapConfiguration {
   public String toString() {
 return configurationMap.toString();
   }
+
+  @Override
+  public boolean equals(Object o) {
+if (this == o) return true;
+
+if (o == null || getClass() != o.getClass()) return false;
+
+AmbariLdapConfiguration that = (AmbariLdapConfiguration) o;
+
+return new EqualsBuilder()
+  .append(configurationMap, that.configurationMap)
+  .isEquals();
+  }
+
+  @Override
+  public int hashCode() {
+return new HashCodeBuilder(17, 37)
+  .append(configurationMap)
+  .toHashCode();
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/2f059df3/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
index c75b0c4..bbfbc8e 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
@@ -33,7 +33,7 @@ public class AmbariLdapFacade implements LdapFacade {
   /**
* Additional parameters expected to be provided along with the configuration
*/
-  private enum Parameters {
+  protected enum Parameters {
 TEST_USER_NAME("ambari.ldap.test.user.name"),
 TEST_USER_PASSWORD("ambari.ldap.test.user.password");
 
@@ -43,7 +43,7 @@ public class AmbariLdapFacade implements LdapFacade {
   this.parameterKey = parameterKey;
 }
 
-private String getParameterKey() {
+public String getParameterKey() {
   return parameterKey;
 }
 
@@ -62,6 

[28/33] ambari git commit: AMBARI-21307 Refactor - using the LdapConnectionTemplate for ldap operations

2017-10-13 Thread lpuskas
AMBARI-21307 Refactor - using the LdapConnectionTemplate for ldap operations


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 1ecd85c4da518a0c59735f8a8d30f245a69bcae9
Parents: b8128f0
Author: lpuskas 
Authored: Wed Oct 4 15:54:34 2017 +0200
Committer: lpuskas 
Committed: Fri Oct 13 17:20:52 2017 +0200

--
 .../services/ldap/LdapConfigurationService.java |   6 +-
 .../server/controller/ControllerModule.java |   2 +-
 .../apache/ambari/server/ldap/LdapModule.java   |  12 +-
 .../domain/AmbariLdapConfigurationFactory.java  |  34 +
 .../ldap/domain/LdapConfigurationFactory.java   |  34 -
 .../AmbariLdapConfigurationProvider.java|   5 +-
 .../server/ldap/service/AmbariLdapFacade.java   |  36 +
 .../server/ldap/service/AttributeDetector.java  |   2 +-
 .../service/LdapAttributeDetectionService.java  |   8 +-
 .../ldap/service/LdapConfigurationService.java  |  22 +--
 .../ldap/service/LdapConnectionService.java |  43 --
 .../service/LdapConnectionTemplateProvider.java |  56 
 .../DefaultLdapAttributeDetectionService.java   | 129 ++---
 .../ads/DefaultLdapConfigurationService.java| 110 +++---
 .../ads/DefaultLdapConnectionService.java   |  86 ---
 .../ads/LdapConnectionTemplateFactory.java  |  95 
 .../ads/detectors/GroupMemberAttrDetector.java  |   4 +-
 .../ads/detectors/GroupNameAttrDetector.java|   4 +-
 .../ads/detectors/GroupObjectClassDetector.java |   4 +-
 .../OccurranceAndWeightBasedDetector.java   | 103 -
 .../OccurrenceAndWeightBasedDetector.java   | 103 +
 .../detectors/UserGroupMemberAttrDetector.java  |   4 +-
 .../ads/detectors/UserNameAttrDetector.java |   4 +-
 .../ads/detectors/UserObjectClassDetector.java  |   4 +-
 .../server/ldap/LdapModuleFunctionalTest.java   | 143 +++
 .../domain/AmbariLdapConfigurationTest.java |  19 ---
 ...estAmbariAmbariLdapConfigurationFactory.java |  29 
 .../TestAmbariLdapConfigurationFactory.java |  29 
 ...efaultLdapAttributeDetectionServiceTest.java | 112 ---
 .../DefaultLdapConfigurationServiceTest.java| 129 -
 30 files changed, 601 insertions(+), 770 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/1ecd85c4/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
index ff95066..13f8835 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
@@ -47,7 +47,7 @@ import org.apache.ambari.server.api.services.ResultStatus;
 import org.apache.ambari.server.controller.internal.ResourceImpl;
 import org.apache.ambari.server.controller.spi.Resource;
 import org.apache.ambari.server.ldap.domain.AmbariLdapConfiguration;
-import org.apache.ambari.server.ldap.domain.LdapConfigurationFactory;
+import org.apache.ambari.server.ldap.domain.AmbariLdapConfigurationFactory;
 import org.apache.ambari.server.ldap.service.LdapFacade;
 import org.apache.ambari.server.security.authorization.AuthorizationException;
 import org.apache.ambari.server.security.authorization.AuthorizationHelper;
@@ -72,7 +72,7 @@ public class LdapConfigurationService extends 
AmbariConfigurationService {
   private static LdapFacade ldapFacade;
 
   @Inject
-  private static LdapConfigurationFactory ldapConfigurationFactory;
+  private static AmbariLdapConfigurationFactory ambariLdapConfigurationFactory;
 
 
   @POST
@@ -93,7 +93,7 @@ public class LdapConfigurationService extends 
AmbariConfigurationService {
 
   validateRequest(ldapConfigurationRequest);
 
-  AmbariLdapConfiguration ambariLdapConfiguration = 
ldapConfigurationFactory.createLdapConfiguration(
+  AmbariLdapConfiguration ambariLdapConfiguration = 
ambariLdapConfigurationFactory.createLdapConfiguration(
 
ldapConfigurationRequest.getAmbariConfiguration().getData().iterator().next());
 
   LdapConfigOperation action = 
LdapConfigOperation.fromAction(ldapConfigurationRequest.getRequestInfo().getAction());

http://git-wip-us.apache.org/repos/asf/ambari/blob/1ecd85c4/ambari-server/src/main/java/org/apache/ambari/server

[19/33] ambari git commit: AMBARI-21307 Added the supported ldap properties to the code. Refactored existing code relying on these properties

2017-10-13 Thread lpuskas
AMBARI-21307 Added the supported ldap properties to the code. Refactored 
existing code relying on these properties


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 3800adf622800844803b5b12b92324994ddee748
Parents: 12be829
Author: lpuskas 
Authored: Fri Sep 8 13:57:25 2017 +0300
Committer: lpuskas 
Committed: Fri Oct 13 17:20:51 2017 +0200

--
 .../server/ldap/AmbariLdapConfiguration.java| 189 ---
 .../AmbariLdapConfigurationProvider.java|   6 +-
 .../server/ldap/service/AmbariLdapFacade.java   |  10 +-
 .../service/LdapAttributeDetectionService.java  |  43 +
 .../ambari/server/ldap/service/LdapFacade.java  |   2 +-
 .../ads/DefaultAttributeDetectionService.java   |  47 +
 .../ads/DefaultLdapConfigurationService.java|   4 +-
 .../ads/DefaultLdapConnectionService.java   |   4 +-
 .../DefaultAttributeDetectionServiceTest.java   | 102 ++
 .../DefaultLdapConfigurationServiceTest.java|  30 ++-
 10 files changed, 348 insertions(+), 89 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/3800adf6/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
index e913e77..76faeed 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
@@ -34,63 +34,67 @@ public class AmbariLdapConfiguration {
   /**
* Constants representing supported LDAP related property names
*/
-  public enum LdapConfigProperty {
-LDAP_CONFIGURED("ambari.ldap.configured"),
-AUTOMATIC_ATTRIBUTE_DETECTION("ambari.ldap.automatic.attribute.detection"),
-USE_SSL("ambari.ldap.usessl"),
-LDAP_SERVER_HOST("ambari.ldap.server.host"),
-LDAP_SERVER_PORT("ambari.ldap.server.port"),
-LDAP_TRUSTSTORE("ambari.ldap.truststore"),
-LDAP_TRUSTSTORE_TYPE("ambari.ldap.truststore.type"),
-LDAP_TRUSTSTORE_PATH("ambari.ldap.truststore.path"),
-LDAP_TRUSTSTORE_PASSWORD("ambari.ldap.truststore.password"),
-BASE_DN("ambari.ldap.bind.dn"),
-REFERRAL("ambari.ldap.referral"),
-PAGINATION_ENABLED("ambari.ldap.pagination.enabled"),
-
-BIND_ANONIMOUSLY("ambari.ldap.bindanonymously"),
-MANAGER_DN("ambari.ldap.managerdn"),
-MANAGER_PASSWORD("ambari.ldap.managerpassword"),
-USER_OBJECT_CLASS("ambari.ldap.user.object.class"),
-USER_NAME_ATTRIBUTE("ambari.ldap.user.name.attribute"),
-USER_NAME_FORCE_LOWERCASE("ambari.ldap.username.force.lowercase"),
-USER_SEARCH_BASE("ambari.ldap.user.search.base"),
-
SYNC_USER_MEMBER_REPLACE_PATTERN("ambari.ldap.sync.user.member.replacepattern"),
-SYNC_USER_MEMBER_FILTER("ambari.ldap.sync.user.member_filter"),
-
-ADMIN_GROUP_MAPPING_RULES ("ambari.ldap.admin.group.mappingrules"),
-GROUP_OBJECT_CLASS("ambari.ldap.group.object.class"),
-GROUP_NAME_ATTRIBUTE("ambari.ldap.group.name.attribute"),
-GROUP_MEMBER_ATTRIBUTE("ambari.ldap.group.member.attribute"),
-GROUP_SEARCH_BASE("ambari.ldap.group.search.base"),
-
SYNC_GROUP_MEMBER_REPLACE_PATTERN("ambari.ldap.sync.group.member.replacepattern"),
-SYNC_GROUP_MEMBER_FILTER("ambari.ldap.sync.group.member_filter"),
-DN_ATTRIBUTE("authentication.ldap.dnAttribute"),
-
-TEST_USER_NAME("ambari.ldap.test.user.name"),
-TEST_USER_PASSWORD("ambari.ldap.test.user.password");
+  public enum AmbariLdapConfig {
+
+LDAP_ENABLED("ambari.ldap.authentication.enabled"),
+SERVER_HOST("ambari.ldap.connectivity.server.host"),
+SERVER_PORT("ambari.ldap.connectivity.server.port"),
+USE_SSL("ambari.ldap.connectivity.use_ssl"),
+
+TRUST_STORE("ambari.ldap.connectivity.trust_store"),
+TRUST_STORE_TYPE("ambari.ldap.connectivity.trust_store.type"),
+TRUST_STORE_PATH("ambari.ldap.connectivity.trust_store.path"),
+TRUST_STORE_PASSWORD("ambari.ldap.connectivity.trust_store.password"),
+ANONYMOU

[33/33] ambari git commit: AMBARI-21307 Added unit tests. Improved logging, refactoring: rename, organized classes into packages

2017-10-13 Thread lpuskas
AMBARI-21307 Added unit tests. Improved logging, refactoring: rename, organized 
classes into packages


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: d623a21fe6689bdd57c76dae70462d3f92903e0d
Parents: 36a49d1
Author: lpuskas 
Authored: Fri Oct 13 17:19:41 2017 +0200
Committer: lpuskas 
Committed: Fri Oct 13 17:53:38 2017 +0200

--
 .../apache/ambari/server/ldap/LdapModule.java   |   2 +-
 .../AmbariLdapConfigurationProvider.java|  13 +-
 .../server/ldap/service/AmbariLdapFacade.java   |   2 +-
 .../service/LdapConnectionConfigService.java|   4 +-
 .../ads/DefaultLdapConfigurationService.java|  38 +++-
 .../ads/DefaultLdapConnectionConfigService.java | 116 ++
 .../DefaultLdapConnectionConfigService.java | 116 --
 .../server/ldap/LdapModuleFunctionalTest.java   |   4 +-
 ...estAmbariAmbariLdapConfigurationFactory.java |  29 ---
 .../TestAmbariLdapConfigurationFactory.java |  29 +++
 .../ldap/service/AmbariLdapFacadeTest.java  |   4 +-
 .../DefaultLdapConfigurationServiceTest.java| 221 +++
 12 files changed, 414 insertions(+), 164 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/d623a21f/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapModule.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapModule.java 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapModule.java
index 4abf4e7..67e84dc 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapModule.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapModule.java
@@ -25,7 +25,7 @@ import 
org.apache.ambari.server.ldap.service.LdapConnectionConfigService;
 import org.apache.ambari.server.ldap.service.LdapFacade;
 import 
org.apache.ambari.server.ldap.service.ads.DefaultLdapAttributeDetectionService;
 import 
org.apache.ambari.server.ldap.service.ads.DefaultLdapConfigurationService;
-import 
org.apache.ambari.server.ldap.service.ads.detectors.DefaultLdapConnectionConfigService;
+import 
org.apache.ambari.server.ldap.service.ads.DefaultLdapConnectionConfigService;
 
 import com.google.inject.AbstractModule;
 import com.google.inject.assistedinject.FactoryModuleBuilder;

http://git-wip-us.apache.org/repos/asf/ambari/blob/d623a21f/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapConfigurationProvider.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapConfigurationProvider.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapConfigurationProvider.java
index 9fad896..c88d420 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapConfigurationProvider.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapConfigurationProvider.java
@@ -36,7 +36,8 @@ import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
 
 /**
- * Provider implementation for LDAP configurations. It needs to be registered 
in the related GUICE module as a provider
+ * Provider implementation for LDAP configurations.
+ * It needs to be registered in the related GUICE module as a provider.
  * It's responsible for managing LDAP configurations in the application.
  * Whenever requested, this provider returns an AmbariLdapConfiguration which 
is always in sync with the persisted LDAP
  * configuration resource.
@@ -85,15 +86,15 @@ public class AmbariLdapConfigurationProvider implements 
Providerhttp://git-wip-us.apache.org/repos/asf/ambari/blob/d623a21f/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
index bbfbc8e..0118840 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
@@ -33,7 +33,7 @@ public class AmbariLdapFacade implements LdapFacade {
   /**
* Additional parameters expected to be provided along with the configuration
*/
-  protected enum Parameters {
+  public enum Parameters {
 TEST_USER_NAME("ambari.ldap.test

[26/33] ambari git commit: AMBARI-21307 added javadocs, organized and cleaned the code

2017-10-13 Thread lpuskas
AMBARI-21307 added javadocs, organized and cleaned the code


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: a15c4e5fa8fea4c2c8f3962e191d84a1e7a1bfcd
Parents: dd99009
Author: lpuskas 
Authored: Wed Sep 13 15:27:39 2017 +0200
Committer: lpuskas 
Committed: Fri Oct 13 17:20:52 2017 +0200

--
 .../server/ldap/LdapConfigurationFactory.java   |  13 +
 .../server/ldap/LdapConfigurationService.java   |  60 -
 .../apache/ambari/server/ldap/LdapModule.java   |   6 +-
 .../server/ldap/service/AmbariLdapFacade.java   |   9 +-
 .../server/ldap/service/AttributeDetector.java  |   3 +-
 .../ldap/service/LdapConfigurationService.java  |  60 +
 .../ambari/server/ldap/service/LdapFacade.java  |  10 +-
 .../ads/DefaultAttributeDetectionService.java   | 238 ---
 .../DefaultLdapAttributeDetectionService.java   | 238 +++
 .../ads/DefaultLdapConfigurationService.java|  17 +-
 .../detectors/UserGroupMemberAttrDetector.java  |   1 -
 .../DefaultAttributeDetectionServiceTest.java   | 108 -
 ...efaultLdapAttributeDetectionServiceTest.java | 108 +
 .../DefaultLdapConfigurationServiceTest.java|   2 +-
 14 files changed, 453 insertions(+), 420 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/a15c4e5f/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapConfigurationFactory.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapConfigurationFactory.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapConfigurationFactory.java
index 57cdf6e..67ac092 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapConfigurationFactory.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapConfigurationFactory.java
@@ -16,6 +16,19 @@ package org.apache.ambari.server.ldap;
 
 import java.util.Map;
 
+/**
+ * Factory interface for AmbariLdapConfiguration instances.
+ * It's registered as a factory in the GUICE context ( so no implementations 
required)
+ *
+ * To be extended with other factory methods upon needs.
+ */
 public interface LdapConfigurationFactory {
+
+  /**
+   * Creates an AmbariLdapConfiguration instance with the provided map of 
configuration settings.
+   *
+   * @param configuration a map where keys are the configuration properties 
and values are the configuration values
+   * @return an AmbariLdapConfiguration instance
+   */
   AmbariLdapConfiguration createLdapConfiguration(Map 
configuration);
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/a15c4e5f/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapConfigurationService.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapConfigurationService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapConfigurationService.java
deleted file mode 100644
index 69a641f..000
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapConfigurationService.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed 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.ldap;
-
-import java.util.Set;
-
-import org.apache.ambari.server.AmbariException;
-import org.apache.ambari.server.ldap.service.AmbariLdapException;
-import org.apache.directory.ldap.client.api.LdapConnection;
-
-/**
- * Collection of operations for validating ldap configuration.
- * It's intended to decouple implementations using different libraries.
- */
-public interface LdapConfigurationService {
-
-  /**
-   * Tests the connection based on the provided configuration.
-   *
-   * @param ldapConnection connection instance
-   * @param configuration  the ambari ldap configuration instance
-   * @throws AmbariLdapException if the connection is not possible
-   */
-  void checkConnection(LdapConnection ldapConnection, AmbariLdapConfiguration 
configurati

[14/33] ambari git commit: AMBARI-21307 Add all known LDAP properties to AmbariConfigurationEnum (benyoka)

2017-10-13 Thread lpuskas
AMBARI-21307 Add all known LDAP properties to AmbariConfigurationEnum (benyoka)


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 12be829194706b75404bb1ffd37e1c6d74740672
Parents: a5397e2
Author: Balazs Bence Sari 
Authored: Mon Sep 4 12:45:07 2017 +0200
Committer: lpuskas 
Committed: Fri Oct 13 17:20:50 2017 +0200

--
 .../ambari/server/ldap/AmbariLdapConfiguration.java  | 15 ++-
 1 file changed, 14 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/12be8291/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
index b1cbced..e913e77 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
@@ -40,22 +40,35 @@ public class AmbariLdapConfiguration {
 USE_SSL("ambari.ldap.usessl"),
 LDAP_SERVER_HOST("ambari.ldap.server.host"),
 LDAP_SERVER_PORT("ambari.ldap.server.port"),
+LDAP_TRUSTSTORE("ambari.ldap.truststore"),
 LDAP_TRUSTSTORE_TYPE("ambari.ldap.truststore.type"),
 LDAP_TRUSTSTORE_PATH("ambari.ldap.truststore.path"),
+LDAP_TRUSTSTORE_PASSWORD("ambari.ldap.truststore.password"),
 BASE_DN("ambari.ldap.bind.dn"),
+REFERRAL("ambari.ldap.referral"),
+PAGINATION_ENABLED("ambari.ldap.pagination.enabled"),
 
 BIND_ANONIMOUSLY("ambari.ldap.bindanonymously"),
 MANAGER_DN("ambari.ldap.managerdn"),
 MANAGER_PASSWORD("ambari.ldap.managerpassword"),
 USER_OBJECT_CLASS("ambari.ldap.user.object.class"),
 USER_NAME_ATTRIBUTE("ambari.ldap.user.name.attribute"),
+USER_NAME_FORCE_LOWERCASE("ambari.ldap.username.force.lowercase"),
 USER_SEARCH_BASE("ambari.ldap.user.search.base"),
+
SYNC_USER_MEMBER_REPLACE_PATTERN("ambari.ldap.sync.user.member.replacepattern"),
+SYNC_USER_MEMBER_FILTER("ambari.ldap.sync.user.member_filter"),
 
+ADMIN_GROUP_MAPPING_RULES ("ambari.ldap.admin.group.mappingrules"),
 GROUP_OBJECT_CLASS("ambari.ldap.group.object.class"),
 GROUP_NAME_ATTRIBUTE("ambari.ldap.group.name.attribute"),
 GROUP_MEMBER_ATTRIBUTE("ambari.ldap.group.member.attribute"),
 GROUP_SEARCH_BASE("ambari.ldap.group.search.base"),
-DN_ATTRIBUTE("authentication.ldap.dnAttribute");
+
SYNC_GROUP_MEMBER_REPLACE_PATTERN("ambari.ldap.sync.group.member.replacepattern"),
+SYNC_GROUP_MEMBER_FILTER("ambari.ldap.sync.group.member_filter"),
+DN_ATTRIBUTE("authentication.ldap.dnAttribute"),
+
+TEST_USER_NAME("ambari.ldap.test.user.name"),
+TEST_USER_PASSWORD("ambari.ldap.test.user.password");
 
 private String propertyName;
 



[16/50] ambari git commit: AMBARI-22238 : Maven cleanup of ambari utility, logsearch and ambari metrics modules. (Commit 2) (avijayan)

2017-10-17 Thread lpuskas
AMBARI-22238 : Maven cleanup of ambari utility, logsearch and ambari metrics 
modules. (Commit 2) (avijayan)


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 75102dc4c8eb08772568cfd085682fe30f8289c6
Parents: 4a22350
Author: Aravindan Vijayan 
Authored: Mon Oct 16 15:58:47 2017 -0700
Committer: Aravindan Vijayan 
Committed: Mon Oct 16 15:58:47 2017 -0700

--
 ambari-infra/ambari-infra-assembly/pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/75102dc4/ambari-infra/ambari-infra-assembly/pom.xml
--
diff --git a/ambari-infra/ambari-infra-assembly/pom.xml 
b/ambari-infra/ambari-infra-assembly/pom.xml
index 2b4959b..bf0e679 100644
--- a/ambari-infra/ambari-infra-assembly/pom.xml
+++ b/ambari-infra/ambari-infra-assembly/pom.xml
@@ -120,9 +120,9 @@
   
 
   
${solr.client.dir}/target/package
-  
+  
 libs/checkstyle*.jar
-  
+  
 
   
 



[24/50] ambari git commit: AMBARI-21307 Groups for the test user returned to the caller

2017-10-17 Thread lpuskas
AMBARI-21307 Groups for the test user returned to the caller


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 06f3690ef7ee791a048b7bb5dbf23992de806819
Parents: 885be97
Author: lpuskas 
Authored: Tue Aug 8 15:50:29 2017 +0200
Committer: lpuskas 
Committed: Tue Oct 17 18:41:09 2017 +0200

--
 .../api/services/ldap/LdapRestService.java  | 16 +-
 .../server/ldap/AmbariLdapConfiguration.java|  2 +-
 .../apache/ambari/server/ldap/LdapModule.java   |  3 +
 .../server/ldap/service/AmbariLdapFacade.java   |  3 +-
 .../ambari/server/ldap/service/LdapFacade.java  |  3 +-
 ...efaultLdapConfigurationValidatorService.java | 25 ++---
 .../ad/DefaultLdapConnectionService.java|  2 +-
 ...ltLdapConfigurationValidatorServiceTest.java | 59 +++-
 8 files changed, 49 insertions(+), 64 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/06f3690e/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapRestService.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapRestService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapRestService.java
index 33b10fa..8578204 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapRestService.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapRestService.java
@@ -28,6 +28,8 @@
 
 package org.apache.ambari.server.api.services.ldap;
 
+import java.util.Set;
+
 import javax.inject.Inject;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.POST;
@@ -41,12 +43,16 @@ import org.apache.ambari.server.api.services.BaseService;
 import org.apache.ambari.server.api.services.Result;
 import org.apache.ambari.server.api.services.ResultImpl;
 import org.apache.ambari.server.api.services.ResultStatus;
+import org.apache.ambari.server.controller.internal.ResourceImpl;
+import org.apache.ambari.server.controller.spi.Resource;
 import org.apache.ambari.server.ldap.AmbariLdapConfiguration;
 import org.apache.ambari.server.ldap.LdapConfigurationFactory;
 import org.apache.ambari.server.ldap.service.LdapFacade;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.collect.Sets;
+
 /**
  * Endpoint designated to LDAP specific operations.
  */
@@ -68,6 +74,8 @@ public class LdapRestService extends BaseService {
   @Consumes(MediaType.APPLICATION_JSON)
   public Response validateConfiguration(LdapCheckConfigurationRequest 
ldapCheckConfigurationRequest) {
 
+Set groups = Sets.newHashSet();
+
 Result result = new ResultImpl(new ResultStatus(ResultStatus.STATUS.OK));
 try {
 
@@ -86,7 +94,11 @@ public class LdapRestService extends BaseService {
 case "test-attributes":
 
   LOGGER.info("Testing LDAP attributes ");
-  
ldapFacade.checkLdapAttibutes(ldapCheckConfigurationRequest.getRequestInfo().getParameters(),
 ambariLdapConfiguration);
+  groups = 
ldapFacade.checkLdapAttibutes(ldapCheckConfigurationRequest.getRequestInfo().getParameters(),
 ambariLdapConfiguration);
+  // todo factor out the resource creation, design better the 
structure in the response
+  Resource resource = new 
ResourceImpl(Resource.Type.AmbariConfiguration);
+  resource.setProperty("groups", groups);
+  result.getResultTree().addChild(resource, "payload");
 
   break;
 case "detect-attributes":
@@ -101,7 +113,7 @@ public class LdapRestService extends BaseService {
   }
 
 } catch (Exception e) {
-  result = new ResultImpl(new 
ResultStatus(ResultStatus.STATUS.BAD_REQUEST, e));
+  result.setResultStatus(new ResultStatus(ResultStatus.STATUS.BAD_REQUEST, 
e));
 }
 
 return 
Response.status(result.getStatus().getStatusCode()).entity(getResultSerializer().serialize(result)).build();

http://git-wip-us.apache.org/repos/asf/ambari/blob/06f3690e/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
index a6ff80b..8ab587b 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari

[03/50] ambari git commit: AMBARI-22242. Express Upgrade from IOP 4.2 to HDP 2.6.2 AMS failed to restart before finalizing. (swagle)

2017-10-17 Thread lpuskas
AMBARI-22242. Express Upgrade from IOP 4.2 to HDP 2.6.2 AMS failed to restart 
before finalizing. (swagle)


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 62a0a18ce57c7290989ab3ff5ffb08e88225570e
Parents: 6e1cac8
Author: Siddharth Wagle 
Authored: Fri Oct 13 20:55:36 2017 -0700
Committer: Siddharth Wagle 
Committed: Fri Oct 13 20:55:36 2017 -0700

--
 .../AMBARI_METRICS/0.1.0/package/scripts/metrics_collector.py| 4 ++--
 .../AMBARI_METRICS/0.1.0/package/scripts/metrics_grafana.py  | 4 ++--
 .../AMBARI_METRICS/0.1.0/package/scripts/metrics_monitor.py  | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/62a0a18c/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_collector.py
--
diff --git 
a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_collector.py
 
b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_collector.py
index fc2576d..1c6f2a1 100644
--- 
a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_collector.py
+++ 
b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_collector.py
@@ -44,13 +44,13 @@ class AmsCollector(Script):
 hbase('regionserver', action)
 ams(name='collector')
 
-  def start(self, env):
+  def start(self, env, upgrade_type=None):
 self.configure(env, action = 'start') # for security
 # stop hanging components before start
 ams_service('collector', action = 'stop')
 ams_service('collector', action = 'start')
 
-  def stop(self, env):
+  def stop(self, env, upgrade_type=None):
 import params
 env.set_params(params)
 # Sometimes, stop() may be called before start(), in case restart() is 
initiated right after installation

http://git-wip-us.apache.org/repos/asf/ambari/blob/62a0a18c/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_grafana.py
--
diff --git 
a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_grafana.py
 
b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_grafana.py
index 1f0e049..387b018 100644
--- 
a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_grafana.py
+++ 
b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_grafana.py
@@ -38,7 +38,7 @@ class AmsGrafana(Script):
 env.set_params(params)
 ams(name='grafana', action=action)
 
-  def start(self, env):
+  def start(self, env, upgrade_type=None):
 import params
 env.set_params(params)
 self.configure(env, action = 'start')
@@ -61,7 +61,7 @@ class AmsGrafana(Script):
 # Create pre-built dashboards
 create_ams_dashboards()
 
-  def stop(self, env):
+  def stop(self, env, upgrade_type=None):
 import params
 env.set_params(params)
 self.configure(env, action = 'stop')

http://git-wip-us.apache.org/repos/asf/ambari/blob/62a0a18c/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_monitor.py
--
diff --git 
a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_monitor.py
 
b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_monitor.py
index a377f6d..16c7997 100644
--- 
a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_monitor.py
+++ 
b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/metrics_monitor.py
@@ -35,14 +35,14 @@ class AmsMonitor(Script):
 env.set_params(params)
 ams(name='monitor')
 
-  def start(self, env):
+  def start(self, env, upgrade_type=None):
 self.configure(env) # for security
 
 ams_service( 'monitor',
  action = 'start'
 )
 
-  def stop(self, env):
+  def stop(self, env, upgrade_type=None):
 import params
 env.set_params(params)
 



[15/50] ambari git commit: AMBARI-22245 - YARN Service Checks Fails Because of Old hadoop-client Classpath Entry (jonathanhurley)

2017-10-17 Thread lpuskas
AMBARI-22245 - YARN Service Checks Fails Because of Old hadoop-client Classpath 
Entry (jonathanhurley)


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 4a2235037e2306ac8197f8d1bf917f5402f248bb
Parents: 523f505
Author: Jonathan Hurley 
Authored: Mon Oct 16 15:33:17 2017 -0400
Committer: Jonathan Hurley 
Committed: Mon Oct 16 16:13:00 2017 -0400

--
 .../2.1.0.2.0/package/scripts/params_linux.py   | 34 +++--
 .../2.1.0.2.0/package/scripts/status_params.py  | 52 ---
 .../YARN/3.0.0.3.0/configuration/yarn-site.xml  |  2 +-
 .../3.0.0.3.0/package/scripts/params_linux.py   | 53 +++-
 .../3.0.0.3.0/package/scripts/status_params.py  | 52 ---
 .../services/YARN/configuration/yarn-site.xml   |  2 +-
 .../stacks/HDP/2.6/upgrades/config-upgrade.xml  |  7 +++
 .../HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml |  7 ++-
 .../stacks/HDP/2.6/upgrades/upgrade-2.6.xml |  1 +
 9 files changed, 124 insertions(+), 86 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/4a223503/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py
--
diff --git 
a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py
 
b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py
index 2ab779f..620408b 100644
--- 
a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py
+++ 
b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/params_linux.py
@@ -20,8 +20,10 @@ Ambari Agent
 """
 import os
 
+from resource_management.core import sudo
 from resource_management.libraries.script.script import Script
 from resource_management.libraries.resources.hdfs_resource import HdfsResource
+from resource_management.libraries.functions import component_version
 from resource_management.libraries.functions import conf_select
 from resource_management.libraries.functions import stack_select
 from resource_management.libraries.functions import format
@@ -88,6 +90,7 @@ stack_supports_ranger_audit_db = 
check_stack_feature(StackFeature.RANGER_AUDIT_D
 hostname = config['hostname']
 
 # hadoop default parameters
+hadoop_home = status_params.hadoop_home
 hadoop_libexec_dir = stack_select.get_hadoop_dir("libexec")
 hadoop_bin = stack_select.get_hadoop_dir("sbin")
 hadoop_bin_dir = stack_select.get_hadoop_dir("bin")
@@ -113,12 +116,33 @@ if stack_supports_ru:
   if command_role in YARN_SERVER_ROLE_DIRECTORY_MAP:
 yarn_role_root = YARN_SERVER_ROLE_DIRECTORY_MAP[command_role]
 
-  hadoop_mapred2_jar_location = 
format("{stack_root}/current/{mapred_role_root}")
-  mapred_bin = format("{stack_root}/current/{mapred_role_root}/sbin")
-
+  # defaults set to current based on role
+  hadoop_mapr_home = format("{stack_root}/current/{mapred_role_root}")
   hadoop_yarn_home = format("{stack_root}/current/{yarn_role_root}")
-  yarn_bin = format("{stack_root}/current/{yarn_role_root}/sbin")
-  yarn_container_bin = format("{stack_root}/current/{yarn_role_root}/bin")
+
+  # try to render the specific version
+  version = component_version.get_component_repository_version()
+  if version is None:
+version = default("/commandParams/version", None)
+
+
+  if version is not None:
+hadoop_mapr_versioned_home = 
format("{stack_root}/{version}/hadoop-mapreduce")
+hadoop_yarn_versioned_home = format("{stack_root}/{version}/hadoop-yarn")
+
+if sudo.path_isdir(hadoop_mapr_versioned_home):
+  hadoop_mapr_home = hadoop_mapr_versioned_home
+
+if sudo.path_isdir(hadoop_yarn_versioned_home):
+  hadoop_yarn_home = hadoop_yarn_versioned_home
+
+
+  hadoop_mapred2_jar_location = hadoop_mapr_home
+  mapred_bin = format("{hadoop_mapr_home}/sbin")
+
+  yarn_bin = format("{hadoop_yarn_home}/sbin")
+  yarn_container_bin = format("{hadoop_yarn_home}/bin")
+
 
 if stack_supports_timeline_state_store:
   # Timeline Service property that was added timeline_state_store stack feature

http://git-wip-us.apache.org/repos/asf/ambari/blob/4a223503/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/status_params.py
--
diff --git 
a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/status_params.py
 
b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/status_params.py
index c2e9d92..6bb528f 100644
--- 
a/amb

[06/50] ambari git commit: AMBARI-22243. Apache Hive 2 LLAP cluster doesn't have the metastore warehouse directory. (stoader)

2017-10-17 Thread lpuskas
AMBARI-22243. Apache Hive 2 LLAP cluster doesn't have the metastore warehouse 
directory. (stoader)


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 43fb59761595431b2a8832bafe1bfcb2fa85a1fa
Parents: 8c017c1
Author: Toader, Sebastian 
Authored: Sat Oct 14 07:45:22 2017 +0200
Committer: Toader, Sebastian 
Committed: Sun Oct 15 07:43:51 2017 +0200

--
 .../0.12.0.2.0/package/scripts/hive_interactive.py  | 13 +
 .../2.1.0.3.0/package/scripts/hive_interactive.py   | 13 +
 .../python/stacks/2.5/HIVE/test_hive_server_int.py  | 16 
 3 files changed, 42 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/43fb5976/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_interactive.py
--
diff --git 
a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_interactive.py
 
b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_interactive.py
index 2ed3e3a..89060be 100644
--- 
a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_interactive.py
+++ 
b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_interactive.py
@@ -62,6 +62,19 @@ def hive_interactive(name=None):
   import params
   MB_TO_BYTES = 1048576
 
+  # if warehouse directory is in DFS
+  if not params.whs_dir_protocol or params.whs_dir_protocol == 
urlparse(params.default_fs).scheme:
+# Create Hive Metastore Warehouse Dir
+params.HdfsResource(params.hive_apps_whs_dir,
+type="directory",
+action="create_on_execute",
+owner=params.hive_user,
+group=params.user_group,
+mode=params.hive_apps_whs_mode
+)
+  else:
+Logger.info(format("Not creating warehouse directory 
'{hive_apps_whs_dir}', as the location is not in DFS."))
+
   # Create Hive User Dir
   params.HdfsResource(params.hive_hdfs_user_dir,
   type="directory",

http://git-wip-us.apache.org/repos/asf/ambari/blob/43fb5976/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/hive_interactive.py
--
diff --git 
a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/hive_interactive.py
 
b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/hive_interactive.py
index 2ed3e3a..89060be 100644
--- 
a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/hive_interactive.py
+++ 
b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/hive_interactive.py
@@ -62,6 +62,19 @@ def hive_interactive(name=None):
   import params
   MB_TO_BYTES = 1048576
 
+  # if warehouse directory is in DFS
+  if not params.whs_dir_protocol or params.whs_dir_protocol == 
urlparse(params.default_fs).scheme:
+# Create Hive Metastore Warehouse Dir
+params.HdfsResource(params.hive_apps_whs_dir,
+type="directory",
+action="create_on_execute",
+owner=params.hive_user,
+group=params.user_group,
+mode=params.hive_apps_whs_mode
+)
+  else:
+Logger.info(format("Not creating warehouse directory 
'{hive_apps_whs_dir}', as the location is not in DFS."))
+
   # Create Hive User Dir
   params.HdfsResource(params.hive_hdfs_user_dir,
   type="directory",

http://git-wip-us.apache.org/repos/asf/ambari/blob/43fb5976/ambari-server/src/test/python/stacks/2.5/HIVE/test_hive_server_int.py
--
diff --git 
a/ambari-server/src/test/python/stacks/2.5/HIVE/test_hive_server_int.py 
b/ambari-server/src/test/python/stacks/2.5/HIVE/test_hive_server_int.py
index 3dc78ab..4951c7e 100644
--- a/ambari-server/src/test/python/stacks/2.5/HIVE/test_hive_server_int.py
+++ b/ambari-server/src/test/python/stacks/2.5/HIVE/test_hive_server_int.py
@@ -418,6 +418,22 @@ class TestHiveServerInteractive(RMFTestCase):
 
   def assert_configure_default(self, no_tmp=False, 
default_fs_default=u'hdfs://c6401.ambari.apache.org:8020', 
with_cs_enabled=False):
 
+self.assertResourceCalled('HdfsResource', '/apps/hive/warehouse',
+  immutable_paths = self.DEFAULT_IMMUTA

[05/50] ambari git commit: AMBARI-22203. ZKFC start failed due to hadoop-hdfs-zkfc is not supported (partial revert) (ncole)

2017-10-17 Thread lpuskas
AMBARI-22203. ZKFC start failed due to hadoop-hdfs-zkfc is not supported 
(partial revert) (ncole)


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 8c017c1fdebdbd0261749df0434dc86744dcf986
Parents: 3290677
Author: Nate Cole 
Authored: Sat Oct 14 14:53:14 2017 -0400
Committer: Nate Cole 
Committed: Sat Oct 14 14:53:14 2017 -0400

--
 .../main/resources/stacks/HDP/2.0.6/properties/stack_packages.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/8c017c1f/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
--
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
 
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
index c217ea8..b8655d7 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/properties/stack_packages.json
@@ -368,7 +368,7 @@
 "hadoop-hdfs-zkfc"
   ],
   "STANDARD": [
-"hadoop-client"
+"hadoop-hdfs-zkfc"
   ]
 }
   },



[19/50] ambari git commit: AMBARI-22234 Optimizing Ranger KMS imports (mugdha)

2017-10-17 Thread lpuskas
AMBARI-22234 Optimizing Ranger KMS imports (mugdha)


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: d6cd303d0207ac6ffcdbc16d129758bba9494423
Parents: e19029c
Author: Mugdha Varadkar 
Authored: Tue Oct 17 11:22:05 2017 +0530
Committer: Mugdha Varadkar 
Committed: Tue Oct 17 11:24:13 2017 +0530

--
 .../0.5.0.2.3/package/scripts/kms_server.py | 21 ++--
 .../1.0.0.3.0/package/scripts/kms_server.py | 19 +-
 2 files changed, 21 insertions(+), 19 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/d6cd303d/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/kms_server.py
--
diff --git 
a/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/kms_server.py
 
b/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/kms_server.py
index fcf2478..0b37489 100755
--- 
a/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/kms_server.py
+++ 
b/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/kms_server.py
@@ -27,9 +27,10 @@ from resource_management.libraries.functions.format import 
format
 from resource_management.core.logger import Logger
 from resource_management.core import shell
 from resource_management.libraries.functions.default import default
-from kms import kms, setup_kms_db, setup_java_patch, enable_kms_plugin, 
setup_kms_jce, update_password_configs
 from kms_service import kms_service
 
+import kms
+
 class KmsServer(Script):
 
   def install(self, env):
@@ -44,9 +45,9 @@ class KmsServer(Script):
   sudo = True
 )
 
-setup_kms_db()
+kms.setup_kms_db()
 self.configure(env)
-setup_java_patch()
+kms.setup_java_patch()
 
   def stop(self, env, upgrade_type=None):
 import params
@@ -63,9 +64,9 @@ class KmsServer(Script):
 
 env.set_params(params)
 self.configure(env)
-enable_kms_plugin()
-setup_kms_jce()
-update_password_configs()
+kms.enable_kms_plugin()
+kms.setup_kms_jce()
+kms.update_password_configs()
 kms_service(action = 'start', upgrade_type=upgrade_type)
 
   def status(self, env):
@@ -87,15 +88,15 @@ class KmsServer(Script):
 import params
 
 env.set_params(params)
-kms()
+kms.kms()
 
   def pre_upgrade_restart(self, env, upgrade_type=None):
 import params
 env.set_params(params)
 
 stack_select.select_packages(params.version)
-kms(upgrade_type=upgrade_type)
-setup_java_patch()
+kms.kms(upgrade_type=upgrade_type)
+kms.setup_java_patch()
 
   def setup_ranger_kms_database(self, env):
 import params
@@ -107,7 +108,7 @@ class KmsServer(Script):
 
 stack_version = upgrade_stack[1]
 Logger.info(format('Setting Ranger KMS database schema, using version 
{stack_version}'))
-setup_kms_db(stack_version=stack_version)
+kms.setup_kms_db(stack_version=stack_version)
 
   def get_log_folder(self):
 import params

http://git-wip-us.apache.org/repos/asf/ambari/blob/d6cd303d/ambari-server/src/main/resources/common-services/RANGER_KMS/1.0.0.3.0/package/scripts/kms_server.py
--
diff --git 
a/ambari-server/src/main/resources/common-services/RANGER_KMS/1.0.0.3.0/package/scripts/kms_server.py
 
b/ambari-server/src/main/resources/common-services/RANGER_KMS/1.0.0.3.0/package/scripts/kms_server.py
index 4c313c4..4708da1 100755
--- 
a/ambari-server/src/main/resources/common-services/RANGER_KMS/1.0.0.3.0/package/scripts/kms_server.py
+++ 
b/ambari-server/src/main/resources/common-services/RANGER_KMS/1.0.0.3.0/package/scripts/kms_server.py
@@ -27,10 +27,11 @@ from resource_management.libraries.functions.format import 
format
 from resource_management.core.logger import Logger
 from resource_management.core import shell
 from resource_management.libraries.functions.default import default
-from kms import kms, setup_kms_db, setup_java_patch, enable_kms_plugin, 
setup_kms_jce
 from kms_service import kms_service
 import upgrade
 
+import kms
+
 class KmsServer(Script):
 
   def install(self, env):
@@ -38,9 +39,9 @@ class KmsServer(Script):
 import params
 env.set_params(params)
 
-setup_kms_db()
+kms.setup_kms_db()
 self.configure(env)
-setup_java_patch()
+kms.setup_java_patch()
 
   def stop(self, env, upgrade_type=None):
 import params
@@ -57,8 +58,8 @@ class KmsServer(Script):
 
 env.set_params(params)

[10/50] ambari git commit: AMBARI-22232 : ADDENDUM Need to add a new property to support proxy users for Atlas service (Vishal Suvagia via mugdha).

2017-10-17 Thread lpuskas
AMBARI-22232 : ADDENDUM Need to add a new property to support proxy users for 
Atlas service (Vishal Suvagia via mugdha).


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: d4458daa9bf5209eb2f86409185221cdbd749b13
Parents: e219186
Author: Vishal Suvagia 
Authored: Mon Oct 16 15:16:17 2017 +0530
Committer: Mugdha Varadkar 
Committed: Mon Oct 16 15:35:35 2017 +0530

--
 .../upgrades/AtlasProxyUserConfigCalculation.java  | 17 +
 .../AtlasProxyUserConfigCalculationTest.java   | 17 +
 2 files changed, 34 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/d4458daa/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculation.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculation.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculation.java
index 85fb200..40d64b5 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculation.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculation.java
@@ -1,3 +1,20 @@
+/*
+ * 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 org.apache.ambari.server.AmbariException;

http://git-wip-us.apache.org/repos/asf/ambari/blob/d4458daa/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculationTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculationTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculationTest.java
index 3f8bca9..33ec7f3 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculationTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculationTest.java
@@ -1,3 +1,20 @@
+/*
+ * 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 com.google.inject.Injector;



[11/50] ambari git commit: AMBARI-22223.jdbc(spark[2]) URLs not configured correctly for secure clusters(Prabhjyot Singh via Venkata Sairam)

2017-10-17 Thread lpuskas
AMBARI-3.jdbc(spark[2]) URLs not configured correctly for secure 
clusters(Prabhjyot Singh via Venkata Sairam)


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 2a8ac0ded9a9916dd71b84ac21a2a6165db60284
Parents: d4458da
Author: Venkata Sairam 
Authored: Mon Oct 16 18:15:58 2017 +0530
Committer: Venkata Sairam 
Committed: Mon Oct 16 18:15:58 2017 +0530

--
 .../ZEPPELIN/0.7.0/package/scripts/master.py | 12 
 .../ZEPPELIN/0.7.0/package/scripts/params.py | 15 +--
 2 files changed, 17 insertions(+), 10 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/2a8ac0de/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py
--
diff --git 
a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py
 
b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py
index 6a84d79..9d179b8 100644
--- 
a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py
+++ 
b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py
@@ -492,8 +492,10 @@ class Master(Script):
   interpreter['properties']['spark.proxy.user.property'] = 
'hive.server2.proxy.user'
   interpreter['properties']['spark.url'] = 'jdbc:hive2://' + \
   params.spark_thrift_server_hosts + ':' + 
params.spark_hive_thrift_port + '/'
-  if params.spark_hive_principal:
-interpreter['properties']['spark.url'] += ';principal=' + 
params.spark_hive_principal
+  if params.hive_principal:
+interpreter['properties']['spark.url'] += ';principal=' + 
params.hive_principal
+  if params.hive_transport_mode:
+interpreter['properties']['spark.url'] += ';transportMode=' + 
params.hive_transport_mode
   if 'spark.splitQueries' not in interpreter['properties']:
 interpreter['properties']['spark.splitQueries'] = "true"
 
@@ -504,8 +506,10 @@ class Master(Script):
   interpreter['properties']['spark2.proxy.user.property'] = 
'hive.server2.proxy.user'
   interpreter['properties']['spark2.url'] = 'jdbc:hive2://' + \
   params.spark2_thrift_server_hosts + ':' + 
params.spark2_hive_thrift_port + '/'
-  if params.spark_hive_principal:
-interpreter['properties']['spark2.url'] += ';principal=' + 
params.spark2_hive_principal
+  if params.hive_principal:
+interpreter['properties']['spark2.url'] += ';principal=' + 
params.hive_principal
+  if params.hive_transport_mode:
+interpreter['properties']['spark2.url'] += ';transportMode=' + 
params.hive_transport_mode
   if 'spark2.splitQueries' not in interpreter['properties']:
 interpreter['properties']['spark2.splitQueries'] = "true"
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/2a8ac0de/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/params.py
--
diff --git 
a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/params.py
 
b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/params.py
index e69037c..2290a7f 100644
--- 
a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/params.py
+++ 
b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/params.py
@@ -162,13 +162,19 @@ if 'hive_server_interactive_hosts' in master_configs and 
len(master_configs['hiv
 spark_thrift_server_hosts = None
 spark_hive_thrift_port = None
 spark_hive_principal = None
+hive_principal = None
+hive_transport_mode = None
+
+if 'hive-site' in config['configurations']:
+  if 'hive.server2.authentication.kerberos.principal' in 
config['configurations']['hive-site']:
+hive_principal = 
config['configurations']['hive-site']['hive.server2.authentication.kerberos.principal']
+  if 'hive.server2.transport.mode' in config['configurations']['hive-site']:
+hive_transport_mode = 
config['configurations']['hive-site']['hive.server2.transport.mode']
+
 if 'spark_thriftserver_hosts' in master_configs and 
len(master_configs['spark_thriftserver_hosts']) != 0:
   spark_thrift_server_hosts = 
str(master_configs['spark_thriftserver_hosts'][0])
   if config['configurations']['spark-hive-site-override']:
 spark_hive_thrift_port = 
config['configurations']['spark-hive-site

[14/50] ambari git commit: AMBARI-22232 - Need to add a new property to support proxy users property for Atlas service (Vishal Suvagia via jonathanhurley)

2017-10-17 Thread lpuskas
AMBARI-22232  - Need to add a new property to support proxy users property for 
Atlas service (Vishal Suvagia via jonathanhurley)


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 523f505dca99d1a8b9dd07ffabc1bad110910566
Parents: 5f86f15
Author: Jonathan Hurley 
Authored: Mon Oct 16 12:56:57 2017 -0400
Committer: Jonathan Hurley 
Committed: Mon Oct 16 12:58:02 2017 -0400

--
 .../AtlasProxyUserConfigCalculation.java| 11 --
 .../AtlasProxyUserConfigCalculationTest.java| 22 +++-
 2 files changed, 16 insertions(+), 17 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/523f505d/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculation.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculation.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculation.java
index 40d64b5..1a99299 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculation.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculation.java
@@ -17,19 +17,16 @@
  */
 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 javax.inject.Inject;
-import java.text.MessageFormat;
-import java.util.Map;
-import java.util.concurrent.ConcurrentMap;
-
 public class AtlasProxyUserConfigCalculation extends 
AbstractUpgradeServerAction {
 
   private static final String ATLAS_APPLICATION_PROPERTIES_CONFIG_TYPE = 
"application-properties";

http://git-wip-us.apache.org/repos/asf/ambari/blob/523f505d/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculationTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculationTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculationTest.java
index 33ec7f3..7cb6255 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculationTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculationTest.java
@@ -17,7 +17,16 @@
  */
 package org.apache.ambari.server.serveraction.upgrades;
 
-import com.google.inject.Injector;
+import static org.easymock.EasyMock.anyObject;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.easymock.EasyMock.replay;
+
+import java.lang.reflect.Field;
+import java.util.HashMap;
+import java.util.Map;
+
 import org.apache.ambari.server.actionmanager.ExecutionCommandWrapper;
 import org.apache.ambari.server.actionmanager.HostRoleCommand;
 import org.apache.ambari.server.agent.CommandReport;
@@ -25,20 +34,13 @@ import org.apache.ambari.server.agent.ExecutionCommand;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Config;
-import org.easymock.EasyMock;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
-import java.lang.reflect.Field;
-import java.util.HashMap;
-import java.util.Map;
 
-import static org.easymock.EasyMock.*;
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expectLastCall;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+
+import com.google.inject.Injector;
 
 public class AtlasProxyUserConfigCalculationTest {
 



[01/50] ambari git commit: AMBARI-22235. Druid service check failed during EU. (b-slim via nishantmonu51) [Forced Update!]

2017-10-17 Thread lpuskas
Repository: ambari
Updated Branches:
  refs/heads/feature-branch-AMBARI-21307 d623a21fe -> 4c5e25101 (forced update)


AMBARI-22235. Druid service check failed during EU. (b-slim via nishantmonu51)


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: c8c1812b07ba0f64093190519cf829df8ea639d0
Parents: 20faae7
Author: Nishant 
Authored: Fri Oct 13 22:06:41 2017 +0530
Committer: Nishant 
Committed: Fri Oct 13 22:06:41 2017 +0530

--
 .../stacks/HDP/2.6/services/DRUID/kerberos.json | 45 
 .../HDP/2.6/services/SUPERSET/kerberos.json | 10 +
 2 files changed, 11 insertions(+), 44 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/c8c1812b/ambari-server/src/main/resources/stacks/HDP/2.6/services/DRUID/kerberos.json
--
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.6/services/DRUID/kerberos.json 
b/ambari-server/src/main/resources/stacks/HDP/2.6/services/DRUID/kerberos.json
index 198c351..f186e31 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.6/services/DRUID/kerberos.json
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.6/services/DRUID/kerberos.json
@@ -16,7 +16,7 @@
 {
   "name": "druid",
   "principal": {
-"value": "${druid-env/druid_user}@${realm}",
+"value": "${druid-env/druid_user}${principal_suffix}@${realm}",
 "type": "user",
 "configuration": 
"druid-common/druid.hadoop.security.kerberos.principal",
 "local_username": "${druid-env/druid_user}"
@@ -41,49 +41,22 @@
   ],
   "components": [
 {
-  "name": "DRUID_HISTORICAL",
-  "identities": [
-{
-  "name": "druid_druid_historical_druid",
-  "reference": "/druid"
-}
-  ]
+  "name": "DRUID_HISTORICAL"
 },
 {
-  "name": "DRUID_BROKER",
-  "identities": [
-{
-  "name": "druid_druid_broker_druid",
-  "reference": "/druid"
-}
-  ]
+  "name": "DRUID_BROKER"
 },
 {
-  "name": "DRUID_OVERLORD",
-  "identities": [
-{
-  "name": "druid_druid_historical_druid",
-  "reference": "/druid"
-}
-  ]
+  "name": "DRUID_OVERLORD"
 },
 {
-  "name": "DRUID_COORDINATOR",
-  "identities": [
-{
-  "name": "druid_druid_coordinator_druid",
-  "reference": "/druid"
-}
-  ]
+  "name": "DRUID_COORDINATOR"
 },
 {
-  "name": "DRUID_MIDDLEMANAGER",
-  "identities": [
-{
-  "name": "druid_druid_middlemanager_druid",
-  "reference": "/druid"
-}
-  ]
+  "name": "DRUID_MIDDLEMANAGER"
+},
+{
+  "name": "DRUID_ROUTER"
 }
   ],
   "configurations": [

http://git-wip-us.apache.org/repos/asf/ambari/blob/c8c1812b/ambari-server/src/main/resources/stacks/HDP/2.6/services/SUPERSET/kerberos.json
--
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.6/services/SUPERSET/kerberos.json
 
b/ambari-server/src/main/resources/stacks/HDP/2.6/services/SUPERSET/kerberos.json
index 5d5125d..0de6737 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.6/services/SUPERSET/kerberos.json
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.6/services/SUPERSET/kerberos.json
@@ -6,7 +6,7 @@
 {
   "name": "superset",
   "principal": {
-"value": "${superset-env/superset_user}@${realm}",
+"value": 
"${superset-env/superset_user}${principal_suffix}@${realm}",
 "type": "user",
 "configuration": "superset/KERBEROS_PRINCIPAL",
 "local_username": "${superset-env/superset_user}"
@@ -31,13 +31,7 @@
   ],
   "components": [
 {
-  "name": "SUPERSET",
-  "identities": [
-{
-  "name": "superset_superset_superset",
-  "reference": "/superset"
-}
-  ]
+  "name": "SUPERSET"
 }
   ],
   "configurations": [



[32/50] ambari git commit: AMBARI-21307 implemented user attribute detection. Organized code

2017-10-17 Thread lpuskas
AMBARI-21307 implemented user attribute detection. Organized code


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 07d2e0f499cfe48c63403ca0c13e148c1a012325
Parents: 4bc75b1
Author: lpuskas 
Authored: Tue Sep 12 08:10:47 2017 +0200
Committer: lpuskas 
Committed: Tue Oct 17 18:41:11 2017 +0200

--
 .../services/ldap/LdapConfigurationService.java |   2 +-
 .../server/ldap/AmbariLdapConfiguration.java|   9 ++
 .../server/ldap/service/AmbariLdapFacade.java   |   2 +-
 .../server/ldap/service/AttributeDetector.java  |  38 ++
 .../service/LdapAttributeDetectionService.java  |   7 +-
 .../ambari/server/ldap/service/LdapFacade.java  |   2 +-
 .../server/ldap/service/LdapSearchService.java  |  18 ---
 .../ads/DefaultAttributeDetectionService.java   | 132 ++-
 .../ads/DefaultLdapConfigurationService.java|   2 +-
 .../ldap/service/ads/ObjectClassDetector.java   |  81 
 .../ads/OccurranceAndWeightBasedDetector.java   |  81 
 .../service/ads/UserNameAttributeDetector.java  |  75 +++
 .../DefaultAttributeDetectionServiceTest.java   |  35 ++---
 13 files changed, 440 insertions(+), 44 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/07d2e0f4/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
index 1b8427b..66809c3 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
@@ -107,7 +107,7 @@ public class LdapConfigurationService extends 
AmbariConfigurationService {
 case TEST_ATTRIBUTES:
 
   LOGGER.info("Testing LDAP attributes ");
-  groups = 
ldapFacade.checkLdapAttibutes(ldapConfigurationRequest.getRequestInfo().getParameters(),
 ambariLdapConfiguration);
+  groups = 
ldapFacade.checkLdapAttributes(ldapConfigurationRequest.getRequestInfo().getParameters(),
 ambariLdapConfiguration);
   setResult(groups, result);
 
   break;

http://git-wip-us.apache.org/repos/asf/ambari/blob/07d2e0f4/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
index 76faeed..e28c6ed 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
@@ -98,6 +98,10 @@ public class AmbariLdapConfiguration {
 return value;
   }
 
+  public void setValueFor(AmbariLdapConfig ambariLdapConfig, Object value) {
+configurationMap.put(ambariLdapConfig.key(), value);
+  }
+
   @Inject
   public AmbariLdapConfiguration(@Assisted Map configuration) {
 this.configurationMap = configuration;
@@ -219,4 +223,9 @@ public class AmbariLdapConfiguration {
 return (String) configValue(AmbariLdapConfig.REFERRAL_HANDLING);
   }
 
+
+  @Override
+  public String toString() {
+return configurationMap.toString();
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/07d2e0f4/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
index 16bf6b7..f159418 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
@@ -90,7 +90,7 @@ public class AmbariLdapFacade implements LdapFacade {
   }
 
   @Override
-  public Set checkLdapAttibutes(Map parameters, 
AmbariLdapConfiguration ldapConfiguration) throws AmbariLdapException {
+  public Set checkLdapAttributes(Map parameters, 
AmbariLdapConfiguration ldapConfiguration) throws AmbariLdapException {
 Strin

[22/50] ambari git commit: AMBARI-21307 Added new resource related changes to the db creation ddl-s

2017-10-17 Thread lpuskas
AMBARI-21307 Added new resource related changes to the db creation ddl-s


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 80a293c63064c9b29bfb60a654f598cfef49
Parents: 7a308f5
Author: lpuskas 
Authored: Thu Jul 6 18:15:18 2017 +0200
Committer: lpuskas 
Committed: Tue Oct 17 18:41:08 2017 +0200

--
 .../AmbariConfigurationResourceProvider.java| 12 ++--
 .../server/orm/dao/AmbariConfigurationDAO.java  | 65 ++--
 .../apache/ambari/server/orm/dao/DaoUtils.java  | 13 +---
 .../main/resources/Ambari-DDL-Derby-CREATE.sql  | 21 +++
 .../main/resources/Ambari-DDL-MySQL-CREATE.sql  | 20 ++
 .../main/resources/Ambari-DDL-Oracle-CREATE.sql | 20 ++
 .../resources/Ambari-DDL-Postgres-CREATE.sql| 14 ++---
 .../resources/Ambari-DDL-SQLAnywhere-CREATE.sql | 20 ++
 .../resources/Ambari-DDL-SQLServer-CREATE.sql   | 20 ++
 9 files changed, 120 insertions(+), 85 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/80a293c6/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariConfigurationResourceProvider.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariConfigurationResourceProvider.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariConfigurationResourceProvider.java
index 5e5af9e..e8f186d 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariConfigurationResourceProvider.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariConfigurationResourceProvider.java
@@ -97,14 +97,14 @@ public class AmbariConfigurationResourceProvider extends 
AbstractAuthorizedResou
 }
   }
 
-  private static Set properties = Sets.newHashSet(
+  private static Set PROPERTIES = Sets.newHashSet(
 ResourcePropertyId.ID.getPropertyId(),
 ResourcePropertyId.TYPE.getPropertyId(),
 ResourcePropertyId.VERSION.getPropertyId(),
 ResourcePropertyId.VERSION_TAG.getPropertyId(),
 ResourcePropertyId.DATA.getPropertyId());
 
-  private static Map pkPropertyMap = 
Collections.unmodifiableMap(
+  private static Map PK_PROPERTY_MAP = 
Collections.unmodifiableMap(
 new HashMap() {{
   put(Resource.Type.AmbariConfiguration, 
ResourcePropertyId.ID.getPropertyId());
 }}
@@ -117,7 +117,7 @@ public class AmbariConfigurationResourceProvider extends 
AbstractAuthorizedResou
   private Gson gson;
 
   protected AmbariConfigurationResourceProvider() {
-super(properties, pkPropertyMap);
+super(PROPERTIES, PK_PROPERTY_MAP);
 
setRequiredCreateAuthorizations(EnumSet.of(RoleAuthorization.AMBARI_MANAGE_CONFIGURATION));
 
setRequiredDeleteAuthorizations(EnumSet.of(RoleAuthorization.AMBARI_MANAGE_CONFIGURATION));
 
@@ -126,7 +126,7 @@ public class AmbariConfigurationResourceProvider extends 
AbstractAuthorizedResou
 
   @Override
   protected Set getPKPropertyIds() {
-return Sets.newHashSet("AmbariConfiguration/id");
+return Sets.newHashSet(ResourcePropertyId.ID.getPropertyId());
   }
 
   @Override
@@ -137,7 +137,7 @@ public class AmbariConfigurationResourceProvider extends 
AbstractAuthorizedResou
 AmbariConfigurationEntity ambariConfigurationEntity = 
getEntityFromRequest(request);
 
 LOGGER.info("Persisting new ambari configuration: {} ", 
ambariConfigurationEntity);
-ambariConfigurationDAO.persist(ambariConfigurationEntity);
+ambariConfigurationDAO.create(ambariConfigurationEntity);
 
 return getRequestStatus(null);
   }
@@ -170,7 +170,7 @@ public class AmbariConfigurationResourceProvider extends 
AbstractAuthorizedResou
 } else {
   LOGGER.debug("Deleting amari configuration with id: {}", idFromRequest);
   try {
-ambariConfigurationDAO.deleteById(idFromRequest);
+ambariConfigurationDAO.removeByPK(idFromRequest);
   } catch (IllegalStateException e) {
 throw new NoSuchResourceException(e.getMessage());
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/80a293c6/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AmbariConfigurationDAO.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AmbariConfigurationDAO.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AmbariConfigurationDAO.java
index dea37eb..c29a423 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/orm/d

[42/50] ambari git commit: AMBARI-21307 Refactor - using the LdapConnectionTemplate for ldap operations

2017-10-17 Thread lpuskas
http://git-wip-us.apache.org/repos/asf/ambari/blob/999dc42b/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapAttributeDetectionServiceTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapAttributeDetectionServiceTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapAttributeDetectionServiceTest.java
deleted file mode 100644
index 878d1f0..000
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapAttributeDetectionServiceTest.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Licensed 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.ldap.service.ads;
-
-
-import java.util.Map;
-
-import org.apache.ambari.server.ldap.domain.AmbariLdapConfigKeys;
-import org.apache.ambari.server.ldap.domain.AmbariLdapConfiguration;
-import org.apache.ambari.server.ldap.domain.TestAmbariLdapConfigurationFactory;
-import org.apache.ambari.server.ldap.service.LdapConnectionService;
-import org.apache.directory.api.ldap.model.constants.SchemaConstants;
-import org.apache.directory.ldap.client.api.LdapConnection;
-import org.easymock.EasyMockRule;
-import org.easymock.TestSubject;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.collect.Maps;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-
-public class DefaultLdapAttributeDetectionServiceTest {
-
-  private static final Logger LOGGER = 
LoggerFactory.getLogger(DefaultLdapAttributeDetectionServiceTest.class);
-
-  @Rule
-  public EasyMockRule mocks = new EasyMockRule(this);
-
-  private AmbariLdapConfiguration testLdapConfiguration;
-  private TestAmbariLdapConfigurationFactory ldapConfigurationFactory = new 
TestAmbariLdapConfigurationFactory();
-
-  private LdapConnection connection;
-
-  @TestSubject
-  private DefaultLdapAttributeDetectionService attributeDetectionService = new 
DefaultLdapAttributeDetectionService();
-
-  @Before
-  public void before() {
-
-Map initialProps = Maps.newHashMap();
-initialProps.put(AmbariLdapConfigKeys.BIND_DN.key(), "");
-testLdapConfiguration = 
ldapConfigurationFactory.createLdapConfiguration(initialProps);
-  }
-
-  @Test
-  public void 
testShouldUserNameAttributeBeDetectedWhenSearchReturnsValidUsers() throws 
Exception {
-// GIVEN
-// a set of entries returned from the LDAP search
-
-// WHEN
-AmbariLdapConfiguration ambariLdapConfiguration = 
attributeDetectionService.detectLdapUserAttributes(connection, 
testLdapConfiguration);
-
-// THEN
-Assert.assertNotNull(ambariLdapConfiguration);
-Assert.assertEquals("The username attribute is not the expected", "uid", 
ambariLdapConfiguration.userNameAttribute());
-
-  }
-
-
-  @Test
-  public void functionalTest() throws Exception {
-// GIVEN
-AmbariLdapConfiguration ambariLdapConfiguration = 
ldapConfigurationFactory.createLdapConfiguration(getTestPropertiesMap());
-LdapConnectionService connectionService = new 
DefaultLdapConnectionService();
-LdapConnection ldapConnection = 
connectionService.createLdapConnection(ambariLdapConfiguration);
-
-// WHEN
-AmbariLdapConfiguration config = 
attributeDetectionService.detectLdapUserAttributes(ldapConnection, 
ambariLdapConfiguration);
-config = 
attributeDetectionService.detectLdapGroupAttributes(ldapConnection, 
ambariLdapConfiguration);
-
-Gson gson = new GsonBuilder().create();
-LOGGER.info(gson.toJson(config));
-
-// THEN
-ldapConnection.close();
-
-  }
-
-  private Map getTestPropertiesMap() {
-Map ldapPropsMap = Maps.newHashMap();
-
-ldapPropsMap.put(AmbariLdapConfigKeys.ANONYMOUS_BIND.key(), "true");
-ldapPropsMap.put(AmbariLdapConfigKeys.SERVER_HOST.key(), 
"ldap.forumsys.com");
-ldapPropsMap.put(AmbariLdapConfigKeys.SERVER_PORT.key(), "389");
-ldapPropsMap.put(AmbariLdapConfigKeys.BIND_DN.key(), 
"cn=read-only-admin,dc=example,dc=com");
-ldapPropsMap.put(AmbariLdapConfigKeys.BIND_PASSWORD.key(), "password");
-ldapPropsMap.put(AmbariLdapConfigKeys.DN_ATTRIBUTE.key(), 
SchemaConstants.CN_AT);
-
-ldapPropsMap.put(AmbariLdapConfigKeys.USER_SEARCH_BASE.key(), 
"dc=example,dc=com");
-ldapPropsMap.put(AmbariLdapConfigKeys.

[07/50] ambari git commit: AMBARI-22238 : Maven cleanup of ambari utility, logsearch and ambari metrics modules. (avijayan)

2017-10-17 Thread lpuskas
AMBARI-22238 : Maven cleanup of ambari utility, logsearch and ambari metrics 
modules. (avijayan)


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 499fec3c1ec7ddd18fae3a415da7e4d5de82d63b
Parents: 43fb597
Author: Aravindan Vijayan 
Authored: Sun Oct 15 09:41:13 2017 -0700
Committer: Aravindan Vijayan 
Committed: Sun Oct 15 09:41:13 2017 -0700

--
 ambari-infra/ambari-infra-assembly/pom.xml|  4 
 ambari-logsearch/ambari-logsearch-assembly/pom.xml|  4 +++-
 ambari-logsearch/ambari-logsearch-logfeeder/pom.xml   |  4 
 ambari-logsearch/ambari-logsearch-server/pom.xml  |  4 
 ambari-metrics/ambari-metrics-assembly/pom.xml|  2 ++
 ambari-metrics/ambari-metrics-common/pom.xml  |  6 ++
 ambari-metrics/ambari-metrics-timelineservice/pom.xml | 10 ++
 ambari-utility/pom.xml|  6 ++
 8 files changed, 39 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/499fec3c/ambari-infra/ambari-infra-assembly/pom.xml
--
diff --git a/ambari-infra/ambari-infra-assembly/pom.xml 
b/ambari-infra/ambari-infra-assembly/pom.xml
index dfb5c01..2b4959b 100644
--- a/ambari-infra/ambari-infra-assembly/pom.xml
+++ b/ambari-infra/ambari-infra-assembly/pom.xml
@@ -120,6 +120,9 @@
   
 
   
${solr.client.dir}/target/package
+  
+libs/checkstyle*.jar
+  
 
   
 
@@ -324,6 +327,7 @@
 root
 ${solr.client.mapping.path}
   
+  libs/checkstyle*.jar
 
   
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/499fec3c/ambari-logsearch/ambari-logsearch-assembly/pom.xml
--
diff --git a/ambari-logsearch/ambari-logsearch-assembly/pom.xml 
b/ambari-logsearch/ambari-logsearch-assembly/pom.xml
index e8a9426..cbc62ce 100644
--- a/ambari-logsearch/ambari-logsearch-assembly/pom.xml
+++ b/ambari-logsearch/ambari-logsearch-assembly/pom.xml
@@ -94,6 +94,7 @@
 classes/user_pass.json
 classes/HadoopServiceConfig.json
 solr_configsets/**
+libs/checkstyle*.jar
   
 
   
@@ -241,7 +242,7 @@
 root
   
   
-
classes/log4j.xml,classes/logsearch.properties,classes/user_pass.json,classes/HadoopServiceConfig.json,solr_configsets/**
+
classes/log4j.xml,classes/logsearch.properties,classes/user_pass.json,classes/HadoopServiceConfig.json,solr_configsets/**,libs/checkstyle*.jar
   
 
 
@@ -267,6 +268,7 @@
 root
 root
   
+  libs/checkstyle*.jar
 
   
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/499fec3c/ambari-logsearch/ambari-logsearch-logfeeder/pom.xml
--
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/pom.xml 
b/ambari-logsearch/ambari-logsearch-logfeeder/pom.xml
index 091f957..b1b6ece 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/pom.xml
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/pom.xml
@@ -163,6 +163,10 @@
   org.apache.curator
   curator-recipes
 
+
+  jdk.tools
+  jdk.tools
+
   
 
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/499fec3c/ambari-logsearch/ambari-logsearch-server/pom.xml
--
diff --git a/ambari-logsearch/ambari-logsearch-server/pom.xml 
b/ambari-logsearch/ambari-logsearch-server/pom.xml
index e90c58d..2ad35f5 100755
--- a/ambari-logsearch/ambari-logsearch-server/pom.xml
+++ b/ambari-logsearch/ambari-logsearch-server/pom.xml
@@ -380,6 +380,10 @@
   guava
   com.google.guava
 
+
+  jdk.tools
+  jdk.tools
+
   
 
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/499fec

[26/50] ambari git commit: AMBARI-21307 Implemented PUT operation, added unit tests

2017-10-17 Thread lpuskas
AMBARI-21307 Implemented PUT operation, added unit tests


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: c330ee6e8b3035ee7cfccc0fbd82f217fce2b4e6
Parents: 8942e3f
Author: lpuskas 
Authored: Thu Jul 13 16:20:58 2017 +0200
Committer: lpuskas 
Committed: Tue Oct 17 18:41:09 2017 +0200

--
 .../services/AmbariConfigurationService.java|  89 ---
 .../server/controller/ControllerModule.java |   2 +
 .../controller/ResourceProviderFactory.java |  24 +-
 .../AbstractControllerResourceProvider.java |   2 +
 .../AmbariConfigurationResourceProvider.java|  88 +--
 .../internal/DefaultProviderModule.java |   2 -
 .../server/orm/dao/AmbariConfigurationDAO.java  |   4 +
 ...AmbariConfigurationResourceProviderTest.java | 231 +++
 8 files changed, 364 insertions(+), 78 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/c330ee6e/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java
index 0c159b9..0632361 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java
@@ -56,16 +56,10 @@ import io.swagger.annotations.ApiResponses;
  *"data": [
  *{
  * "authentication.ldap.primaryUrl": "localhost:33389"
- *},
- *{
- *"authentication.ldap.secondaryUrl": "localhost:333"
- * },
- * {
+   "authentication.ldap.secondaryUrl": "localhost:333"
  * "authentication.ldap.baseDn": "dc=ambari,dc=apache,dc=org"
- * }
- * // ..
- * ]
- * }
+  * // ..
+ * ]
  * }
  * 
  */
@@ -74,7 +68,7 @@ import io.swagger.annotations.ApiResponses;
 public class AmbariConfigurationService extends BaseService {
 
   private static final String AMBARI_CONFIGURATION_REQUEST_TYPE =
-  
"org.apache.ambari.server.api.services.AmbariConfigurationRequestSwagger";
+"org.apache.ambari.server.api.services.AmbariConfigurationRequestSwagger";
 
   /**
* Creates an ambari configuration resource.
@@ -87,9 +81,9 @@ public class AmbariConfigurationService extends BaseService {
   @POST
   @Produces(MediaType.TEXT_PLAIN)
   @ApiOperation(value = "Creates an ambari configuration resource",
-  nickname = "AmbariConfigurationService#createAmbariConfiguration")
+nickname = "AmbariConfigurationService#createAmbariConfiguration")
   @ApiImplicitParams({
-  @ApiImplicitParam(dataType = AMBARI_CONFIGURATION_REQUEST_TYPE, 
paramType = PARAM_TYPE_BODY)
+@ApiImplicitParam(dataType = AMBARI_CONFIGURATION_REQUEST_TYPE, paramType 
= PARAM_TYPE_BODY)
   })
   @ApiResponses({
 @ApiResponse(code = HttpStatus.SC_CREATED, message = 
MSG_SUCCESSFUL_OPERATION),
@@ -108,24 +102,24 @@ public class AmbariConfigurationService extends 
BaseService {
   @GET
   @Produces(MediaType.TEXT_PLAIN)
   @ApiOperation(value = "Retrieve all ambari configuration resources",
-  nickname = "AmbariConfigurationService#getAmbariConfigurations",
-  notes = "Returns all Ambari configurations.",
-  response = AmbariConfigurationResponseSwagger.class,
-  responseContainer = RESPONSE_CONTAINER_LIST)
+nickname = "AmbariConfigurationService#getAmbariConfigurations",
+notes = "Returns all Ambari configurations.",
+response = AmbariConfigurationResponseSwagger.class,
+responseContainer = RESPONSE_CONTAINER_LIST)
   @ApiImplicitParams({
-  @ApiImplicitParam(name = QUERY_FIELDS, value = QUERY_FILTER_DESCRIPTION,
-  defaultValue = "AmbariConfiguration/data, AmbariConfiguration/id, 
AmbariConfiguration/type",
-  dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY),
-  @ApiImplicitParam(name = QUERY_SORT, value = QUERY_SORT_DESCRIPTION,
-  defaultValue = "AmbariConfiguration/id",
-  dataType = DATA_TYPE_STRIN

[13/50] ambari git commit: AMBARI-22220 - Should be able to switch the extension version to which a stack version is linked

2017-10-17 Thread lpuskas
AMBARI-0 - Should be able to switch the extension version to which a stack 
version is linked


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 5f86f159fae5f65b25ef77b5c9eb9cb7d1179834
Parents: 0317cf7
Author: Tim Thorpe 
Authored: Mon Oct 16 06:16:35 2017 -0700
Committer: Tim Thorpe 
Committed: Mon Oct 16 06:16:35 2017 -0700

--
 .../controller/AmbariManagementController.java  |   6 +-
 .../AmbariManagementControllerImpl.java |  50 
 .../controller/AmbariManagementHelper.java  |  26 
 .../internal/ExtensionLinkResourceProvider.java |  15 +++
 .../ambari/server/stack/ExtensionHelper.java|  31 -
 .../server/stack/StackManagerExtensionTest.java |  22 +++-
 .../resources/extensions/EXT/0.2/metainfo.xml   |   4 +-
 .../resources/extensions/EXT/0.4/metainfo.xml   |  32 +
 .../EXT/0.4/services/OOZIE2/metainfo.xml| 118 +++
 .../services/OOZIE2/themes/broken_theme.json|   3 +
 10 files changed, 273 insertions(+), 34 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/5f86f159/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java
index f0f13e1..45f9b3a 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java
@@ -369,18 +369,18 @@ public interface AmbariManagementController {
   void createExtensionLink(ExtensionLinkRequest request) throws 
AmbariException;
 
   /**
-   * Update a link between an extension and a stack
+   * Update a link - switch the link's extension version while keeping the 
same stack version and extension name
*
* @throws AmbariException if we fail to link the extension to the stack
*/
   void updateExtensionLink(ExtensionLinkRequest request) throws 
AmbariException;
 
   /**
-   * Update a link between an extension and a stack
+   * Update a link - switch the link's extension version while keeping the 
same stack version and extension name
*
* @throws AmbariException if we fail to link the extension to the stack
*/
-  void updateExtensionLink(ExtensionLinkEntity linkEntity) throws 
AmbariException;
+  void updateExtensionLink(ExtensionLinkEntity oldLinkEntity, 
ExtensionLinkRequest newLinkRequest) throws AmbariException;
 
   /**
* Delete a link between an extension and a stack

http://git-wip-us.apache.org/repos/asf/ambari/blob/5f86f159/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
index b0eb8ac..1b1f524 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
@@ -1126,7 +1126,7 @@ public class AmbariManagementControllerImpl implements 
AmbariManagementControlle
 try {
   cluster = clusters.getCluster(request.getClusterName());
 } catch (ClusterNotFoundException e) {
-  LOG.info(e.getMessage());
+  LOG.error("Cluster not found ", e);
   throw new ParentObjectNotFoundException("Parent Cluster resource doesn't 
exist", e);
 }
 
@@ -4795,9 +4795,7 @@ public class AmbariManagementControllerImpl implements 
AmbariManagementControlle
   properties = ambariMetaInfo.getServiceProperties(stackName, 
stackVersion, serviceName);
 }
 for (PropertyInfo property: properties) {
-  if (property.shouldBeConfigured()) {
-response.add(property.convertToResponse());
-  }
+  response.add(property.convertToResponse());
 }
 
 return response;
@@ -5622,12 +5620,9 @@ public class AmbariManagementControllerImpl implements 
AmbariManagementControlle
   }
 
   /**
-   * This method will update a link between an extension version and a stack 
version (Extension Link).
-   * Updating will only force ambari server to reread the stack and extension 
directories.
+   * Update a link 

[40/50] ambari git commit: AMBARI-21307 added javadocs, organized and cleaned the code

2017-10-17 Thread lpuskas
AMBARI-21307 added javadocs, organized and cleaned the code


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: ece357c5979b6ff915fac2ea6d620e9b5c86547d
Parents: 1045fde
Author: lpuskas 
Authored: Wed Sep 13 15:27:39 2017 +0200
Committer: lpuskas 
Committed: Tue Oct 17 18:41:12 2017 +0200

--
 .../server/ldap/LdapConfigurationFactory.java   |  13 +
 .../server/ldap/LdapConfigurationService.java   |  60 -
 .../apache/ambari/server/ldap/LdapModule.java   |   6 +-
 .../server/ldap/service/AmbariLdapFacade.java   |   9 +-
 .../server/ldap/service/AttributeDetector.java  |   3 +-
 .../ldap/service/LdapConfigurationService.java  |  60 +
 .../ambari/server/ldap/service/LdapFacade.java  |  10 +-
 .../ads/DefaultAttributeDetectionService.java   | 238 ---
 .../DefaultLdapAttributeDetectionService.java   | 238 +++
 .../ads/DefaultLdapConfigurationService.java|  17 +-
 .../detectors/UserGroupMemberAttrDetector.java  |   1 -
 .../DefaultAttributeDetectionServiceTest.java   | 108 -
 ...efaultLdapAttributeDetectionServiceTest.java | 108 +
 .../DefaultLdapConfigurationServiceTest.java|   2 +-
 14 files changed, 453 insertions(+), 420 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/ece357c5/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapConfigurationFactory.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapConfigurationFactory.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapConfigurationFactory.java
index 57cdf6e..67ac092 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapConfigurationFactory.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapConfigurationFactory.java
@@ -16,6 +16,19 @@ package org.apache.ambari.server.ldap;
 
 import java.util.Map;
 
+/**
+ * Factory interface for AmbariLdapConfiguration instances.
+ * It's registered as a factory in the GUICE context ( so no implementations 
required)
+ *
+ * To be extended with other factory methods upon needs.
+ */
 public interface LdapConfigurationFactory {
+
+  /**
+   * Creates an AmbariLdapConfiguration instance with the provided map of 
configuration settings.
+   *
+   * @param configuration a map where keys are the configuration properties 
and values are the configuration values
+   * @return an AmbariLdapConfiguration instance
+   */
   AmbariLdapConfiguration createLdapConfiguration(Map 
configuration);
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/ece357c5/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapConfigurationService.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapConfigurationService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapConfigurationService.java
deleted file mode 100644
index 69a641f..000
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapConfigurationService.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed 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.ldap;
-
-import java.util.Set;
-
-import org.apache.ambari.server.AmbariException;
-import org.apache.ambari.server.ldap.service.AmbariLdapException;
-import org.apache.directory.ldap.client.api.LdapConnection;
-
-/**
- * Collection of operations for validating ldap configuration.
- * It's intended to decouple implementations using different libraries.
- */
-public interface LdapConfigurationService {
-
-  /**
-   * Tests the connection based on the provided configuration.
-   *
-   * @param ldapConnection connection instance
-   * @param configuration  the ambari ldap configuration instance
-   * @throws AmbariLdapException if the connection is not possible
-   */
-  void checkConnection(LdapConnection ldapConnection, AmbariLdapConfiguration 
configurati

[08/50] ambari git commit: AMBARI-22232 : Need to add a new property to support proxy users for Atlas service. (Vishal Suvagia via mugdha)

2017-10-17 Thread lpuskas
AMBARI-22232 : Need to add a new property to support proxy users for Atlas 
service. (Vishal Suvagia via mugdha)


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: df1081378e51c309589540673e140faaf9329ee4
Parents: 499fec3
Author: Vishal Suvagia 
Authored: Sat Oct 14 16:22:31 2017 +0530
Committer: Mugdha Varadkar 
Committed: Mon Oct 16 11:15:23 2017 +0530

--
 .../AtlasProxyUserConfigCalculation.java|  48 +
 .../HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml |   4 +
 .../stacks/HDP/2.5/upgrades/upgrade-2.6.xml |   3 +
 .../configuration/application-properties.xml|  15 +++
 .../stacks/HDP/2.6/services/stack_advisor.py|   7 ++
 .../HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml |   4 +
 .../stacks/HDP/2.6/upgrades/upgrade-2.6.xml |   3 +
 .../AtlasProxyUserConfigCalculationTest.java| 108 +++
 .../stacks/2.6/common/test_stack_advisor.py |   3 +-
 9 files changed, 194 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/df108137/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculation.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculation.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculation.java
new file mode 100644
index 000..85fb200
--- /dev/null
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/AtlasProxyUserConfigCalculation.java
@@ -0,0 +1,48 @@
+package org.apache.ambari.server.serveraction.upgrades;
+
+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 javax.inject.Inject;
+import java.text.MessageFormat;
+import java.util.Map;
+import java.util.concurrent.ConcurrentMap;
+
+public class AtlasProxyUserConfigCalculation extends 
AbstractUpgradeServerAction {
+
+  private static final String ATLAS_APPLICATION_PROPERTIES_CONFIG_TYPE = 
"application-properties";
+  private static final String KNOX_ENV_CONFIG_TYPE = "knox-env";
+  private static final String KNOX_USER_CONFIG = "knox_user";
+
+  @Override
+  public CommandReport execute(ConcurrentMap 
requestSharedDataContext) throws AmbariException, InterruptedException {
+String clusterName = getExecutionCommand().getClusterName();
+Cluster cluster = getClusters().getCluster(clusterName);
+String outputMessage = "";
+
+Config atlasApplicationProperties = 
cluster.getDesiredConfigByType(ATLAS_APPLICATION_PROPERTIES_CONFIG_TYPE);
+if (null == atlasApplicationProperties) {
+  return createCommandReport(0, HostRoleStatus.COMPLETED, "{}",
+MessageFormat.format("Config type {0} not found, skipping updating 
property in same.", ATLAS_APPLICATION_PROPERTIES_CONFIG_TYPE), "");
+}
+
+Config knoxEnvConfig = 
cluster.getDesiredConfigByType(KNOX_ENV_CONFIG_TYPE);
+String atlasProxyUsers = "knox";
+if (null != knoxEnvConfig && 
knoxEnvConfig.getProperties().containsKey(KNOX_USER_CONFIG)) {
+  atlasProxyUsers = knoxEnvConfig.getProperties().get(KNOX_USER_CONFIG);
+}
+
+Map currentAtlasApplicationProperties = 
atlasApplicationProperties.getProperties();
+currentAtlasApplicationProperties.put("atlas.proxyusers", atlasProxyUsers);
+
atlasApplicationProperties.setProperties(currentAtlasApplicationProperties);
+atlasApplicationProperties.save();
+
+outputMessage = outputMessage + MessageFormat.format("Successfully updated 
{0} config type.\n", ATLAS_APPLICATION_PROPERTIES_CONFIG_TYPE);
+return createCommandReport(0, HostRoleStatus.COMPLETED, "{}", 
outputMessage, "");
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/df108137/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml
--
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml
 
b/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml
index 1af3b18..cd69a9c 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml
+++ 
b/ambari-serv

[23/50] ambari git commit: AMBARI-21307 Rest resource for supporting ambari configurations

2017-10-17 Thread lpuskas
AMBARI-21307 Rest resource for supporting ambari configurations


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 7a308f5ce7e73ebf19a26ee42980f80f9c355f5c
Parents: ce29f8c
Author: lpuskas 
Authored: Wed Jul 5 14:20:18 2017 +0200
Committer: lpuskas 
Committed: Tue Oct 17 18:41:08 2017 +0200

--
 .../resources/ResourceInstanceFactoryImpl.java  |   4 +
 .../services/AmbariConfigurationService.java| 146 +++
 .../internal/AbstractProviderModule.java|   2 +-
 .../AmbariConfigurationResourceProvider.java| 247 +++
 .../internal/DefaultProviderModule.java |  26 +-
 .../ambari/server/controller/spi/Resource.java  |   5 +-
 .../server/orm/dao/AmbariConfigurationDAO.java  |  92 +++
 .../orm/entities/AmbariConfigurationEntity.java |  70 ++
 .../orm/entities/ConfigurationBaseEntity.java   | 159 
 .../authorization/RoleAuthorization.java|  95 +++
 .../resources/Ambari-DDL-Postgres-CREATE.sql|  25 +-
 .../src/main/resources/META-INF/persistence.xml |   2 +
 12 files changed, 809 insertions(+), 64 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/7a308f5c/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ResourceInstanceFactoryImpl.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ResourceInstanceFactoryImpl.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ResourceInstanceFactoryImpl.java
index d0d115d..f5fb6e9 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ResourceInstanceFactoryImpl.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ResourceInstanceFactoryImpl.java
@@ -471,6 +471,10 @@ public class ResourceInstanceFactoryImpl implements 
ResourceInstanceFactory {
   case RemoteCluster:
 resourceDefinition = new RemoteClusterResourceDefinition();
 break;
+  case AmbariConfiguration:
+resourceDefinition = new 
SimpleResourceDefinition(Resource.Type.AmbariConfiguration, 
"ambariconfiguration", "ambariconfigurations");
+
+break;
 
   default:
 throw new IllegalArgumentException("Unsupported resource type: " + 
type);

http://git-wip-us.apache.org/repos/asf/ambari/blob/7a308f5c/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java
new file mode 100644
index 000..0fa6e44
--- /dev/null
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java
@@ -0,0 +1,146 @@
+/*
+ * Licensed 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.api.services;
+
+import java.util.Collections;
+
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
+import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.http.HttpStatus;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
+
+/**
+ * Rest endpoint for managing ambari configurations. Supports CRUD operations.
+ * Ambari configurations are resources that relate to the ambari server 
instance even before a cluster is provisioned.
+ *
+ *

[04/50] ambari git commit: AMBARI-22241: accumulo_script.py doesn't override init (Josh Elser via jluniya)

2017-10-17 Thread lpuskas
AMBARI-22241: accumulo_script.py doesn't override init (Josh Elser via jluniya)


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 329067797ecf70b765f6cd5a9febf89dcfbac0a5
Parents: 62a0a18
Author: Jayush Luniya 
Authored: Fri Oct 13 21:15:50 2017 -0700
Committer: Jayush Luniya 
Committed: Fri Oct 13 21:15:50 2017 -0700

--
 .../ACCUMULO/1.6.1.2.2.0/package/scripts/accumulo_script.py | 1 +
 1 file changed, 1 insertion(+)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/32906779/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/package/scripts/accumulo_script.py
--
diff --git 
a/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/package/scripts/accumulo_script.py
 
b/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/package/scripts/accumulo_script.py
index 6aafb05..2a95820 100644
--- 
a/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/package/scripts/accumulo_script.py
+++ 
b/ambari-server/src/main/resources/common-services/ACCUMULO/1.6.1.2.2.0/package/scripts/accumulo_script.py
@@ -37,6 +37,7 @@ from accumulo_service import accumulo_service
 class AccumuloScript(Script):
 
   def __init__(self, component):
+Script.__init__(self)
 self.component = component
 
 



[47/50] ambari git commit: AMBARI-21307 Improved the attribute detection implementation (using detector chains, added logging, improved guice setup).

2017-10-17 Thread lpuskas
AMBARI-21307 Improved the attribute detection implementation (using detector 
chains, added logging, improved guice setup).


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 3750daf39381e9a995fbbeb9f8a4665661ef630c
Parents: d5f8cc6
Author: lpuskas 
Authored: Mon Oct 16 18:24:32 2017 +0200
Committer: lpuskas 
Committed: Tue Oct 17 18:41:14 2017 +0200

--
 .../apache/ambari/server/ldap/LdapModule.java   | 32 +
 .../ldap/domain/AmbariLdapConfigKeys.java   | 11 +++
 .../server/ldap/service/AttributeDetector.java  |  6 +-
 .../DefaultLdapAttributeDetectionService.java   | 70 +---
 .../ads/detectors/AttributeDetectorFactory.java | 52 +++
 .../ads/detectors/ChainedAttributeDetector.java | 59 +
 .../ads/detectors/GroupMemberAttrDetector.java  |  6 ++
 .../ads/detectors/GroupNameAttrDetector.java|  6 ++
 .../ads/detectors/GroupObjectClassDetector.java |  6 ++
 .../OccurrenceAndWeightBasedDetector.java   | 10 ++-
 .../detectors/UserGroupMemberAttrDetector.java  |  6 ++
 .../ads/detectors/UserNameAttrDetector.java |  8 +++
 .../ads/detectors/UserObjectClassDetector.java  |  6 ++
 .../server/ldap/LdapModuleFunctionalTest.java   | 20 ++
 14 files changed, 255 insertions(+), 43 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/3750daf3/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapModule.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapModule.java 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapModule.java
index 67e84dc..089da1d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapModule.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapModule.java
@@ -19,6 +19,7 @@ import 
org.apache.ambari.server.ldap.domain.AmbariLdapConfiguration;
 import org.apache.ambari.server.ldap.domain.AmbariLdapConfigurationFactory;
 import org.apache.ambari.server.ldap.service.AmbariLdapConfigurationProvider;
 import org.apache.ambari.server.ldap.service.AmbariLdapFacade;
+import org.apache.ambari.server.ldap.service.AttributeDetector;
 import org.apache.ambari.server.ldap.service.LdapAttributeDetectionService;
 import org.apache.ambari.server.ldap.service.LdapConfigurationService;
 import org.apache.ambari.server.ldap.service.LdapConnectionConfigService;
@@ -26,15 +27,27 @@ import org.apache.ambari.server.ldap.service.LdapFacade;
 import 
org.apache.ambari.server.ldap.service.ads.DefaultLdapAttributeDetectionService;
 import 
org.apache.ambari.server.ldap.service.ads.DefaultLdapConfigurationService;
 import 
org.apache.ambari.server.ldap.service.ads.DefaultLdapConnectionConfigService;
+import 
org.apache.ambari.server.ldap.service.ads.detectors.AttributeDetectorFactory;
+import 
org.apache.ambari.server.ldap.service.ads.detectors.GroupMemberAttrDetector;
+import 
org.apache.ambari.server.ldap.service.ads.detectors.GroupNameAttrDetector;
+import 
org.apache.ambari.server.ldap.service.ads.detectors.GroupObjectClassDetector;
+import 
org.apache.ambari.server.ldap.service.ads.detectors.UserGroupMemberAttrDetector;
+import 
org.apache.ambari.server.ldap.service.ads.detectors.UserNameAttrDetector;
+import 
org.apache.ambari.server.ldap.service.ads.detectors.UserObjectClassDetector;
 
 import com.google.inject.AbstractModule;
 import com.google.inject.assistedinject.FactoryModuleBuilder;
+import com.google.inject.multibindings.Multibinder;
+import com.google.inject.name.Names;
 
 /**
  * GUICE configuration module for setting up LDAP related infrastructure.
  */
 public class LdapModule extends AbstractModule {
 
+  public static final String USER_ATTRIBUTES_DETECTORS = 
"UserAttributesDetectors";
+  public static final String GROUP_ATTRIBUTES_DETECTORS = 
"GroupAttributesDetectors";
+
   @Override
   protected void configure() {
 bind(LdapFacade.class).to(AmbariLdapFacade.class);
@@ -45,6 +58,25 @@ public class LdapModule extends AbstractModule {
 // this binding requires the JPA module!
 
bind(AmbariLdapConfiguration.class).toProvider(AmbariLdapConfigurationProvider.class);
 
+bind(AttributeDetectorFactory.class);
+
 install(new 
FactoryModuleBuilder().build(AmbariLdapConfigurationFactory.class));
+
+// binding the set of user attributes detector
+Multibinder userAttributeDetectorBinder = 
Multibinder.newSetBinder(binder(), AttributeDetector.class,
+  Names.named(USER_ATTRIBUTES_DETECTORS));
+userAttributeDetectorBi

[29/50] ambari git commit: AMBARI-21307 renamed package, minor corrections. Changed endpoint name

2017-10-17 Thread lpuskas
AMBARI-21307 renamed package, minor corrections. Changed endpoint name


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 818f36702430197d03ba9f3c9a2be0abdb7a878a
Parents: 5af0025
Author: lpuskas 
Authored: Mon Aug 14 13:21:07 2017 +0200
Committer: lpuskas 
Committed: Tue Oct 17 18:41:10 2017 +0200

--
 .../services/AmbariConfigurationService.java|   2 +-
 .../api/services/ldap/LdapRestService.java  |  15 +-
 .../server/ldap/AmbariLdapConfiguration.java|   5 +-
 .../apache/ambari/server/ldap/LdapModule.java   |   4 +-
 ...efaultLdapConfigurationValidatorService.java | 243 ---
 .../ad/DefaultLdapConnectionService.java|  63 -
 ...efaultLdapConfigurationValidatorService.java | 243 +++
 .../ads/DefaultLdapConnectionService.java   |  63 +
 ...ltLdapConfigurationValidatorServiceTest.java | 113 -
 ...ltLdapConfigurationValidatorServiceTest.java | 113 +
 10 files changed, 435 insertions(+), 429 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/818f3670/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java
index 927e518..492509f 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java
@@ -63,7 +63,7 @@ import io.swagger.annotations.ApiResponses;
  * }
  * 
  */
-@Path("/configurations/")
+@Path("/ambariconfigs/")
 @Api(value = "Ambari Configurations", description = "Endpoint for Ambari 
configuration related operations")
 public class AmbariConfigurationService extends BaseService {
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/818f3670/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapRestService.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapRestService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapRestService.java
index 8578204..4e654dc 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapRestService.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapRestService.java
@@ -34,6 +34,7 @@ import javax.inject.Inject;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.POST;
 import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
@@ -70,8 +71,9 @@ public class LdapRestService extends BaseService {
 
   @POST
   @ApiIgnore // until documented
-  @Path("/action") // todo this needs to be moved under the resource
+  @Path("/validate") // todo this needs to be moved under the resource
   @Consumes(MediaType.APPLICATION_JSON)
+  @Produces(MediaType.APPLICATION_JSON)
   public Response validateConfiguration(LdapCheckConfigurationRequest 
ldapCheckConfigurationRequest) {
 
 Set groups = Sets.newHashSet();
@@ -95,10 +97,7 @@ public class LdapRestService extends BaseService {
 
   LOGGER.info("Testing LDAP attributes ");
   groups = 
ldapFacade.checkLdapAttibutes(ldapCheckConfigurationRequest.getRequestInfo().getParameters(),
 ambariLdapConfiguration);
-  // todo factor out the resource creation, design better the 
structure in the response
-  Resource resource = new 
ResourceImpl(Resource.Type.AmbariConfiguration);
-  resource.setProperty("groups", groups);
-  result.getResultTree().addChild(resource, "payload");
+  setResult(groups, result);
 
   break;
 case "detect-attributes":
@@ -119,6 +118,12 @@ public class LdapRestService extends BaseService {
 return 
Response.status(result.getStatus().getStatusCode()).entity(getResultSerializer().serialize(result)).build();
   }
 
+  private void setResult(Set groups, Result result) {
+Resource resource = new ResourceImpl(Resource.Type.AmbariConfiguration);
+resource.setProperty("groups", groups);
+result.getResultTree().addChild(resource, "payload");
+  }
+
   

[45/50] ambari git commit: AMBARI-21307 organized code, fixed build failures

2017-10-17 Thread lpuskas
AMBARI-21307 organized code, fixed build failures


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: ea25d6e82d5ebd13a7cebfa0bf0c840fd76e93f7
Parents: 80ef857
Author: lpuskas 
Authored: Thu Sep 14 17:58:59 2017 +0200
Committer: lpuskas 
Committed: Tue Oct 17 18:41:13 2017 +0200

--
 .../ldap/domain/AmbariLdapConfigKeys.java   | 72 
 .../ldap/domain/AmbariLdapConfiguration.java|  3 -
 .../ldap/domain/LdapConfigurationFactory.java   |  2 +-
 .../ldap/service/AmbariLdapConfigKeys.java  | 72 
 .../DefaultLdapAttributeDetectionService.java   |  2 +-
 .../domain/AmbariLdapConfigurationTest.java | 19 ++
 .../TestAmbariLdapConfigurationFactory.java | 29 
 ...efaultLdapAttributeDetectionServiceTest.java |  9 ++-
 .../DefaultLdapConfigurationServiceTest.java| 19 +-
 9 files changed, 144 insertions(+), 83 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/ea25d6e8/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfigKeys.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfigKeys.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfigKeys.java
new file mode 100644
index 000..b7b41a3
--- /dev/null
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfigKeys.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed 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.ldap.domain;
+
+/**
+ * Constants representing supported LDAP related property names
+ * // todo extend this with validation information, description, defaults maybe
+ */
+public enum AmbariLdapConfigKeys {
+
+  LDAP_ENABLED("ambari.ldap.authentication.enabled"),
+  SERVER_HOST("ambari.ldap.connectivity.server.host"),
+  SERVER_PORT("ambari.ldap.connectivity.server.port"),
+  USE_SSL("ambari.ldap.connectivity.use_ssl"),
+
+  TRUST_STORE("ambari.ldap.connectivity.trust_store"),
+  TRUST_STORE_TYPE("ambari.ldap.connectivity.trust_store.type"),
+  TRUST_STORE_PATH("ambari.ldap.connectivity.trust_store.path"),
+  TRUST_STORE_PASSWORD("ambari.ldap.connectivity.trust_store.password"),
+  ANONYMOUS_BIND("ambari.ldap.connectivity.anonymous_bind"),
+
+  BIND_DN("ambari.ldap.connectivity.bind_dn"),
+  BIND_PASSWORD("ambari.ldap.connectivity.bind_password"),
+
+  ATTR_DETECTION("ambari.ldap.attributes.detection"), // manual | auto
+
+  DN_ATTRIBUTE("ambari.ldap.attributes.dn_attr"),
+
+  USER_OBJECT_CLASS("ambari.ldap.attributes.user.object_class"),
+  USER_NAME_ATTRIBUTE("ambari.ldap.attributes.user.name_attr"),
+  USER_GROUP_MEMBER_ATTRIBUTE("ambari.ldap.attributes.user.group_member_attr"),
+  USER_SEARCH_BASE("ambari.ldap.attributes.user.search_base"),
+
+  GROUP_OBJECT_CLASS("ambari.ldap.attributes.group.object_class"),
+  GROUP_NAME_ATTRIBUTE("ambari.ldap.attributes.group.name_attr"),
+  GROUP_MEMBER_ATTRIBUTE("ambari.ldap.attributes.group.member_attr"),
+  GROUP_SEARCH_BASE("ambari.ldap.attributes.group.search_base"),
+
+  USER_SEARCH_FILTER("ambari.ldap.advanced.user_search_filter"),
+  
USER_MEMBER_REPLACE_PATTERN("ambari.ldap.advanced.user_member_replace_pattern"),
+  USER_MEMBER_FILTER("ambari.ldap.advanced.user_member_filter"),
+
+  GROUP_SEARCH_FILTER("ambari.ldap.advanced.group_search_filter"),
+  
GROUP_MEMBER_REPLACE_PATTERN("ambari.ldap.advanced.group_member_replace_pattern"),
+  GROUP_MEMBER_FILTER("ambari.ldap.advanced.group_member_filter"),
+
+  FORCE_LOWERCASE_USERNAMES("ambari.ldap.advanced.force_lowercase_usernames"),
+  REFERRAL_HANDLING("ambari.ldap.advanced.referrals"), // folow
+  PAGINATION_ENABLED("ambari.ldap.a

[17/50] ambari git commit: AMBARI-22245 - YARN Service Checks Fails Because of Old hadoop-client Classpath Entry (part2) (jonathanhurley)

2017-10-17 Thread lpuskas
AMBARI-22245 - YARN Service Checks Fails Because of Old hadoop-client Classpath 
Entry (part2) (jonathanhurley)


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 79d4ac220d41a6bd7c5e77b34ecc230f439cd968
Parents: 75102dc
Author: Jonathan Hurley 
Authored: Mon Oct 16 20:06:40 2017 -0400
Committer: Jonathan Hurley 
Committed: Mon Oct 16 20:06:59 2017 -0400

--
 .../YARN/3.0.0.3.0/package/scripts/status_params.py   | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/79d4ac22/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/status_params.py
--
diff --git 
a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/status_params.py
 
b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/status_params.py
index 6bb528f..d2d1307 100644
--- 
a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/status_params.py
+++ 
b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/status_params.py
@@ -33,11 +33,11 @@ mapred_pid_dir_prefix = 
config['configurations']['mapred-env']['mapred_pid_dir_p
 yarn_pid_dir = format("{yarn_pid_dir_prefix}/{yarn_user}")
 mapred_pid_dir = format("{mapred_pid_dir_prefix}/{mapred_user}")
 
-resourcemanager_pid_file = 
format("{yarn_pid_dir}/yarn-{yarn_user}-resourcemanager.pid")
-nodemanager_pid_file = 
format("{yarn_pid_dir}/yarn-{yarn_user}-nodemanager.pid")
-yarn_historyserver_pid_file_old = 
format("{yarn_pid_dir}/yarn-{yarn_user}-historyserver.pid")
-yarn_historyserver_pid_file = 
format("{yarn_pid_dir}/yarn-{yarn_user}-timelineserver.pid")  # 
*-historyserver.pid is deprecated
-mapred_historyserver_pid_file = 
format("{mapred_pid_dir}/mapred-{mapred_user}-historyserver.pid")
+resourcemanager_pid_file = 
format("{yarn_pid_dir}/hadoop-{yarn_user}-resourcemanager.pid")
+nodemanager_pid_file = 
format("{yarn_pid_dir}/hadoop-{yarn_user}-nodemanager.pid")
+yarn_historyserver_pid_file_old = 
format("{yarn_pid_dir}/hadoop-{yarn_user}-historyserver.pid")
+yarn_historyserver_pid_file = 
format("{yarn_pid_dir}/hadoop-{yarn_user}-timelineserver.pid")  # 
*-historyserver.pid is deprecated
+mapred_historyserver_pid_file = 
format("{mapred_pid_dir}/hadoop-{mapred_user}-historyserver.pid")
 
 hadoop_home = stack_select.get_hadoop_dir("home")
 hadoop_conf_dir = functions.conf_select.get_hadoop_conf_dir()



[20/50] ambari git commit: AMBARI-22246 Restart HDFS/JOURNALNODE failed on revert patch upgrade(dgrinenko)

2017-10-17 Thread lpuskas
AMBARI-22246 Restart HDFS/JOURNALNODE failed on revert patch upgrade(dgrinenko)


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: ce29f8ce7762ed6c6d5c2f50d882b6e03b23acfc
Parents: d6cd303
Author: Dmytro Grinenko 
Authored: Tue Oct 17 16:53:47 2017 +0300
Committer: Dmytro Grinenko 
Committed: Tue Oct 17 16:53:47 2017 +0300

--
 .../ambari/server/state/UpgradeContext.java | 55 ++--
 .../ambari/server/state/UpgradeContextTest.java | 38 +-
 2 files changed, 75 insertions(+), 18 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/ce29f8ce/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContext.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContext.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContext.java
index de0f868..cb44adb 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContext.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeContext.java
@@ -261,6 +261,38 @@ public class UpgradeContext {
*/
   private RepositoryType m_orchestration = RepositoryType.STANDARD;
 
+  /**
+   * Reading upgrade type from provided request  or if nothing were provided,
+   * from previous upgrade for downgrade direction.
+   *
+   * @param upgradeRequestMap arguments provided for current upgrade request
+   * @param upgradeEntity previous upgrade entity, should be passed only for 
downgrade direction
+   *
+   * @return
+   * @throws AmbariException
+   */
+  private UpgradeType calculateUpgradeType(Map 
upgradeRequestMap,
+   UpgradeEntity upgradeEntity) throws 
AmbariException{
+
+UpgradeType upgradeType = UpgradeType.ROLLING;
+
+String upgradeTypeProperty = (String) upgradeRequestMap.get(UPGRADE_TYPE);
+boolean upgradeTypePassed = StringUtils.isNotBlank(upgradeTypeProperty);
+
+if (upgradeTypePassed){
+  try {
+upgradeType = 
UpgradeType.valueOf(upgradeRequestMap.get(UPGRADE_TYPE).toString());
+  } catch (Exception e) {
+throw new AmbariException(String.format("Property %s has an incorrect 
value of %s.",
+  UPGRADE_TYPE, upgradeTypeProperty));
+  }
+} else if (upgradeEntity != null){
+  upgradeType = upgradeEntity.getUpgradeType();
+}
+
+return upgradeType;
+  }
+
   @AssistedInject
   public UpgradeContext(@Assisted Cluster cluster,
   @Assisted Map upgradeRequestMap, Gson gson, 
UpgradeHelper upgradeHelper,
@@ -271,23 +303,7 @@ public class UpgradeContext {
 m_upgradeHelper = upgradeHelper;
 m_upgradeDAO = upgradeDAO;
 m_repoVersionDAO = repoVersionDAO;
-
 m_cluster = cluster;
-
-// determine upgrade type (default is ROLLING)
-String upgradeTypeProperty = (String) upgradeRequestMap.get(UPGRADE_TYPE);
-if (StringUtils.isNotBlank(upgradeTypeProperty)) {
-  try {
-m_type = 
UpgradeType.valueOf(upgradeRequestMap.get(UPGRADE_TYPE).toString());
-  } catch (Exception e) {
-throw new AmbariException(String.format("Property %s has an incorrect 
value of %s.",
-UPGRADE_TYPE, upgradeTypeProperty));
-  }
-} else {
-  // default type
-  m_type= UpgradeType.ROLLING;
-}
-
 m_isRevert = upgradeRequestMap.containsKey(UPGRADE_REVERT_UPGRADE_ID);
 
 if (m_isRevert) {
@@ -316,13 +332,15 @@ public class UpgradeContext {
 "Only successfully completed upgrades can be reverted. Downgrades 
cannot be reverted.");
   }
 
-  if (revertableUpgrade.getId() != revertUpgrade.getId()) {
+  if (!revertableUpgrade.getId().equals(revertUpgrade.getId())) {
 throw new AmbariException(String.format(
 "The only upgrade which is currently allowed to be reverted for 
cluster %s is upgrade ID %s which was an upgrade to %s",
 cluster.getClusterName(), revertableUpgrade.getId(),
 revertableUpgrade.getRepositoryVersion().getVersion()));
   }
 
+  m_type = calculateUpgradeType(upgradeRequestMap, revertUpgrade);
+
   // !!! build all service-specific reversions
   Set priors = new HashSet<>();
   Map clusterServices = cluster.getServices();
@@ -382,6 +400,8 @@ public class UpgradeContext {
 UPGRADE_REPO_VERSION_ID, m_direction));
   }
 
+  m_type = calculateUpgradeType(upgradeRequestMap, null);
+
   // depending on the repository, add services
   m_repositoryVersion = 

[34/50] ambari git commit: AMBARI-21307 Add all known LDAP properties to AmbariConfigurationEnum (benyoka)

2017-10-17 Thread lpuskas
AMBARI-21307 Add all known LDAP properties to AmbariConfigurationEnum (benyoka)


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: ebb454c4d700dfca3dfc38d608ca89f5be9b4e19
Parents: bb9faa7
Author: Balazs Bence Sari 
Authored: Mon Sep 4 12:45:07 2017 +0200
Committer: lpuskas 
Committed: Tue Oct 17 18:41:11 2017 +0200

--
 .../ambari/server/ldap/AmbariLdapConfiguration.java  | 15 ++-
 1 file changed, 14 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/ebb454c4/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
index b1cbced..e913e77 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
@@ -40,22 +40,35 @@ public class AmbariLdapConfiguration {
 USE_SSL("ambari.ldap.usessl"),
 LDAP_SERVER_HOST("ambari.ldap.server.host"),
 LDAP_SERVER_PORT("ambari.ldap.server.port"),
+LDAP_TRUSTSTORE("ambari.ldap.truststore"),
 LDAP_TRUSTSTORE_TYPE("ambari.ldap.truststore.type"),
 LDAP_TRUSTSTORE_PATH("ambari.ldap.truststore.path"),
+LDAP_TRUSTSTORE_PASSWORD("ambari.ldap.truststore.password"),
 BASE_DN("ambari.ldap.bind.dn"),
+REFERRAL("ambari.ldap.referral"),
+PAGINATION_ENABLED("ambari.ldap.pagination.enabled"),
 
 BIND_ANONIMOUSLY("ambari.ldap.bindanonymously"),
 MANAGER_DN("ambari.ldap.managerdn"),
 MANAGER_PASSWORD("ambari.ldap.managerpassword"),
 USER_OBJECT_CLASS("ambari.ldap.user.object.class"),
 USER_NAME_ATTRIBUTE("ambari.ldap.user.name.attribute"),
+USER_NAME_FORCE_LOWERCASE("ambari.ldap.username.force.lowercase"),
 USER_SEARCH_BASE("ambari.ldap.user.search.base"),
+
SYNC_USER_MEMBER_REPLACE_PATTERN("ambari.ldap.sync.user.member.replacepattern"),
+SYNC_USER_MEMBER_FILTER("ambari.ldap.sync.user.member_filter"),
 
+ADMIN_GROUP_MAPPING_RULES ("ambari.ldap.admin.group.mappingrules"),
 GROUP_OBJECT_CLASS("ambari.ldap.group.object.class"),
 GROUP_NAME_ATTRIBUTE("ambari.ldap.group.name.attribute"),
 GROUP_MEMBER_ATTRIBUTE("ambari.ldap.group.member.attribute"),
 GROUP_SEARCH_BASE("ambari.ldap.group.search.base"),
-DN_ATTRIBUTE("authentication.ldap.dnAttribute");
+
SYNC_GROUP_MEMBER_REPLACE_PATTERN("ambari.ldap.sync.group.member.replacepattern"),
+SYNC_GROUP_MEMBER_FILTER("ambari.ldap.sync.group.member_filter"),
+DN_ATTRIBUTE("authentication.ldap.dnAttribute"),
+
+TEST_USER_NAME("ambari.ldap.test.user.name"),
+TEST_USER_PASSWORD("ambari.ldap.test.user.password");
 
 private String propertyName;
 



[09/50] ambari git commit: AMBARI-22216. Ambari Schema Upgrade Failed during Ambari Upgrade - workaround (dlysnichenko)

2017-10-17 Thread lpuskas
AMBARI-22216. Ambari Schema Upgrade Failed during Ambari Upgrade - workaround 
(dlysnichenko)


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: e219186ea68a869ee0b7929dfd6c5322cf8c1e7b
Parents: df10813
Author: Lisnichenko Dmitro 
Authored: Mon Oct 16 12:13:01 2017 +0300
Committer: Lisnichenko Dmitro 
Committed: Mon Oct 16 12:13:47 2017 +0300

--
 .../ambari/server/upgrade/UpgradeCatalog260.java | 19 +++
 1 file changed, 19 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/e219186e/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog260.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog260.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog260.java
index 866a501..71a0ff3 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog260.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog260.java
@@ -81,6 +81,7 @@ public class UpgradeCatalog260 extends AbstractUpgradeCatalog 
{
   public static final String DESIRED_REPO_VERSION_ID_COLUMN = 
"desired_repo_version_id";
   public static final String REPO_STATE_COLUMN = "repo_state";
   public static final String FK_SCDS_DESIRED_STACK_ID = 
"FK_scds_desired_stack_id";
+  public static final String FK_SERVICECOMPONENTDESIREDSTATE_DESIRED_STACK_ID 
= "FK_servicecomponentdesiredstate_desired_stack_id";
   public static final String FK_SCDS_DESIRED_REPO_ID = 
"FK_scds_desired_repo_id";
 
   public static final String REPO_VERSION_TABLE = "repo_version";
@@ -152,6 +153,9 @@ public class UpgradeCatalog260 extends 
AbstractUpgradeCatalog {
   public static final String STALE_POSTGRESS_USERS_LDAP_USER_KEY = 
"users_ldap_user_key";
   public static final String SHORT_URL_COLUMN = "short_url";
   public static final String FK_INSTANCE_URL_ID = "FK_instance_url_id";
+  public static final String FK_SERVICEDESIREDSTATE_DESIRED_STACK_ID = 
"FK_servicedesiredstate_desired_stack_id";
+  public static final String FK_HOSTCOMPONENTDESIREDSTATE_DESIRED_STACK_ID = 
"FK_hostcomponentdesiredstate_desired_stack_id";
+  public static final String FK_HOSTCOMPONENTSTATE_CURRENT_STACK_ID = 
"FK_hostcomponentstate_current_stack_id";
 
 
   /**
@@ -187,6 +191,7 @@ public class UpgradeCatalog260 extends 
AbstractUpgradeCatalog {
   @Override
   protected void executeDDLUpdates() throws AmbariException, SQLException {
 int currentVersionID = getCurrentVersionID();
+dropBrokenFK();
 updateServiceComponentDesiredStateTable(currentVersionID);
 updateServiceDesiredStateTable(currentVersionID);
 addSelectedCollumsToClusterconfigTable();
@@ -202,6 +207,20 @@ public class UpgradeCatalog260 extends 
AbstractUpgradeCatalog {
 removeStaleConstraints();
   }
 
+  /**
+   * Drop broken FK
+   * {@value #FK_SERVICECOMPONENTDESIREDSTATE_DESIRED_STACK_ID}
+   * {@value #FK_SERVICEDESIREDSTATE_DESIRED_STACK_ID}
+   * {@value #FK_HOSTCOMPONENTDESIREDSTATE_DESIRED_STACK_ID}
+   * {@value #FK_HOSTCOMPONENTSTATE_CURRENT_STACK_ID}
+   */
+  private void dropBrokenFK() throws SQLException {
+dbAccessor.dropFKConstraint(SERVICE_COMPONENT_DESIRED_STATE_TABLE, 
FK_SERVICECOMPONENTDESIREDSTATE_DESIRED_STACK_ID);
+dbAccessor.dropFKConstraint(SERVICE_DESIRED_STATE_TABLE, 
FK_SERVICEDESIREDSTATE_DESIRED_STACK_ID);
+dbAccessor.dropFKConstraint(HOST_COMPONENT_DESIRED_STATE_TABLE, 
FK_HOSTCOMPONENTDESIREDSTATE_DESIRED_STACK_ID);
+dbAccessor.dropFKConstraint(HOST_COMPONENT_STATE_TABLE, 
FK_HOSTCOMPONENTSTATE_CURRENT_STACK_ID);
+  }
+
 
   /**
* Updates {@value #VIEWURL_TABLE} table.



[18/50] ambari git commit: AMBARI-22248. HBase default.rootdir config results in deploy failure if value is not overriden. (swagle)

2017-10-17 Thread lpuskas
AMBARI-22248. HBase default.rootdir config results in deploy failure if value 
is not overriden. (swagle)


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: e19029cbd419fc6512350c365e43faff60d4acc9
Parents: 79d4ac2
Author: Siddharth Wagle 
Authored: Mon Oct 16 17:57:42 2017 -0700
Committer: Siddharth Wagle 
Committed: Mon Oct 16 17:57:42 2017 -0700

--
 .../HBASE/0.96.0.2.0/configuration/hbase-site.xml  | 17 +
 1 file changed, 9 insertions(+), 8 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/e19029cb/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/configuration/hbase-site.xml
--
diff --git 
a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/configuration/hbase-site.xml
 
b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/configuration/hbase-site.xml
index 54ab35d..a48aad4 100644
--- 
a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/configuration/hbase-site.xml
+++ 
b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/configuration/hbase-site.xml
@@ -22,15 +22,16 @@
 
   
 hbase.rootdir
-hdfs://localhost:8020/apps/hbase/data
+/apps/hbase/data
 The directory shared by region servers and into
-which HBase persists.  The URL should be 'fully-qualified'
-to include the filesystem scheme.  For example, to specify the
-HDFS directory '/hbase' where the HDFS instance's namenode is
-running at namenode.example.org on port 9000, set this value to:
-hdfs://namenode.example.org:9000/hbase.  By default HBase writes
-into /tmp.  Change this configuration else all data will be lost
-on machine restart.
+  which HBase persists.  The URL should be 'fully-qualified'
+  to include the filesystem scheme.  For example, to specify the
+  HDFS directory '/hbase' where the HDFS instance's namenode is
+  running at namenode.example.org on port 9000, set this value to:
+  hdfs://namenode.example.org:9000/hbase.  By default HBase writes
+  into /tmp.  Change this configuration else all data will be lost
+  on machine restart. Ambari sets this a scheme less value which defaults 
to
+  a HDFS relative path.
 
 
   



[38/50] ambari git commit: AMBARI-2130 ldap connections handled in thefacade. Code cleanup

2017-10-17 Thread lpuskas
AMBARI-2130 ldap connections handled in thefacade. Code cleanup


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: d5636400d154c0fd6e060248394079d838813e83
Parents: daa4aa8
Author: lpuskas 
Authored: Tue Sep 12 15:38:25 2017 +0200
Committer: lpuskas 
Committed: Tue Oct 17 18:41:12 2017 +0200

--
 .../server/ldap/service/AmbariLdapFacade.java   | 51 +
 .../ldap/service/LdapConnectionService.java | 12 ++-
 .../ambari/server/ldap/service/LdapFacade.java  |  2 +-
 .../ads/DefaultLdapConfigurationService.java| 77 
 .../ads/DefaultLdapConnectionService.java   | 41 ++-
 .../OccurranceAndWeightBasedDetector.java   |  2 +-
 6 files changed, 103 insertions(+), 82 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/d5636400/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
index f159418..d2bdef3 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
@@ -19,7 +19,6 @@ import java.util.Map;
 import java.util.Set;
 
 import javax.inject.Inject;
-import javax.inject.Provider;
 import javax.inject.Singleton;
 
 import org.apache.ambari.server.ldap.AmbariLdapConfiguration;
@@ -58,35 +57,59 @@ public class AmbariLdapFacade implements LdapFacade {
   @Inject
   private LdapAttributeDetectionService ldapAttributeDetectionService;
 
-  //todo remove this, added for testing purposes only
-  @Inject
-  private Provider ambariLdapConfigurationProvider;
-
   @Inject
   public AmbariLdapFacade() {
   }
 
   @Override
   public void checkConnection(AmbariLdapConfiguration ambariLdapConfiguration) 
throws AmbariLdapException {
+LdapConnection connection = null;
 try {
+
   LOGGER.info("Validating LDAP connection related configuration based on: 
{}", ambariLdapConfiguration);
-  LdapConnection connection = 
ldapConnectionService.createLdapConnection(ambariLdapConfiguration);
+  connection = 
ldapConnectionService.getBoundLdapConnection(ambariLdapConfiguration);
   ldapConfigurationService.checkConnection(connection, 
ambariLdapConfiguration);
-} catch (AmbariLdapException e) {
+  LOGGER.info("Validating LDAP connection related configuration: SUCCESS");
+
+} catch (Exception e) {
+
   LOGGER.error("Validating LDAP connection configuration failed", e);
-  throw e;
+  throw new AmbariLdapException(e);
+
+} finally {
+  try {
+connection.unBind();
+connection.close();
+  } catch (Exception e) {
+throw new AmbariLdapException(e);
+  }
 }
-LOGGER.info("Validating LDAP connection related configuration: SUCCESS");
+
   }
 
 
   @Override
-  public AmbariLdapConfiguration detectAttributes(AmbariLdapConfiguration 
ambariLdapConfiguration) {
+  public AmbariLdapConfiguration detectAttributes(AmbariLdapConfiguration 
ambariLdapConfiguration) throws AmbariLdapException {
 LOGGER.info("Detecting LDAP configuration attributes ...");
 
-LdapConnection connection = 
ldapConnectionService.createLdapConnection(ambariLdapConfiguration);
-ambariLdapConfiguration = 
ldapAttributeDetectionService.detectLdapUserAttributes(connection, 
ambariLdapConfiguration);
-return ambariLdapConfiguration;
+LdapConnection connection = 
ldapConnectionService.getBoundLdapConnection(ambariLdapConfiguration);
+try {
+
+  ambariLdapConfiguration = 
ldapAttributeDetectionService.detectLdapUserAttributes(connection, 
ambariLdapConfiguration);
+  ambariLdapConfiguration = 
ldapAttributeDetectionService.detectLdapGroupAttributes(connection, 
ambariLdapConfiguration);
+  return ambariLdapConfiguration;
+
+} catch (Exception e) {
+  LOGGER.error("Error during LDAP attribute detection", e);
+  throw new AmbariLdapException(e);
+} finally {
+  try {
+connection.unBind();
+connection.close();
+  } catch (Exception e) {
+throw new AmbariLdapException(e);
+  }
+}
   }
 
   @Override
@@ -98,7 +121,7 @@ public class AmbariLdapFacade implements LdapFacade {
   throw new IllegalArgumentException("No test user available for testin

[41/50] ambari git commit: AMBARI-21307 Ldapconnection template optimization, basic support for custom trust store

2017-10-17 Thread lpuskas
AMBARI-21307 Ldapconnection template optimization, basic support for custom 
trust store


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 8a57f21b92e99d66a0fb2106657fc84065e12dc2
Parents: 999dc42
Author: lpuskas 
Authored: Mon Oct 9 17:20:38 2017 +0200
Committer: lpuskas 
Committed: Tue Oct 17 18:41:13 2017 +0200

--
 .../apache/ambari/server/ldap/LdapModule.java   |   8 +-
 .../service/LdapAttributeDetectionService.java  |   4 +-
 .../service/LdapConnectionConfigService.java|  34 ++
 .../service/LdapConnectionTemplateProvider.java |  56 -
 .../DefaultLdapAttributeDetectionService.java   |   4 +-
 .../ads/DefaultLdapConfigurationService.java|  11 +-
 .../ads/LdapConnectionTemplateFactory.java  |  56 +
 .../DefaultLdapConnectionConfigService.java | 116 +++
 .../server/ldap/LdapModuleFunctionalTest.java   |  28 +
 9 files changed, 224 insertions(+), 93 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/8a57f21b/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapModule.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapModule.java 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapModule.java
index d59264a..4abf4e7 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapModule.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapModule.java
@@ -21,11 +21,11 @@ import 
org.apache.ambari.server.ldap.service.AmbariLdapConfigurationProvider;
 import org.apache.ambari.server.ldap.service.AmbariLdapFacade;
 import org.apache.ambari.server.ldap.service.LdapAttributeDetectionService;
 import org.apache.ambari.server.ldap.service.LdapConfigurationService;
-import org.apache.ambari.server.ldap.service.LdapConnectionTemplateProvider;
+import org.apache.ambari.server.ldap.service.LdapConnectionConfigService;
 import org.apache.ambari.server.ldap.service.LdapFacade;
 import 
org.apache.ambari.server.ldap.service.ads.DefaultLdapAttributeDetectionService;
 import 
org.apache.ambari.server.ldap.service.ads.DefaultLdapConfigurationService;
-import org.apache.directory.ldap.client.template.LdapConnectionTemplate;
+import 
org.apache.ambari.server.ldap.service.ads.detectors.DefaultLdapConnectionConfigService;
 
 import com.google.inject.AbstractModule;
 import com.google.inject.assistedinject.FactoryModuleBuilder;
@@ -40,13 +40,11 @@ public class LdapModule extends AbstractModule {
 bind(LdapFacade.class).to(AmbariLdapFacade.class);
 
bind(LdapConfigurationService.class).to(DefaultLdapConfigurationService.class);
 
bind(LdapAttributeDetectionService.class).to(DefaultLdapAttributeDetectionService.class);
+
bind(LdapConnectionConfigService.class).to(DefaultLdapConnectionConfigService.class);
 
 // this binding requires the JPA module!
 
bind(AmbariLdapConfiguration.class).toProvider(AmbariLdapConfigurationProvider.class);
 
-// bind to the provider implementation (let GUICE deal with instantiating 
3rd party instances)
-
bind(LdapConnectionTemplate.class).toProvider(LdapConnectionTemplateProvider.class);
-
 install(new 
FactoryModuleBuilder().build(AmbariLdapConfigurationFactory.class));
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/8a57f21b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/LdapAttributeDetectionService.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/LdapAttributeDetectionService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/LdapAttributeDetectionService.java
index 6cd369b..c08a2e0 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/LdapAttributeDetectionService.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/LdapAttributeDetectionService.java
@@ -27,7 +27,7 @@ public interface LdapAttributeDetectionService {
* @param ambariLdapConfiguration configuration instance holding connection 
details
* @return the configuration decorated with user related attributes
*/
-  AmbariLdapConfiguration detectLdapUserAttributes(AmbariLdapConfiguration 
ambariLdapConfiguration);
+  AmbariLdapConfiguration detectLdapUserAttributes(AmbariLdapConfiguration 
ambariLdapConfiguration) throws AmbariLdapException;
 
   /**
* Decorates the passed in configuration with the detected ldap group 
attribute values
@@ -35,6 +35,6 @@ public

[49/50] ambari git commit: AMBARI-21307 Fixed failing unit tests (in most cases the new guice module was needed)

2017-10-17 Thread lpuskas
AMBARI-21307 Fixed failing unit tests (in most cases the new guice module was 
needed)


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 4fc261a63049ca4aa83ab1777b1475941fe307bb
Parents: ec27529
Author: lpuskas 
Authored: Thu Oct 12 19:25:24 2017 +0200
Committer: lpuskas 
Committed: Tue Oct 17 18:41:14 2017 +0200

--
 .../main/resources/Ambari-DDL-Derby-CREATE.sql  |  2 +-
 .../main/resources/Ambari-DDL-MySQL-CREATE.sql  |  2 +-
 .../main/resources/Ambari-DDL-Oracle-CREATE.sql |  2 +-
 .../resources/Ambari-DDL-Postgres-CREATE.sql|  2 +-
 .../resources/Ambari-DDL-SQLAnywhere-CREATE.sql |  2 +-
 .../resources/Ambari-DDL-SQLServer-CREATE.sql   |  2 +-
 .../api/services/ldap/LDAPServiceTest.java  | 85 
 .../server/checks/UpgradeCheckOrderTest.java|  3 +-
 ...AmbariConfigurationResourceProviderTest.java | 24 +-
 .../server/ldap/LdapModuleFunctionalTest.java   |  4 +-
 .../notifications/DispatchFactoryTest.java  |  3 +-
 .../server/orm/InMemoryDefaultTestModule.java   |  2 +
 .../ambari/server/orm/JdbcPropertyTest.java |  5 +-
 ...uthenticationProviderForDNWithSpaceTest.java | 35 
 .../AmbariLdapAuthenticationProviderTest.java   |  3 +-
 .../AmbariLocalUserProviderTest.java|  3 +-
 .../authorization/LdapServerPropertiesTest.java |  5 +-
 17 files changed, 65 insertions(+), 119 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/4fc261a6/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
--
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql 
b/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
index cebd33e..20d64de 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
@@ -98,7 +98,7 @@ CREATE TABLE configuration_base (
 CREATE TABLE ambari_configuration (
   id BIGINT NOT NULL,
   CONSTRAINT PK_ambari_configuration PRIMARY KEY (id),
-  CONSTRAINT FK_ambari_configuration_configuration_base FOREIGN KEY (id) 
REFERENCES configuration_base (id)
+  CONSTRAINT FK_ambari_conf_conf_base FOREIGN KEY (id) REFERENCES 
configuration_base (id)
 );
 
 CREATE TABLE serviceconfig (

http://git-wip-us.apache.org/repos/asf/ambari/blob/4fc261a6/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
--
diff --git a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql 
b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
index b8b506a..dc1dea9 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
@@ -118,7 +118,7 @@ CREATE TABLE configuration_base (
 CREATE TABLE ambari_configuration (
   id BIGINT NOT NULL,
   CONSTRAINT PK_ambari_configuration PRIMARY KEY (id),
-  CONSTRAINT FK_ambari_configuration_configuration_base FOREIGN KEY (id) 
REFERENCES configuration_base (id)
+  CONSTRAINT FK_ambari_conf_conf_base FOREIGN KEY (id) REFERENCES 
configuration_base (id)
 );
 
 CREATE TABLE serviceconfig (

http://git-wip-us.apache.org/repos/asf/ambari/blob/4fc261a6/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
--
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql 
b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
index 1e90426..7c34304 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
@@ -98,7 +98,7 @@ CREATE TABLE configuration_base (
 CREATE TABLE ambari_configuration (
   id NUMBER(19) NOT NULL,
   CONSTRAINT PK_ambari_configuration PRIMARY KEY (id),
-  CONSTRAINT FK_ambari_configuration_configuration_base FOREIGN KEY (id) 
REFERENCES configuration_base (id)
+  CONSTRAINT FK_ambari_conf_conf_base FOREIGN KEY (id) REFERENCES 
configuration_base (id)
 );
 
 CREATE TABLE serviceconfig (

http://git-wip-us.apache.org/repos/asf/ambari/blob/4fc261a6/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
--
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql 
b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
index 583a51b..9270522 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres

[02/50] ambari git commit: AMBARI-22237. Restarting Storm Supervisor from Ambari always fails while Stop and Start works fine. (Arpit Khare, swagle via swagle)

2017-10-17 Thread lpuskas
AMBARI-22237. Restarting Storm Supervisor from Ambari always fails while Stop 
and Start works fine. (Arpit Khare, swagle via swagle)


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 6e1cac85e33132c93fd843e402e3702ee584b947
Parents: c8c1812
Author: Siddharth Wagle 
Authored: Fri Oct 13 20:55:22 2017 -0700
Committer: Siddharth Wagle 
Committed: Fri Oct 13 20:55:22 2017 -0700

--
 .../STORM/0.9.1/package/scripts/supervisord_service.py  | 1 +
 .../STORM/1.0.1.3.0/package/scripts/supervisord_service.py  | 1 +
 2 files changed, 2 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/6e1cac85/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/supervisord_service.py
--
diff --git 
a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/supervisord_service.py
 
b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/supervisord_service.py
index 6ff9f9c..498db15 100644
--- 
a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/supervisord_service.py
+++ 
b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/supervisord_service.py
@@ -20,6 +20,7 @@ limitations under the License.
 
 from resource_management.core.resources.system import Execute
 from resource_management.libraries.functions.format import format
+from resource_management.core.exceptions import Fail
 
 def supervisord_service(component_name, action):
   Execute(format("supervisorctl {action} storm-{component_name}"),

http://git-wip-us.apache.org/repos/asf/ambari/blob/6e1cac85/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/supervisord_service.py
--
diff --git 
a/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/supervisord_service.py
 
b/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/supervisord_service.py
index 6ff9f9c..498db15 100644
--- 
a/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/supervisord_service.py
+++ 
b/ambari-server/src/main/resources/common-services/STORM/1.0.1.3.0/package/scripts/supervisord_service.py
@@ -20,6 +20,7 @@ limitations under the License.
 
 from resource_management.core.resources.system import Execute
 from resource_management.libraries.functions.format import format
+from resource_management.core.exceptions import Fail
 
 def supervisord_service(component_name, action):
   Execute(format("supervisorctl {action} storm-{component_name}"),



[33/50] ambari git commit: AMBARI-21307 AddedLDAP configuration provider for loading and maintaining the LDAP configuration in the application

2017-10-17 Thread lpuskas
AMBARI-21307 AddedLDAP configuration provider for loading and maintaining the 
LDAP configuration in the application


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: bb9faa7c66800b7bd8b54c659c317de04785e397
Parents: 838fedf
Author: lpuskas 
Authored: Tue Aug 29 14:55:09 2017 +0200
Committer: lpuskas 
Committed: Tue Oct 17 18:41:11 2017 +0200

--
 .../services/ldap/LdapConfigurationService.java |   1 +
 .../AmbariConfigurationResourceProvider.java|  35 +-
 .../ambari/server/events/AmbariEvent.java   |  11 +-
 .../events/AmbariLdapConfigChangedEvent.java|  37 ++
 .../server/ldap/LdapConfigurationFactory.java   |   2 +-
 .../apache/ambari/server/ldap/LdapModule.java   |   3 +
 .../AmbariLdapConfigurationProvider.java| 114 +++
 .../server/ldap/service/AmbariLdapFacade.java   |   7 +-
 .../server/orm/dao/AmbariConfigurationDAO.java  |  48 
 .../orm/entities/AmbariConfigurationEntity.java |   4 +-
 .../DefaultLdapConfigurationServiceTest.java|  10 +-
 11 files changed, 260 insertions(+), 12 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/bb9faa7c/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
index fc6bd41..1b8427b 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
@@ -82,6 +82,7 @@ public class LdapConfigurationService extends 
AmbariConfigurationService {
   @Produces(MediaType.APPLICATION_JSON)
   public Response validateConfiguration(LdapConfigurationRequest 
ldapConfigurationRequest) {
 
+// check if the user is authorized to perform the operation
 authorize();
 
 Set groups = Sets.newHashSet();

http://git-wip-us.apache.org/repos/asf/ambari/blob/bb9faa7c/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariConfigurationResourceProvider.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariConfigurationResourceProvider.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariConfigurationResourceProvider.java
index 2302d8b..4f4cc70 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariConfigurationResourceProvider.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariConfigurationResourceProvider.java
@@ -35,6 +35,9 @@ import 
org.apache.ambari.server.controller.spi.ResourceAlreadyExistsException;
 import org.apache.ambari.server.controller.spi.SystemException;
 import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
 import org.apache.ambari.server.controller.utilities.PredicateHelper;
+import org.apache.ambari.server.events.AmbariEvent;
+import org.apache.ambari.server.events.AmbariLdapConfigChangedEvent;
+import org.apache.ambari.server.events.publishers.AmbariEventPublisher;
 import org.apache.ambari.server.orm.dao.AmbariConfigurationDAO;
 import org.apache.ambari.server.orm.entities.AmbariConfigurationEntity;
 import org.apache.ambari.server.orm.entities.ConfigurationBaseEntity;
@@ -113,6 +116,10 @@ public class AmbariConfigurationResourceProvider extends 
AbstractAuthorizedResou
   @Inject
   private AmbariConfigurationDAO ambariConfigurationDAO;
 
+  @Inject
+  private AmbariEventPublisher publisher;
+
+
   private Gson gson;
 
   @AssistedInject
@@ -142,7 +149,18 @@ public class AmbariConfigurationResourceProvider extends 
AbstractAuthorizedResou
 }
 
 LOGGER.info("Persisting new ambari configuration: {} ", 
ambariConfigurationEntity);
-ambariConfigurationDAO.create(ambariConfigurationEntity);
+
+try {
+  ambariConfigurationDAO.create(ambariConfigurationEntity);
+} catch (Exception e) {
+  LOGGER.error("Failed to create resource", e);
+  throw new ResourceAlreadyExistsException(e.getMessage());
+}
+
+// todo filter by configuration type
+// notify subscribers about the configuration changes
+publisher.publish(new 
AmbariLdapConfigChangedEvent(AmbariEvent.AmbariEventType

[12/50] ambari git commit: AMBARI-22233.Zeppelin service check failed during EU from 2.5 to 2.6 as ZeppelinServer can not be instantiated(Prabhjyot Singh Via Venkata Sairam)

2017-10-17 Thread lpuskas
AMBARI-22233.Zeppelin service check failed during EU from 2.5 to 2.6 as 
ZeppelinServer can not be instantiated(Prabhjyot Singh Via Venkata Sairam)


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 0317cf7163165f4a6f90b2337bf97382679dfee4
Parents: 2a8ac0d
Author: Venkata Sairam 
Authored: Mon Oct 16 18:20:06 2017 +0530
Committer: Venkata Sairam 
Committed: Mon Oct 16 18:20:06 2017 +0530

--
 .../ZEPPELIN/0.7.0/package/scripts/master.py| 40 +---
 .../stacks/2.6/ZEPPELIN/test_zeppelin_070.py|  3 ++
 2 files changed, 37 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/0317cf71/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py
--
diff --git 
a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py
 
b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py
index 9d179b8..6ccdfba 100644
--- 
a/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py
+++ 
b/ambari-server/src/main/resources/common-services/ZEPPELIN/0.7.0/package/scripts/master.py
@@ -192,7 +192,7 @@ class Master(Script):
   notebook_directory = "/user/" + format("{zeppelin_user}") + "/" + \

params.config['configurations']['zeppelin-config']['zeppelin.notebook.dir']
 
-if not self.is_path_exists_in_HDFS(notebook_directory, 
params.zeppelin_user):
+if not self.is_directory_exists_in_HDFS(notebook_directory, 
params.zeppelin_user):
   # hdfs dfs -mkdir {notebook_directory}
   params.HdfsResource(format("{notebook_directory}"),
   type="directory",
@@ -243,7 +243,7 @@ class Master(Script):
   self.create_zeppelin_dir(params)
 
 if params.conf_stored_in_hdfs:
-  if not 
self.is_path_exists_in_HDFS(self.get_zeppelin_conf_FS_directory(params), 
params.zeppelin_user):
+  if not 
self.is_directory_exists_in_HDFS(self.get_zeppelin_conf_FS_directory(params), 
params.zeppelin_user):
 # hdfs dfs -mkdir {zeppelin's conf directory}
 params.HdfsResource(self.get_zeppelin_conf_FS_directory(params),
 type="directory",
@@ -314,15 +314,17 @@ class Master(Script):
   def get_zeppelin_conf_FS(self, params):
 return self.get_zeppelin_conf_FS_directory(params) + "/interpreter.json"
 
-  def is_path_exists_in_HDFS(self, path, as_user):
+  def is_directory_exists_in_HDFS(self, path, as_user):
 kinit_path_local = 
get_kinit_path(default('/configurations/kerberos-env/executable_search_paths', 
None))
 kinit_if_needed = format("{kinit_path_local} -kt 
{zeppelin_kerberos_keytab} {zeppelin_kerberos_principal};")
-path_exists = shell.call(format("{kinit_if_needed} hdfs --config 
{hadoop_conf_dir} dfs -test -e {path};echo $?"),
+
+#-d: if the path is a directory, return 0.
+path_exists = shell.call(format("{kinit_if_needed} hdfs --config 
{hadoop_conf_dir} dfs -test -d {path};echo $?"),
  user=as_user)[1]
 
 # if there is no kerberos setup then the string will contain "-bash: 
kinit: command not found"
 if "\n" in path_exists:
-  path_exists = path_exists.split("\n")[1]
+  path_exists = path_exists.split("\n").pop()
 
 # '1' means it does not exists
 if path_exists == '0':
@@ -330,6 +332,31 @@ class Master(Script):
 else:
   return False
 
+  def is_file_exists_in_HDFS(self, path, as_user):
+kinit_path_local = 
get_kinit_path(default('/configurations/kerberos-env/executable_search_paths', 
None))
+kinit_if_needed = format("{kinit_path_local} -kt 
{zeppelin_kerberos_keytab} {zeppelin_kerberos_principal};")
+
+#-f: if the path is a file, return 0.
+path_exists = shell.call(format("{kinit_if_needed} hdfs --config 
{hadoop_conf_dir} dfs -test -f {path};echo $?"),
+ user=as_user)[1]
+
+# if there is no kerberos setup then the string will contain "-bash: 
kinit: command not found"
+if "\n" in path_exists:
+  path_exists = path_exists.split("\n").pop()
+
+# '1' means it does not exists
+if path_exists == '0':
+  #-z: if the file is zero length, return 0.
+  path_exists = shell.call(format("{kinit_if_needed} hdfs --config 
{hadoop_conf_dir} dfs -test -z {path};echo $?"),
+   user=as_user)[1]
+
+  if "\n" in path_exists:
+path_exists = path_exists.split("\n").pop()
+  if path_exists != '0':
+ 

[28/50] ambari git commit: AMBARI-21545 Stack Advisor support for LDAP configuration (benyoka)

2017-10-17 Thread lpuskas
AMBARI-21545 Stack Advisor support for LDAP configuration (benyoka)


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 5af00251787f4a7f777c12698965123fb1af3aa7
Parents: 06f3690
Author: Balazs Bence Sari 
Authored: Tue Aug 8 20:17:14 2017 +0200
Committer: lpuskas 
Committed: Tue Oct 17 18:41:10 2017 +0200

--
 .../services/AmbariConfigurationService.java|   4 +-
 .../stackadvisor/StackAdvisorRequest.java   |  12 ++
 .../commands/StackAdvisorCommand.java   |  54 +
 .../commands/StackAdvisorCommandTest.java   | 212 +++
 .../StackAdvisorResourceProviderTest.java   |  97 -
 5 files changed, 324 insertions(+), 55 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/5af00251/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java
index 0632361..927e518 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java
@@ -56,9 +56,9 @@ import io.swagger.annotations.ApiResponses;
  *"data": [
  *{
  * "authentication.ldap.primaryUrl": "localhost:33389"
-   "authentication.ldap.secondaryUrl": "localhost:333"
+ * "authentication.ldap.secondaryUrl": "localhost:333"
  * "authentication.ldap.baseDn": "dc=ambari,dc=apache,dc=org"
-  * // ..
+ * // ..
  * ]
  * }
  * 

http://git-wip-us.apache.org/repos/asf/ambari/blob/5af00251/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorRequest.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorRequest.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorRequest.java
index 3a2b488..cd26c56 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorRequest.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorRequest.java
@@ -31,6 +31,8 @@ import 
org.apache.ambari.server.api.services.stackadvisor.recommendations.Recomm
 import org.apache.ambari.server.state.ChangedConfigInfo;
 import org.apache.commons.lang.StringUtils;
 
+import com.google.common.base.Preconditions;
+
 /**
  * Stack advisor request.
  */
@@ -48,6 +50,7 @@ public class StackAdvisorRequest {
   private List changedConfigurations = new LinkedList<>();
   private Set configGroups;
   private Map userContext = new HashMap<>();
+  private Map ldapConfig = new HashMap<>();
 
   public String getStackName() {
 return stackName;
@@ -93,6 +96,8 @@ public class StackAdvisorRequest {
 return configurations;
   }
 
+  public Map getLdapConfig() { return ldapConfig; }
+
   public List getChangedConfigurations() {
 return changedConfigurations;
   }
@@ -189,6 +194,13 @@ public class StackAdvisorRequest {
   return this;
 }
 
+public StackAdvisorRequestBuilder withLdapConfig(Map 
ldapConfig) {
+  Preconditions.checkNotNull(ldapConfig);
+  this.instance.ldapConfig = ldapConfig;
+  return this;
+}
+
+
 public StackAdvisorRequest build() {
   return this.instance;
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/5af00251/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommand.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommand.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommand.java
index 356754d..2dc45de 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommand.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/Stac

[50/50] ambari git commit: AMBARI-21307 Added unit tests, fixed logging, typos and code issues

2017-10-17 Thread lpuskas
AMBARI-21307 Added unit tests, fixed logging, typos and code issues


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 4c5e251011dd99d2e50ba78c04cdc910cee1242d
Parents: 3750daf
Author: lpuskas 
Authored: Tue Oct 17 11:33:52 2017 +0200
Committer: lpuskas 
Committed: Tue Oct 17 18:41:15 2017 +0200

--
 .../DefaultLdapAttributeDetectionService.java   | 58 +++-
 .../ads/DefaultLdapConnectionConfigService.java |  5 +-
 .../ads/detectors/AttributeDetectorFactory.java | 26 +
 .../ads/detectors/ChainedAttributeDetector.java |  7 +++
 .../ads/detectors/GroupMemberAttrDetector.java  |  6 +-
 .../ads/detectors/GroupNameAttrDetector.java|  4 +-
 .../ads/detectors/GroupObjectClassDetector.java |  4 +-
 .../OccurrenceAndWeightBasedDetector.java   | 42 --
 .../detectors/UserGroupMemberAttrDetector.java  |  4 +-
 .../ads/detectors/UserNameAttrDetector.java |  6 +-
 .../ads/detectors/UserObjectClassDetector.java  |  6 +-
 .../server/ldap/LdapModuleFunctionalTest.java   | 10 +---
 12 files changed, 122 insertions(+), 56 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/4c5e2510/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapAttributeDetectionService.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapAttributeDetectionService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapAttributeDetectionService.java
index ea6e278..25abce7 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapAttributeDetectionService.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapAttributeDetectionService.java
@@ -37,10 +37,18 @@ import 
org.apache.directory.ldap.client.template.LdapConnectionTemplate;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+/**
+ * Service implementation that performs user and group attribute detection 
based on a sample set of entries returned by
+ * an ldap search operation. A accuracy of detected values may depend on the 
size of the sample result set
+ */
 @Singleton
 public class DefaultLdapAttributeDetectionService implements 
LdapAttributeDetectionService {
 
-  private static final Logger LOGGER = 
LoggerFactory.getLogger(DefaultLdapAttributeDetectionService.class);
+  private static final Logger LOG = 
LoggerFactory.getLogger(DefaultLdapAttributeDetectionService.class);
+
+  /**
+   * The maximum size of the entry set the detection is performed on
+   */
   private static final int SAMPLE_RESULT_SIZE = 50;
 
   @Inject
@@ -49,46 +57,46 @@ public class DefaultLdapAttributeDetectionService 
implements LdapAttributeDetect
   @Inject
   private LdapConnectionTemplateFactory ldapConnectionTemplateFactory;
 
-
   @Inject
   public DefaultLdapAttributeDetectionService() {
   }
 
   @Override
   public AmbariLdapConfiguration 
detectLdapUserAttributes(AmbariLdapConfiguration ambariLdapConfiguration) 
throws AmbariLdapException {
-LOGGER.info("Detecting LDAP user attributes ...");
-LdapConnectionTemplate ldapConnectionTemplate = 
ldapConnectionTemplateFactory.create(ambariLdapConfiguration);
-AttributeDetector userAttributDetector = 
attributeDetectorFactory.userAttributDetector();
+LOG.info("Detecting LDAP user attributes ...");
 
 // perform a search using the user search base
 if (Strings.isEmpty(ambariLdapConfiguration.userSearchBase())) {
-  LOGGER.warn("No user search base provided");
+  LOG.warn("No user search base provided");
   return ambariLdapConfiguration;
 }
 
 try {
 
+  LdapConnectionTemplate ldapConnectionTemplate = 
ldapConnectionTemplateFactory.create(ambariLdapConfiguration);
+  AttributeDetector userAttributeDetector = 
attributeDetectorFactory.userAttributDetector();
+
   SearchRequest searchRequest = 
assembleUserSearchRequest(ldapConnectionTemplate, ambariLdapConfiguration);
 
   // do the search
   List entries = ldapConnectionTemplate.search(searchRequest, 
getEntryMapper());
 
   for (Entry entry : entries) {
-LOGGER.info("Processing sample entry with dn: [{}]", entry.getDn());
-userAttributDetector.collect(entry);
+LOG.info("Collecting user attribute information from the sample entry 
with dn: [{}]", entry.getDn());
+userAttributeDetector.collect(entry);
   }
 
   // sel

[39/50] ambari git commit: AMBARI-21307 Extracted config keys into an enum. Organized code (created domain package, moved classes)

2017-10-17 Thread lpuskas
AMBARI-21307 Extracted config keys into an enum. Organized code (created domain 
package, moved classes)


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 80ef857224ceaf559aebcc79a9731d71af99cbf4
Parents: ece357c
Author: lpuskas 
Authored: Thu Sep 14 16:33:41 2017 +0200
Committer: lpuskas 
Committed: Tue Oct 17 18:41:12 2017 +0200

--
 .../services/ldap/LdapConfigurationService.java |   4 +-
 .../server/ldap/AmbariLdapConfiguration.java| 232 ---
 .../server/ldap/LdapConfigurationFactory.java   |  34 ---
 .../apache/ambari/server/ldap/LdapModule.java   |   2 +
 .../ldap/domain/AmbariLdapConfiguration.java| 180 ++
 .../ldap/domain/LdapConfigurationFactory.java   |  34 +++
 .../ldap/service/AmbariLdapConfigKeys.java  |  72 ++
 .../AmbariLdapConfigurationProvider.java|   4 +-
 .../server/ldap/service/AmbariLdapFacade.java   |   2 +-
 .../service/LdapAttributeDetectionService.java  |   2 +-
 .../ldap/service/LdapConfigurationService.java  |   2 +-
 .../ldap/service/LdapConnectionService.java |   2 +-
 .../ambari/server/ldap/service/LdapFacade.java  |   2 +-
 .../DefaultLdapAttributeDetectionService.java   |  15 +-
 .../ads/DefaultLdapConfigurationService.java|   2 +-
 .../ads/DefaultLdapConnectionService.java   |  16 +-
 ...efaultLdapAttributeDetectionServiceTest.java |  21 +-
 .../DefaultLdapConfigurationServiceTest.java|  31 +--
 18 files changed, 334 insertions(+), 323 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/80ef8572/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
index ae47a87..ff95066 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
@@ -46,8 +46,8 @@ import org.apache.ambari.server.api.services.ResultImpl;
 import org.apache.ambari.server.api.services.ResultStatus;
 import org.apache.ambari.server.controller.internal.ResourceImpl;
 import org.apache.ambari.server.controller.spi.Resource;
-import org.apache.ambari.server.ldap.AmbariLdapConfiguration;
-import org.apache.ambari.server.ldap.LdapConfigurationFactory;
+import org.apache.ambari.server.ldap.domain.AmbariLdapConfiguration;
+import org.apache.ambari.server.ldap.domain.LdapConfigurationFactory;
 import org.apache.ambari.server.ldap.service.LdapFacade;
 import org.apache.ambari.server.security.authorization.AuthorizationException;
 import org.apache.ambari.server.security.authorization.AuthorizationHelper;

http://git-wip-us.apache.org/repos/asf/ambari/blob/80ef8572/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
deleted file mode 100644
index 5bdda7a..000
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * Licensed 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.ldap;
-
-import java.util.Map;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.inject.assistedinject.Assisted;
-
-/**
- * This class is an immutable representation of all the LDAP related 
configurationMap entries.
- */
-@Singleton
-public class AmbariLdapConfiguration {
-
-  private static final Logger LOGGER = 
LoggerFactory.getLogger(AmbariLda

[43/50] ambari git commit: AMBARI-21307 Refactor - using the LdapConnectionTemplate for ldap operations

2017-10-17 Thread lpuskas
AMBARI-21307 Refactor - using the LdapConnectionTemplate for ldap operations


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 999dc42b035e8bb40161a55326bf33ab5fdd9be8
Parents: ea25d6e
Author: lpuskas 
Authored: Wed Oct 4 15:54:34 2017 +0200
Committer: lpuskas 
Committed: Tue Oct 17 18:41:13 2017 +0200

--
 .../services/ldap/LdapConfigurationService.java |   6 +-
 .../server/controller/ControllerModule.java |   2 +-
 .../apache/ambari/server/ldap/LdapModule.java   |  12 +-
 .../domain/AmbariLdapConfigurationFactory.java  |  34 +
 .../ldap/domain/LdapConfigurationFactory.java   |  34 -
 .../AmbariLdapConfigurationProvider.java|   5 +-
 .../server/ldap/service/AmbariLdapFacade.java   |  36 +
 .../server/ldap/service/AttributeDetector.java  |   2 +-
 .../service/LdapAttributeDetectionService.java  |   8 +-
 .../ldap/service/LdapConfigurationService.java  |  22 +--
 .../ldap/service/LdapConnectionService.java |  43 --
 .../service/LdapConnectionTemplateProvider.java |  56 
 .../DefaultLdapAttributeDetectionService.java   | 129 ++---
 .../ads/DefaultLdapConfigurationService.java| 110 +++---
 .../ads/DefaultLdapConnectionService.java   |  86 ---
 .../ads/LdapConnectionTemplateFactory.java  |  95 
 .../ads/detectors/GroupMemberAttrDetector.java  |   4 +-
 .../ads/detectors/GroupNameAttrDetector.java|   4 +-
 .../ads/detectors/GroupObjectClassDetector.java |   4 +-
 .../OccurranceAndWeightBasedDetector.java   | 103 -
 .../OccurrenceAndWeightBasedDetector.java   | 103 +
 .../detectors/UserGroupMemberAttrDetector.java  |   4 +-
 .../ads/detectors/UserNameAttrDetector.java |   4 +-
 .../ads/detectors/UserObjectClassDetector.java  |   4 +-
 .../server/ldap/LdapModuleFunctionalTest.java   | 143 +++
 .../domain/AmbariLdapConfigurationTest.java |  19 ---
 ...estAmbariAmbariLdapConfigurationFactory.java |  29 
 .../TestAmbariLdapConfigurationFactory.java |  29 
 ...efaultLdapAttributeDetectionServiceTest.java | 112 ---
 .../DefaultLdapConfigurationServiceTest.java| 129 -
 30 files changed, 601 insertions(+), 770 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/999dc42b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
index ff95066..13f8835 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
@@ -47,7 +47,7 @@ import org.apache.ambari.server.api.services.ResultStatus;
 import org.apache.ambari.server.controller.internal.ResourceImpl;
 import org.apache.ambari.server.controller.spi.Resource;
 import org.apache.ambari.server.ldap.domain.AmbariLdapConfiguration;
-import org.apache.ambari.server.ldap.domain.LdapConfigurationFactory;
+import org.apache.ambari.server.ldap.domain.AmbariLdapConfigurationFactory;
 import org.apache.ambari.server.ldap.service.LdapFacade;
 import org.apache.ambari.server.security.authorization.AuthorizationException;
 import org.apache.ambari.server.security.authorization.AuthorizationHelper;
@@ -72,7 +72,7 @@ public class LdapConfigurationService extends 
AmbariConfigurationService {
   private static LdapFacade ldapFacade;
 
   @Inject
-  private static LdapConfigurationFactory ldapConfigurationFactory;
+  private static AmbariLdapConfigurationFactory ambariLdapConfigurationFactory;
 
 
   @POST
@@ -93,7 +93,7 @@ public class LdapConfigurationService extends 
AmbariConfigurationService {
 
   validateRequest(ldapConfigurationRequest);
 
-  AmbariLdapConfiguration ambariLdapConfiguration = 
ldapConfigurationFactory.createLdapConfiguration(
+  AmbariLdapConfiguration ambariLdapConfiguration = 
ambariLdapConfigurationFactory.createLdapConfiguration(
 
ldapConfigurationRequest.getAmbariConfiguration().getData().iterator().next());
 
   LdapConfigOperation action = 
LdapConfigOperation.fromAction(ldapConfigurationRequest.getRequestInfo().getAction());

http://git-wip-us.apache.org/repos/asf/ambari/blob/999dc42b/ambari-server/src/main/java/org/apache/ambari/server

[44/50] ambari git commit: AMBARI-21307 cleand apache ditectory related dependencies

2017-10-17 Thread lpuskas
AMBARI-21307 cleand apache ditectory related dependencies


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: a770e2e8da98382604782cc23545a192759565e3
Parents: 8a57f21
Author: lpuskas 
Authored: Wed Oct 11 17:54:57 2017 +0200
Committer: lpuskas 
Committed: Tue Oct 17 18:41:13 2017 +0200

--
 ambari-funtest/pom.xml | 67 
 ambari-project/pom.xml | 51 ---
 ambari-server/pom.xml  | 84 -
 3 files changed, 14 insertions(+), 188 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/a770e2e8/ambari-funtest/pom.xml
--
diff --git a/ambari-funtest/pom.xml b/ambari-funtest/pom.xml
index bb2068d..6466af3 100644
--- a/ambari-funtest/pom.xml
+++ b/ambari-funtest/pom.xml
@@ -197,73 +197,6 @@
   spring-ldap-core
 
 
-  org.apache.directory.server
-  apacheds-server-annotations
-  test
-  
-
-  net.sf.ehcache
-  ehcache-core
-
-  
-
-
-  org.apache.directory.server
-  apacheds-core-integ
-  test
-  
-
-  net.sf.ehcache
-  ehcache-core
-
-  
-
-
-  org.apache.directory.server
-  apacheds-server-integ
-  test
-
-
-  org.apache.directory.server
-  apacheds-jdbm
-  test
-
-
-  org.apache.directory.server
-  apacheds-kerberos-codec
-  
-
-  net.sf.ehcache
-  ehcache-core
-
-  
-
-
-  org.apache.directory.server
-  apacheds-core
-  test
-  
-
-  net.sf.ehcache
-  ehcache-core
-
-  
-
-
-  org.apache.directory.server
-  apacheds-protocol-ldap
-  test
-
-
-  org.apache.directory.server
-  kerberos-client
-
-
-  org.apache.directory.shared
-  shared-ldap
-  test
-
-
   org.slf4j
   slf4j-api
   1.7.20

http://git-wip-us.apache.org/repos/asf/ambari/blob/a770e2e8/ambari-project/pom.xml
--
diff --git a/ambari-project/pom.xml b/ambari-project/pom.xml
index e4d4423..f6e3bc7 100644
--- a/ambari-project/pom.xml
+++ b/ambari-project/pom.xml
@@ -162,57 +162,6 @@
 2.0.4.RELEASE
   
   
-org.apache.directory.server
-apacheds-server-annotations
-2.0.0-M19
-  
-  
-org.apache.directory.server
-apacheds-core-integ
-2.0.0-M19
-  
-  
-org.apache.directory.server
-apacheds-server-integ
-2.0.0-M19
-  
-  
-org.apache.directory.server
-apacheds-jdbm
-2.0.0-M5
-  
-  
-org.apache.directory.server
-apacheds-kerberos-codec
-2.0.0-M19
-  
-  
-org.apache.directory.server
-apacheds-core
-2.0.0-M19
-  
-  
-org.apache.directory.server
-kerberos-client
-2.0.0-M19
-  
-  
-org.apache.directory.server
-apacheds-protocol-ldap
-2.0.0-M19
-
-  
-org.apache.directory.jdbm
-apacheds-jdbm1
-  
-
-  
-  
-org.apache.directory.shared
-shared-ldap
-0.9.17
-  
-  
 org.slf4j
 slf4j-api
 ${slf4j.version}

http://git-wip-us.apache.org/repos/asf/ambari/blob/a770e2e8/ambari-server/pom.xml
--
diff --git a/ambari-server/pom.xml b/ambari-server/pom.xml
index 8d52821..a86acf5 100644
--- a/ambari-server/pom.xml
+++ b/ambari-server/pom.xml
@@ -1225,73 +1225,6 @@
   spring-ldap-core
 
 
-  org.apache.directory.server
-  apacheds-server-annotations
-  test
-  
-
-  net.sf.ehcache
-  ehcache-core
-
-  
-
-
-  org.apache.directory.server
-  apacheds-core-integ
-  test
-  
-
-  net.sf.ehcache
-  ehcache-core
-
-  
-
-
-  org.apache.directory.server
-  apacheds-server-integ
-  test
-
-
-  org.apache.directory.server
-  apacheds-jdbm
-  test
-
-
-  org.apache.directory.server
-  apacheds-kerberos-codec
-  
-
-  net.sf.ehcache
-  ehcache-core
-
-  
-
-
-  org.apache.directory.server
-  apacheds-core
-  test

[31/50] ambari git commit: AMBARI-21307 refactoring - renamed, moved classes, variables

2017-10-17 Thread lpuskas
AMBARI-21307 refactoring - renamed, moved classes, variables


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 838fedfa24f0ef9b31eb90098f6d23d70711d303
Parents: 70d606e
Author: lpuskas 
Authored: Tue Aug 22 10:03:24 2017 +0200
Committer: lpuskas 
Committed: Tue Oct 17 18:41:10 2017 +0200

--
 .../api/services/ldap/AmbariConfiguration.java  |  87 +++
 .../services/ldap/AmbariConfigurationDTO.java   |  67 -
 .../ldap/LdapCheckConfigurationRequest.java |  47 
 .../api/services/ldap/LdapConfigOperation.java  |  43 
 .../services/ldap/LdapConfigurationRequest.java |  49 
 .../services/ldap/LdapConfigurationService.java |  53 +---
 .../api/services/ldap/LdapOperationRequest.java |  18 --
 .../server/ldap/LdapConfigurationService.java   |  60 +
 .../ldap/LdapConfigurationValidatorService.java |  60 -
 .../apache/ambari/server/ldap/LdapModule.java   |   4 +-
 .../server/ldap/service/AmbariLdapFacade.java   |  10 +-
 .../ads/DefaultLdapConfigurationService.java| 243 +++
 ...efaultLdapConfigurationValidatorService.java | 243 ---
 .../api/services/ldap/LDAPServiceTest.java  |   6 +-
 .../DefaultLdapConfigurationServiceTest.java| 113 +
 ...ltLdapConfigurationValidatorServiceTest.java | 113 -
 16 files changed, 618 insertions(+), 598 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/838fedfa/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/AmbariConfiguration.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/AmbariConfiguration.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/AmbariConfiguration.java
new file mode 100644
index 000..b5cc921
--- /dev/null
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/AmbariConfiguration.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed 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.api.services.ldap;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Domain POJO representing generic ambari configuration data.
+ */
+public class AmbariConfiguration {
+
+  /**
+   * The type of the configuration,  eg.: ldap-configuration
+   */
+  private String type;
+
+  /**
+   * Version tag
+   */
+  private String versionTag;
+
+  /**
+   * Version number
+   */
+  private Integer version;
+
+  /**
+   * Created timestamp
+   */
+  private long createdTs;
+
+  private Set> data = Collections.emptySet();
+
+  public String getType() {
+return type;
+  }
+
+  public void setType(String type) {
+this.type = type;
+  }
+
+  public Set> getData() {
+return data;
+  }
+
+  public void setData(Set> data) {
+this.data = data;
+  }
+
+  public String getVersionTag() {
+return versionTag;
+  }
+
+  public void setVersionTag(String versionTag) {
+this.versionTag = versionTag;
+  }
+
+  public Integer getVersion() {
+return version;
+  }
+
+  public void setVersion(Integer version) {
+this.version = version;
+  }
+
+  public long getCreatedTs() {
+return createdTs;
+  }
+
+  public void setCreatedTs(long createdTs) {
+this.createdTs = createdTs;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/838fedfa/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/AmbariConfigurationDTO.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/AmbariConfigurationDTO.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/AmbariConfigurationDTO.java
deleted file mode 100644
index 1b134fe..000
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/AmbariConfigurationDTO.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use 

[37/50] ambari git commit: AMBARI-21307 Testing the attribute detection - fixing bugs, cleanup

2017-10-17 Thread lpuskas
AMBARI-21307 Testing the attribute detection - fixing bugs, cleanup


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 1045fde6f67c2a953433e95f152465b96643890c
Parents: d563640
Author: lpuskas 
Authored: Tue Sep 12 18:58:44 2017 +0200
Committer: lpuskas 
Committed: Tue Oct 17 18:41:12 2017 +0200

--
 .../api/services/ldap/LdapConfigurationService.java  | 11 +++
 .../ambari/server/ldap/AmbariLdapConfiguration.java  |  2 +-
 .../org/apache/ambari/server/ldap/LdapModule.java|  3 +++
 .../ambari/server/ldap/service/AmbariLdapFacade.java |  6 ++
 .../ads/DefaultAttributeDetectionService.java| 15 +++
 .../service/ads/DefaultLdapConfigurationService.java |  3 ---
 .../ads/detectors/GroupMemberAttrDetector.java   |  3 +++
 .../service/ads/detectors/GroupNameAttrDetector.java |  3 +++
 .../ads/detectors/GroupObjectClassDetector.java  |  3 +++
 .../ads/detectors/UserGroupMemberAttrDetector.java   |  3 +++
 .../service/ads/detectors/UserNameAttrDetector.java  |  3 +++
 .../ads/DefaultAttributeDetectionServiceTest.java|  3 +--
 .../ads/DefaultLdapConfigurationServiceTest.java |  4 ++--
 13 files changed, 42 insertions(+), 20 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/1045fde6/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
index 66809c3..ae47a87 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
@@ -86,6 +86,7 @@ public class LdapConfigurationService extends 
AmbariConfigurationService {
 authorize();
 
 Set groups = Sets.newHashSet();
+Object responseEntity = null;
 
 Result result = new ResultImpl(new ResultStatus(ResultStatus.STATUS.OK));
 try {
@@ -108,13 +109,14 @@ public class LdapConfigurationService extends 
AmbariConfigurationService {
 
   LOGGER.info("Testing LDAP attributes ");
   groups = 
ldapFacade.checkLdapAttributes(ldapConfigurationRequest.getRequestInfo().getParameters(),
 ambariLdapConfiguration);
-  setResult(groups, result);
+  responseEntity = groups;
 
   break;
 case DETECT_ATTRIBUTES:
 
   LOGGER.info("Detecting LDAP attributes ...");
-  ldapFacade.detectAttributes(ambariLdapConfiguration);
+  ambariLdapConfiguration = 
ldapFacade.detectAttributes(ambariLdapConfiguration);
+  responseEntity = ambariLdapConfiguration;
 
   break;
 default:
@@ -123,10 +125,11 @@ public class LdapConfigurationService extends 
AmbariConfigurationService {
   }
 
 } catch (Exception e) {
-  result.setResultStatus(new ResultStatus(ResultStatus.STATUS.BAD_REQUEST, 
e));
+  result.setResultStatus(new 
ResultStatus(ResultStatus.STATUS.SERVER_ERROR, e));
+  responseEntity = e.getMessage();
 }
 
-return 
Response.status(result.getStatus().getStatusCode()).entity(getResultSerializer().serialize(result)).build();
+return 
Response.status(result.getStatus().getStatusCode()).entity(responseEntity).build();
   }
 
   private void setResult(Set groups, Result result) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/1045fde6/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
index ebb567d..5bdda7a 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
@@ -62,7 +62,7 @@ public class AmbariLdapConfiguration {
 GROUP_OBJECT_CLASS("ambari.ldap.attributes.group.object_class"),
 GROUP_NAME_ATTRIBUTE("ambari.ldap.attributes.group.name_attr"),
 GROUP_MEMBER_ATTRIBUTE("ambari.ldap.attributes.group.member_attr"),
-GROUP_SEARCH_BASE("ambari.ldap.attributes.user.search_base"),
+   

[46/50] ambari git commit: AMBARI-21307 Added unit tests. Improved logging, refactoring: rename, organized classes into packages

2017-10-17 Thread lpuskas
AMBARI-21307 Added unit tests. Improved logging, refactoring: rename, organized 
classes into packages


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: d5f8cc639d65c3df247ffe5548d8e7490d6a279c
Parents: 4fc261a
Author: lpuskas 
Authored: Fri Oct 13 17:19:41 2017 +0200
Committer: lpuskas 
Committed: Tue Oct 17 18:41:14 2017 +0200

--
 .../apache/ambari/server/ldap/LdapModule.java   |   2 +-
 .../AmbariLdapConfigurationProvider.java|  13 +-
 .../server/ldap/service/AmbariLdapFacade.java   |   2 +-
 .../service/LdapConnectionConfigService.java|   4 +-
 .../ads/DefaultLdapConfigurationService.java|  38 +++-
 .../ads/DefaultLdapConnectionConfigService.java | 116 ++
 .../DefaultLdapConnectionConfigService.java | 116 --
 .../server/ldap/LdapModuleFunctionalTest.java   |   4 +-
 ...estAmbariAmbariLdapConfigurationFactory.java |  29 ---
 .../TestAmbariLdapConfigurationFactory.java |  29 +++
 .../ldap/service/AmbariLdapFacadeTest.java  |   4 +-
 .../DefaultLdapConfigurationServiceTest.java| 221 +++
 12 files changed, 414 insertions(+), 164 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/d5f8cc63/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapModule.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapModule.java 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapModule.java
index 4abf4e7..67e84dc 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapModule.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapModule.java
@@ -25,7 +25,7 @@ import 
org.apache.ambari.server.ldap.service.LdapConnectionConfigService;
 import org.apache.ambari.server.ldap.service.LdapFacade;
 import 
org.apache.ambari.server.ldap.service.ads.DefaultLdapAttributeDetectionService;
 import 
org.apache.ambari.server.ldap.service.ads.DefaultLdapConfigurationService;
-import 
org.apache.ambari.server.ldap.service.ads.detectors.DefaultLdapConnectionConfigService;
+import 
org.apache.ambari.server.ldap.service.ads.DefaultLdapConnectionConfigService;
 
 import com.google.inject.AbstractModule;
 import com.google.inject.assistedinject.FactoryModuleBuilder;

http://git-wip-us.apache.org/repos/asf/ambari/blob/d5f8cc63/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapConfigurationProvider.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapConfigurationProvider.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapConfigurationProvider.java
index 9fad896..c88d420 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapConfigurationProvider.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapConfigurationProvider.java
@@ -36,7 +36,8 @@ import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
 
 /**
- * Provider implementation for LDAP configurations. It needs to be registered 
in the related GUICE module as a provider
+ * Provider implementation for LDAP configurations.
+ * It needs to be registered in the related GUICE module as a provider.
  * It's responsible for managing LDAP configurations in the application.
  * Whenever requested, this provider returns an AmbariLdapConfiguration which 
is always in sync with the persisted LDAP
  * configuration resource.
@@ -85,15 +86,15 @@ public class AmbariLdapConfigurationProvider implements 
Providerhttp://git-wip-us.apache.org/repos/asf/ambari/blob/d5f8cc63/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
index bbfbc8e..0118840 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
@@ -33,7 +33,7 @@ public class AmbariLdapFacade implements LdapFacade {
   /**
* Additional parameters expected to be provided along with the configuration
*/
-  protected enum Parameters {
+  public enum Parameters {
 TEST_USER_NAME("ambari.ldap.test

[48/50] ambari git commit: AMBARI-21307 Added unit test for the LdapFacade

2017-10-17 Thread lpuskas
AMBARI-21307 Added unit test for the LdapFacade


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: ec27529408bb3fbf3e7d9b66295c43b7c62bf558
Parents: a770e2e
Author: lpuskas 
Authored: Thu Oct 12 16:53:31 2017 +0200
Committer: lpuskas 
Committed: Tue Oct 17 18:41:14 2017 +0200

--
 .../services/AmbariConfigurationService.java|   2 +-
 .../ldap/domain/AmbariLdapConfiguration.java|  22 ++
 .../server/ldap/service/AmbariLdapFacade.java   |  10 +-
 .../ldap/service/AmbariLdapFacadeTest.java  | 215 +++
 4 files changed, 245 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/ec275294/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java
index 492509f..38ae766 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java
@@ -150,7 +150,7 @@ public class AmbariConfigurationService extends BaseService 
{
   @PUT
   @Path("{configurationId}")
   @Produces(MediaType.TEXT_PLAIN)
-  @ApiOperation(value = "Updates ambari configuration resources - Not 
implemented yet",
+  @ApiOperation(value = "Updates ambari configuration resources ",
 nickname = "AmbariConfigurationService#updateAmbariConfiguration")
   @ApiImplicitParams({
 @ApiImplicitParam(dataType = AMBARI_CONFIGURATION_REQUEST_TYPE, paramType 
= PARAM_TYPE_BODY),

http://git-wip-us.apache.org/repos/asf/ambari/blob/ec275294/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfiguration.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfiguration.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfiguration.java
index d071ebe..8b26cd3 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfiguration.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfiguration.java
@@ -19,6 +19,8 @@ import java.util.Map;
 
 import javax.inject.Inject;
 
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -174,4 +176,24 @@ public class AmbariLdapConfiguration {
   public String toString() {
 return configurationMap.toString();
   }
+
+  @Override
+  public boolean equals(Object o) {
+if (this == o) return true;
+
+if (o == null || getClass() != o.getClass()) return false;
+
+AmbariLdapConfiguration that = (AmbariLdapConfiguration) o;
+
+return new EqualsBuilder()
+  .append(configurationMap, that.configurationMap)
+  .isEquals();
+  }
+
+  @Override
+  public int hashCode() {
+return new HashCodeBuilder(17, 37)
+  .append(configurationMap)
+  .toHashCode();
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/ec275294/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
index c75b0c4..bbfbc8e 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
@@ -33,7 +33,7 @@ public class AmbariLdapFacade implements LdapFacade {
   /**
* Additional parameters expected to be provided along with the configuration
*/
-  private enum Parameters {
+  protected enum Parameters {
 TEST_USER_NAME("ambari.ldap.test.user.name"),
 TEST_USER_PASSWORD("ambari.ldap.test.user.password");
 
@@ -43,7 +43,7 @@ public class AmbariLdapFacade implements LdapFacade {
   this.parameterKey = parameterKey;
 }
 
-private String getParameterKey() {
+public String getParameterKey() {
   return parameterKey;
 }
 
@@ -62,6 

[35/50] ambari git commit: AMBARI-21307 Added the supported ldap properties to the code. Refactored existing code relying on these properties

2017-10-17 Thread lpuskas
AMBARI-21307 Added the supported ldap properties to the code. Refactored 
existing code relying on these properties


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 4bc75b1d56bee370e1c98d167a203a88c28b9e5f
Parents: ebb454c
Author: lpuskas 
Authored: Fri Sep 8 13:57:25 2017 +0300
Committer: lpuskas 
Committed: Tue Oct 17 18:41:11 2017 +0200

--
 .../server/ldap/AmbariLdapConfiguration.java| 189 ---
 .../AmbariLdapConfigurationProvider.java|   6 +-
 .../server/ldap/service/AmbariLdapFacade.java   |  10 +-
 .../service/LdapAttributeDetectionService.java  |  43 +
 .../ambari/server/ldap/service/LdapFacade.java  |   2 +-
 .../ads/DefaultAttributeDetectionService.java   |  47 +
 .../ads/DefaultLdapConfigurationService.java|   4 +-
 .../ads/DefaultLdapConnectionService.java   |   4 +-
 .../DefaultAttributeDetectionServiceTest.java   | 102 ++
 .../DefaultLdapConfigurationServiceTest.java|  30 ++-
 10 files changed, 348 insertions(+), 89 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/4bc75b1d/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
index e913e77..76faeed 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
@@ -34,63 +34,67 @@ public class AmbariLdapConfiguration {
   /**
* Constants representing supported LDAP related property names
*/
-  public enum LdapConfigProperty {
-LDAP_CONFIGURED("ambari.ldap.configured"),
-AUTOMATIC_ATTRIBUTE_DETECTION("ambari.ldap.automatic.attribute.detection"),
-USE_SSL("ambari.ldap.usessl"),
-LDAP_SERVER_HOST("ambari.ldap.server.host"),
-LDAP_SERVER_PORT("ambari.ldap.server.port"),
-LDAP_TRUSTSTORE("ambari.ldap.truststore"),
-LDAP_TRUSTSTORE_TYPE("ambari.ldap.truststore.type"),
-LDAP_TRUSTSTORE_PATH("ambari.ldap.truststore.path"),
-LDAP_TRUSTSTORE_PASSWORD("ambari.ldap.truststore.password"),
-BASE_DN("ambari.ldap.bind.dn"),
-REFERRAL("ambari.ldap.referral"),
-PAGINATION_ENABLED("ambari.ldap.pagination.enabled"),
-
-BIND_ANONIMOUSLY("ambari.ldap.bindanonymously"),
-MANAGER_DN("ambari.ldap.managerdn"),
-MANAGER_PASSWORD("ambari.ldap.managerpassword"),
-USER_OBJECT_CLASS("ambari.ldap.user.object.class"),
-USER_NAME_ATTRIBUTE("ambari.ldap.user.name.attribute"),
-USER_NAME_FORCE_LOWERCASE("ambari.ldap.username.force.lowercase"),
-USER_SEARCH_BASE("ambari.ldap.user.search.base"),
-
SYNC_USER_MEMBER_REPLACE_PATTERN("ambari.ldap.sync.user.member.replacepattern"),
-SYNC_USER_MEMBER_FILTER("ambari.ldap.sync.user.member_filter"),
-
-ADMIN_GROUP_MAPPING_RULES ("ambari.ldap.admin.group.mappingrules"),
-GROUP_OBJECT_CLASS("ambari.ldap.group.object.class"),
-GROUP_NAME_ATTRIBUTE("ambari.ldap.group.name.attribute"),
-GROUP_MEMBER_ATTRIBUTE("ambari.ldap.group.member.attribute"),
-GROUP_SEARCH_BASE("ambari.ldap.group.search.base"),
-
SYNC_GROUP_MEMBER_REPLACE_PATTERN("ambari.ldap.sync.group.member.replacepattern"),
-SYNC_GROUP_MEMBER_FILTER("ambari.ldap.sync.group.member_filter"),
-DN_ATTRIBUTE("authentication.ldap.dnAttribute"),
-
-TEST_USER_NAME("ambari.ldap.test.user.name"),
-TEST_USER_PASSWORD("ambari.ldap.test.user.password");
+  public enum AmbariLdapConfig {
+
+LDAP_ENABLED("ambari.ldap.authentication.enabled"),
+SERVER_HOST("ambari.ldap.connectivity.server.host"),
+SERVER_PORT("ambari.ldap.connectivity.server.port"),
+USE_SSL("ambari.ldap.connectivity.use_ssl"),
+
+TRUST_STORE("ambari.ldap.connectivity.trust_store"),
+TRUST_STORE_TYPE("ambari.ldap.connectivity.trust_store.type"),
+TRUST_STORE_PATH("ambari.ldap.connectivity.trust_store.path"),
+TRUST_STORE_PASSWORD("ambari.ldap.connectivity.trust_store.password"),
+ANONYMOU

[30/50] ambari git commit: AMBARI-21307 LDAP config rest service implementation extends the ambari config rest implementaiton

2017-10-17 Thread lpuskas
AMBARI-21307 LDAP config rest  service implementation extends the ambari config 
rest implementaiton


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 70d606edcf84736f4e261418d56222ab4aa6039e
Parents: 818f367
Author: lpuskas 
Authored: Mon Aug 21 15:53:45 2017 +0200
Committer: lpuskas 
Committed: Tue Oct 17 18:41:10 2017 +0200

--
 .../services/ldap/LdapConfigurationService.java | 208 +++
 .../api/services/ldap/LdapRestService.java  | 149 -
 2 files changed, 208 insertions(+), 149 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/70d606ed/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
new file mode 100644
index 000..52244bc
--- /dev/null
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
@@ -0,0 +1,208 @@
+/*
+ * Licensed 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.
+ */
+
+/*
+ * Licensed 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.api.services.ldap;
+
+import java.util.Set;
+
+import javax.inject.Inject;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.apache.ambari.annotations.ApiIgnore;
+import org.apache.ambari.server.StaticallyInject;
+import org.apache.ambari.server.api.services.AmbariConfigurationService;
+import org.apache.ambari.server.api.services.Result;
+import org.apache.ambari.server.api.services.ResultImpl;
+import org.apache.ambari.server.api.services.ResultStatus;
+import org.apache.ambari.server.controller.internal.ResourceImpl;
+import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.ambari.server.ldap.AmbariLdapConfiguration;
+import org.apache.ambari.server.ldap.LdapConfigurationFactory;
+import org.apache.ambari.server.ldap.service.LdapFacade;
+import org.apache.ambari.server.security.authorization.AuthorizationException;
+import org.apache.ambari.server.security.authorization.AuthorizationHelper;
+import org.apache.ambari.server.security.authorization.ResourceType;
+import org.apache.ambari.server.security.authorization.RoleAuthorization;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.security.core.Authentication;
+
+import com.google.common.collect.Sets;
+
+/**
+ * Endpoint designated to LDAP specific operations.
+ */
+@StaticallyInject
+@Path("/ldapconfigs/")
+public class LdapConfigurationService extends AmbariConfigurationService {
+
+  private static final Logger LOGGER = 
LoggerFactory.getLogger(LdapConfigurationService.class);
+
+  @Inject
+  private static LdapFacade ldapFacade;
+
+  @Inject
+  private static LdapConfigurationFactory ldapConfigurationFactory;
+
+  /**
+   * Actions supported by this endpoint
+   */
+  private enum LdapAction {
+TEST_CONNECTION("test-connection"),
+TEST_ATTRIBUTES("test-attributes"),
+DETECT_ATTRIBUTES("detect-attributes");
+
+private String actionStr;
+
+LdapAction(String actionStr) {
+  this.actionStr = actionStr;
+}
+
+public static LdapA

[27/50] ambari git commit: AMBARI-21307 Draft implementation of the group related attributes

2017-10-17 Thread lpuskas
AMBARI-21307 Draft implementation of the group related attributes


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 885be975ce062a759775b6fa9a8c91786d37837a
Parents: 38b5be5
Author: lpuskas 
Authored: Tue Aug 8 13:54:29 2017 +0200
Committer: lpuskas 
Committed: Tue Oct 17 18:41:09 2017 +0200

--
 .../server/ldap/AmbariLdapConfiguration.java|  22 +-
 .../ldap/LdapConfigurationValidatorService.java |  34 +--
 .../apache/ambari/server/ldap/LdapModule.java   |   4 +-
 .../server/ldap/service/AmbariLdapFacade.java   |  25 +-
 .../ldap/service/LdapConnectionService.java |  35 +++
 .../ambari/server/ldap/service/LdapFacade.java  |   9 +-
 .../ad/AdLdapConfigurationValidatorService.java | 177 --
 ...efaultLdapConfigurationValidatorService.java | 232 +++
 .../ad/DefaultLdapConnectionService.java|  63 +
 .../service/ad/LdapConfigurationConverter.java  |  50 
 ...AdLdapConfigurationValidatorServiceTest.java | 129 ---
 ...ltLdapConfigurationValidatorServiceTest.java | 156 +
 12 files changed, 552 insertions(+), 384 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/885be975/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
index 519f400..a6ff80b 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
@@ -53,7 +53,7 @@ public class AmbariLdapConfiguration {
 GROUP_OBJECT_CLASS("ambari.ldap.group.object.class"),
 GROUP_NAME_ATTRIBUTE("ambari.ldap.group.name.attribute"),
 GROUP_MEMBER_ATTRIBUTE("ambari.ldap.group.member.attribute"),
-GROUP_SEARCH_BASE("ambari.ldap.group.member.attribute"),
+GROUP_SEARCH_BASE("ambari.ldap.group.search.base"),
 DN_ATTRIBUTE("authentication.ldap.dnAttribute");
 
 private String propertyName;
@@ -126,4 +126,24 @@ public class AmbariLdapConfiguration {
 return (String) configurationValue(LdapConfigProperty.USER_NAME_ATTRIBUTE);
   }
 
+  public String userSearchBase() {
+return (String) configurationValue(LdapConfigProperty.USER_SEARCH_BASE);
+  }
+
+  public String groupObjectClass() {
+return (String) configurationValue(LdapConfigProperty.GROUP_OBJECT_CLASS);
+  }
+
+  public String groupNameAttribute() {
+return (String) 
configurationValue(LdapConfigProperty.GROUP_NAME_ATTRIBUTE);
+  }
+
+  public String groupMemberAttribute() {
+return (String) 
configurationValue(LdapConfigProperty.GROUP_MEMBER_ATTRIBUTE);
+  }
+
+  public String groupSearchBase() {
+return (String) configurationValue(LdapConfigProperty.GROUP_SEARCH_BASE);
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/885be975/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapConfigurationValidatorService.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapConfigurationValidatorService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapConfigurationValidatorService.java
index 4667721..7efa3b7 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapConfigurationValidatorService.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapConfigurationValidatorService.java
@@ -14,8 +14,11 @@
 
 package org.apache.ambari.server.ldap;
 
+import java.util.Set;
+
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.ldap.service.AmbariLdapException;
+import org.apache.directory.ldap.client.api.LdapConnection;
 
 /**
  * Collection of operations for validating ldap configuration.
@@ -26,27 +29,32 @@ public interface LdapConfigurationValidatorService {
   /**
* Tests the connection based on the provided configuration.
*
-   * @param configuration the ambari ldap configuration instance
+   * @param ldapConnection connection instance
+   * @param configuration  the ambari ldap configuration instance
* @throws AmbariLdapException if the connection is not possible
*/
-  void checkConnection(AmbariLdapConfiguration configuration) throws 
AmbariLdapException;
+  void checkConnection(LdapConnection ld

[21/50] ambari git commit: Added swagger annotations to the new endpoint

2017-10-17 Thread lpuskas
Added swagger annotations to the new endpoint


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 8942e3f0fa18380a56663cad7fd422af5b227bc1
Parents: 80a293c
Author: Balázs Bence Sári 
Authored: Thu Jul 6 18:36:18 2017 +0200
Committer: lpuskas 
Committed: Tue Oct 17 18:41:08 2017 +0200

--
 .../AmbariConfigurationRequestSwagger.java  | 48 +++
 .../AmbariConfigurationResponseSwagger.java | 40 +
 .../services/AmbariConfigurationService.java| 62 +---
 3 files changed, 143 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/8942e3f0/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationRequestSwagger.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationRequestSwagger.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationRequestSwagger.java
new file mode 100644
index 000..d6714f9
--- /dev/null
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationRequestSwagger.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed 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.api.services;
+
+import java.util.Map;
+
+import org.apache.ambari.server.controller.ApiModel;
+import org.apache.ambari.server.orm.entities.ConfigurationBaseEntity;
+
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * Request data model for {@link 
org.apache.ambari.server.api.services.AmbariConfigurationService}
+ */
+public interface AmbariConfigurationRequestSwagger extends ApiModel {
+
+  @ApiModelProperty(name = "AmbariConfiguration")
+  AmbariConfigurationRequestInfo getAmbariConfiguration();
+
+  interface AmbariConfigurationRequestInfo {
+@ApiModelProperty
+Long getId();
+
+@ApiModelProperty
+Map getData();
+
+@ApiModelProperty
+String getType();
+
+@ApiModelProperty
+Long getVersion();
+
+@ApiModelProperty(name = "version_tag")
+String getVersionTag();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/8942e3f0/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationResponseSwagger.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationResponseSwagger.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationResponseSwagger.java
new file mode 100644
index 000..c55ac1d
--- /dev/null
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationResponseSwagger.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed 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.api.services;
+
+import java.util.Map;
+
+import org.apache.ambari.server.controller.ApiModel;
+
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * Response data model for {@link 
org.apache.ambari.server.api.services.AmbariConfigurationService}
+ */
+public interface AmbariConfigurationResponseSwagger extends ApiModel {
+
+  @ApiModelProperty(name = "AmbariConfiguration")
+  AmbariConfigurationResponseInfo getAmbariConfigurationResponse();
+
+  interface AmbariConfigurationResponseInfo {
+@ApiModelProperty
+Long getId();
+
+@ApiModelProperty
+Map getData();
+
+@ApiMode

[36/50] ambari git commit:  AMBARI-21307 Implemented more detectors. Organized the code

2017-10-17 Thread lpuskas
 AMBARI-21307 Implemented more detectors. Organized the code


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: daa4aa8b594b0e2f147b6d62ed0aed4f33d2daa9
Parents: 07d2e0f
Author: lpuskas 
Authored: Tue Sep 12 11:58:45 2017 +0200
Committer: lpuskas 
Committed: Tue Oct 17 18:41:12 2017 +0200

--
 .../server/ldap/AmbariLdapConfiguration.java|   1 +
 .../ads/DefaultAttributeDetectionService.java   | 134 ++-
 .../ldap/service/ads/ObjectClassDetector.java   |  81 ---
 .../ads/OccurranceAndWeightBasedDetector.java   |  81 ---
 .../service/ads/UserNameAttributeDetector.java  |  75 ---
 .../ads/detectors/GroupMemberAttrDetector.java  |  56 
 .../ads/detectors/GroupNameAttrDetector.java|  61 +
 .../ads/detectors/GroupObjectClassDetector.java |  64 +
 .../OccurranceAndWeightBasedDetector.java   | 103 ++
 .../detectors/UserGroupMemberAttrDetector.java  |  56 
 .../ads/detectors/UserNameAttrDetector.java |  60 +
 .../ads/detectors/UserObjectClassDetector.java  |  64 +
 .../DefaultAttributeDetectionServiceTest.java   |  10 +-
 13 files changed, 571 insertions(+), 275 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/daa4aa8b/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
index e28c6ed..ebb567d 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
@@ -56,6 +56,7 @@ public class AmbariLdapConfiguration {
 
 USER_OBJECT_CLASS("ambari.ldap.attributes.user.object_class"),
 USER_NAME_ATTRIBUTE("ambari.ldap.attributes.user.name_attr"),
+
USER_GROUP_MEMBER_ATTRIBUTE("ambari.ldap.attributes.user.group_member_attr"),
 USER_SEARCH_BASE("ambari.ldap.attributes.user.search_base"),
 
 GROUP_OBJECT_CLASS("ambari.ldap.attributes.group.object_class"),

http://git-wip-us.apache.org/repos/asf/ambari/blob/daa4aa8b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultAttributeDetectionService.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultAttributeDetectionService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultAttributeDetectionService.java
index 710adf1..b3a4fde 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultAttributeDetectionService.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultAttributeDetectionService.java
@@ -14,15 +14,18 @@
 
 package org.apache.ambari.server.ldap.service.ads;
 
-import java.util.Set;
-
 import javax.inject.Inject;
 import javax.inject.Singleton;
 
 import org.apache.ambari.server.ldap.AmbariLdapConfiguration;
 import org.apache.ambari.server.ldap.service.AmbariLdapException;
-import org.apache.ambari.server.ldap.service.AttributeDetector;
 import org.apache.ambari.server.ldap.service.LdapAttributeDetectionService;
+import 
org.apache.ambari.server.ldap.service.ads.detectors.GroupMemberAttrDetector;
+import 
org.apache.ambari.server.ldap.service.ads.detectors.GroupNameAttrDetector;
+import 
org.apache.ambari.server.ldap.service.ads.detectors.GroupObjectClassDetector;
+import 
org.apache.ambari.server.ldap.service.ads.detectors.UserGroupMemberAttrDetector;
+import 
org.apache.ambari.server.ldap.service.ads.detectors.UserNameAttrDetector;
+import 
org.apache.ambari.server.ldap.service.ads.detectors.UserObjectClassDetector;
 import org.apache.directory.api.ldap.model.cursor.SearchCursor;
 import org.apache.directory.api.ldap.model.entry.Entry;
 import org.apache.directory.api.ldap.model.message.Response;
@@ -37,24 +40,29 @@ import 
org.apache.directory.ldap.client.api.search.FilterBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.collect.Sets;
-
 @Singleton
 public class DefaultAttributeDetectionService implements 
LdapAttributeDetectionService {
 
   private static final Logger LOGGER = 
LoggerFactory.getLogger(DefaultAttributeDetectionService.class);
   private static final

[25/50] ambari git commit: AMBARI-21307 Draft skimplementation for the user related ldap config attribute validation

2017-10-17 Thread lpuskas
AMBARI-21307 Draft skimplementation for the user related ldap config attribute 
validation


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 38b5be5c2b7064f8b159530af27546829b24fb7d
Parents: c330ee6
Author: lpuskas 
Authored: Tue Jul 18 17:48:07 2017 +0200
Committer: lpuskas 
Committed: Tue Oct 17 18:41:09 2017 +0200

--
 ambari-project/pom.xml  |   1 +
 ambari-server/pom.xml   |   5 +
 .../AmbariConfigurationRequestSwagger.java  |   1 -
 .../services/ldap/AmbariConfigurationDTO.java   |  67 +++
 .../ldap/LdapCheckConfigurationRequest.java |  47 +
 .../api/services/ldap/LdapOperationRequest.java |  18 ++
 .../api/services/ldap/LdapRequestInfo.java  |  61 +++
 .../api/services/ldap/LdapRestService.java  | 132 ++
 .../ambari/server/controller/AmbariServer.java  |   3 +-
 .../server/controller/ControllerModule.java |   1 +
 .../server/ldap/AmbariLdapConfiguration.java| 129 ++
 .../server/ldap/LdapConfigurationFactory.java   |  21 +++
 .../ldap/LdapConfigurationValidatorService.java |  52 ++
 .../apache/ambari/server/ldap/LdapModule.java   |  37 
 .../ldap/service/AmbariLdapException.java   |  33 
 .../server/ldap/service/AmbariLdapFacade.java   | 107 +++
 .../ambari/server/ldap/service/LdapFacade.java  |  52 ++
 .../server/ldap/service/LdapSearchService.java  |  18 ++
 .../ad/AdLdapConfigurationValidatorService.java | 177 +++
 .../service/ad/LdapConfigurationConverter.java  |  50 ++
 .../api/services/ldap/LDAPServiceTest.java  |  85 +
 ...AdLdapConfigurationValidatorServiceTest.java | 129 ++
 22 files changed, 1224 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/38b5be5c/ambari-project/pom.xml
--
diff --git a/ambari-project/pom.xml b/ambari-project/pom.xml
index 00ba1bc..e4d4423 100644
--- a/ambari-project/pom.xml
+++ b/ambari-project/pom.xml
@@ -31,6 +31,7 @@
 ${project.parent.basedir}
 1.6.3
 8.1.19.v20160209
+1.0.0
 6.19 
 1.5.10
 3.1.4

http://git-wip-us.apache.org/repos/asf/ambari/blob/38b5be5c/ambari-server/pom.xml
--
diff --git a/ambari-server/pom.xml b/ambari-server/pom.xml
index e250da7..8d52821 100644
--- a/ambari-server/pom.xml
+++ b/ambari-server/pom.xml
@@ -1689,6 +1689,11 @@
   4.2.2
 
 
+  org.apache.directory.api
+  api-all
+  ${ldap-api.version}
+
+
   com.networknt
   json-schema-validator
   0.1.10

http://git-wip-us.apache.org/repos/asf/ambari/blob/38b5be5c/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationRequestSwagger.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationRequestSwagger.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationRequestSwagger.java
index d6714f9..5e8094e 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationRequestSwagger.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationRequestSwagger.java
@@ -16,7 +16,6 @@ package org.apache.ambari.server.api.services;
 import java.util.Map;
 
 import org.apache.ambari.server.controller.ApiModel;
-import org.apache.ambari.server.orm.entities.ConfigurationBaseEntity;
 
 import io.swagger.annotations.ApiModelProperty;
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/38b5be5c/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/AmbariConfigurationDTO.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/AmbariConfigurationDTO.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/AmbariConfigurationDTO.java
new file mode 100644
index 000..1b134fe
--- /dev/null
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/AmbariConfigurationDTO.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed 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 ag

[09/46] ambari git commit: Updated team page. (yusaku)

2017-10-19 Thread lpuskas
Updated team page. (yusaku)


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: c9c96cdb881e59d8a3dfe19e32069adf05fdf445
Parents: 29d1139
Author: Yusaku Sako 
Authored: Wed Oct 18 11:08:50 2017 -0700
Committer: Yusaku Sako 
Committed: Wed Oct 18 11:08:50 2017 -0700

--
 docs/pom.xml | 12 
 1 file changed, 12 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/c9c96cdb/docs/pom.xml
--
diff --git a/docs/pom.xml b/docs/pom.xml
index a75e093..8af497e 100644
--- a/docs/pom.xml
+++ b/docs/pom.xml
@@ -186,6 +186,18 @@
 
 
 
+amruta
+Amruta R Borkar
+amr...@apache.org
+
+
+Committer
+
+
+IBM
+
+
+
 aonishuk
 Andrew Onischuk
 aonis...@apache.org



[04/46] ambari git commit: AMBARI-22258. Use correct property attribute setter fn(). while setting 'tez.runtime.io.sort.mb' maximum value.

2017-10-19 Thread lpuskas
AMBARI-22258. Use correct property attribute setter fn(). while setting 
'tez.runtime.io.sort.mb' maximum value.


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: b9f26708dd19c444918ea9b21150f66236fcdf2d
Parents: c924ebd
Author: Swapan Shridhar 
Authored: Tue Oct 17 13:03:31 2017 -0700
Committer: Swapan Shridhar 
Committed: Tue Oct 17 13:04:52 2017 -0700

--
 .../src/main/resources/stacks/HDP/2.5/services/stack_advisor.py | 3 ++-
 .../src/test/python/stacks/2.5/common/test_stack_advisor.py | 5 -
 2 files changed, 6 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/b9f26708/ambari-server/src/main/resources/stacks/HDP/2.5/services/stack_advisor.py
--
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.5/services/stack_advisor.py 
b/ambari-server/src/main/resources/stacks/HDP/2.5/services/stack_advisor.py
index 92ce9b9..b6f2478 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.5/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/services/stack_advisor.py
@@ -860,6 +860,7 @@ class HDP25StackAdvisor(HDP24StackAdvisor):
 putHiveInteractiveEnvProperty = self.putProperty(configurations, 
"hive-interactive-env", services)
 putHiveInteractiveEnvPropertyAttribute = 
self.putPropertyAttribute(configurations, "hive-interactive-env")
 putTezInteractiveSiteProperty = self.putProperty(configurations, 
"tez-interactive-site", services)
+putTezInteractiveSitePropertyAttribute = 
self.putPropertyAttribute(configurations, "tez-interactive-site")
 llap_daemon_selected_queue_name = None
 selected_queue_is_ambari_managed_llap = None  # Queue named 'llap' at root 
level is Ambari managed.
 llap_selected_queue_am_percent = None
@@ -1331,7 +1332,7 @@ class HDP25StackAdvisor(HDP24StackAdvisor):
 putTezInteractiveSiteProperty('tez.runtime.io.sort.mb', 
tez_runtime_io_sort_mb)
 if "tez-site" in services["configurations"] and "tez.runtime.sorter.class" 
in services["configurations"]["tez-site"]["properties"]:
   if 
services["configurations"]["tez-site"]["properties"]["tez.runtime.sorter.class"]
 == "LEGACY":
-putTezInteractiveSiteProperty("tez.runtime.io.sort.mb", "maximum", 
1800)
+putTezInteractiveSitePropertyAttribute("tez.runtime.io.sort.mb", 
"maximum", 1800)
 
 
putTezInteractiveSiteProperty('tez.runtime.unordered.output.buffer.size-mb', 
tez_runtime_unordered_output_buffer_size)
 
putHiveInteractiveSiteProperty('hive.auto.convert.join.noconditionaltask.size', 
hive_auto_convert_join_noconditionaltask_size)

http://git-wip-us.apache.org/repos/asf/ambari/blob/b9f26708/ambari-server/src/test/python/stacks/2.5/common/test_stack_advisor.py
--
diff --git 
a/ambari-server/src/test/python/stacks/2.5/common/test_stack_advisor.py 
b/ambari-server/src/test/python/stacks/2.5/common/test_stack_advisor.py
index cf462de..407e78d 100644
--- a/ambari-server/src/test/python/stacks/2.5/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.5/common/test_stack_advisor.py
@@ -4446,7 +4446,8 @@ class TestHDP25StackAdvisor(TestCase):
   },
 "tez-site": {
   "properties": {
-"tez.am.resource.memory.mb": "1024"
+"tez.am.resource.memory.mb": "1024",
+"tez.runtime.sorter.class": "LEGACY"
   }
 },
   }
@@ -4481,6 +4482,8 @@ class TestHDP25StackAdvisor(TestCase):
 
 
self.assertEqual(configurations['hive-interactive-site']['properties']['hive.llap.io.memory.size'],
 '186368')
 
self.assertEqual(configurations['hive-interactive-env']['properties']['llap_heap_size'],
 '9830')
+
self.assertEqual(configurations['tez-interactive-site']['properties']['tez.runtime.io.sort.mb'],
 '1092')
+
self.assertEquals(configurations['tez-interactive-site']['property_attributes']['tez.runtime.io.sort.mb'],
 {'maximum': '1800'})
 
 
 



[07/46] ambari git commit: AMBARI-22263. Disable Actions menu while Wizard in progress instead of hide (alexantonenko)

2017-10-19 Thread lpuskas
AMBARI-22263. Disable Actions menu while Wizard in progress instead of hide 
(alexantonenko)


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 84342f6a851daa12ef612a96e0076ea893fd12f2
Parents: ee509e0
Author: Alex Antonenko 
Authored: Wed Oct 18 18:26:08 2017 +0300
Committer: Alex Antonenko 
Committed: Wed Oct 18 18:26:08 2017 +0300

--
 ambari-web/app/app.js   |  24 ++-
 .../models/configs/service_config_version.js|   9 +-
 ambari-web/app/models/host_stack_version.js |   4 +-
 .../common/configs/config_history_flow.hbs  |   8 +-
 .../common/configs/service_version_box.hbs  |   8 +-
 .../templates/common/host_progress_popup.hbs|   6 +-
 .../modal_popups/widget_browser_popup.hbs   |   6 +-
 ambari-web/app/templates/experimental.hbs   |   6 +-
 .../main/admin/stack_upgrade/versions.hbs   |   6 +-
 ambari-web/app/templates/main/host.hbs  |   4 +-
 .../templates/main/host/bulk_operation_menu.hbs |   4 +-
 .../main/host/details/host_component.hbs| 176 ++-
 .../app/templates/main/host/stack_versions.hbs  |   4 +-
 ambari-web/app/templates/main/host/summary.hbs  | 120 +++--
 ambari-web/app/utils/helper.js  |  23 +++
 ambari-web/app/views/main/service/item.js   |   2 +-
 ambari-web/test/views/main/service/item_test.js |   6 +-
 17 files changed, 224 insertions(+), 192 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/84342f6a/ambari-web/app/app.js
--
diff --git a/ambari-web/app/app.js b/ambari-web/app/app.js
index 2c638e4..6432849 100644
--- a/ambari-web/app/app.js
+++ b/ambari-web/app/app.js
@@ -131,27 +131,18 @@ module.exports = Em.Application.create({
   }.property('upgradeIsRunning', 'upgradeAborted', 
'router.wizardWatcherController.isNonWizardUser', 'upgradeSuspended'),
 
   /**
-   * Options:
-   *  - ignoreWizard: ignore when some wizard is running by another user 
(default `false`)
-   *
* @param {string} authRoles
-   * @param {object} options
* @returns {boolean}
*/
-  isAuthorized: function (authRoles, options) {
-options = $.extend({ignoreWizard: false}, options);
+  havePermissions: function (authRoles) {
 var result = false;
 authRoles = $.map(authRoles.split(","), $.trim);
 
 // When Upgrade running(not suspended) only operations related to upgrade 
should be allowed
 if ((!this.get('upgradeSuspended') && 
!authRoles.contains('CLUSTER.UPGRADE_DOWNGRADE_STACK')) &&
-!App.get('supports.opsDuringRollingUpgrade') &&
-!['NOT_REQUIRED', 'COMPLETED'].contains(this.get('upgradeState')) ||
-!App.auth){
-  return false;
-}
-
-if (!options.ignoreWizard && 
App.router.get('wizardWatcherController.isNonWizardUser')) {
+  !App.get('supports.opsDuringRollingUpgrade') &&
+  !['NOT_REQUIRED', 'COMPLETED'].contains(this.get('upgradeState')) ||
+  !App.auth){
   return false;
 }
 
@@ -161,6 +152,13 @@ module.exports = Em.Application.create({
 
 return result;
   },
+  /**
+   * @param {string} authRoles
+   * @returns {boolean}
+   */
+  isAuthorized: function (authRoles) {
+return this.havePermissions(authRoles) && 
!App.router.get('wizardWatcherController.isNonWizardUser');
+  },
 
   isStackServicesLoaded: false,
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/84342f6a/ambari-web/app/models/configs/service_config_version.js
--
diff --git a/ambari-web/app/models/configs/service_config_version.js 
b/ambari-web/app/models/configs/service_config_version.js
index 4120681..7645377 100644
--- a/ambari-web/app/models/configs/service_config_version.js
+++ b/ambari-web/app/models/configs/service_config_version.js
@@ -141,12 +141,13 @@ App.ServiceConfigVersion = DS.Model.extend({
* {{view: (string|boolean), compare: (string|boolean), revert: 
(string|boolean)}} disabledActionAttr
*/
   disabledActionAttr: function () {
+var isNonWizardUser = 
App.router.get('wizardWatcherController.isNonWizardUser');
 return {
-  view: (this.get('isDisplayed')) ? 'disabled' : false,
-  compare: (this.get('isDisabled') || this.get('isDisplayed')) ? 
'disabled' : false,
-  revert: (this.get('isDisabled') || this.get('isCurrent')) ? 'disabled' : 
false
+  view: (this.get('isDisplayed') || isNonWizardUser) ? 'disabled' : false,
+  compare: (this.get('isDisabled') || isNonWizardUser || 
this.get('isDisplayed')) ? 'disabled' : false,
+  re

[01/46] ambari git commit: AMBARI-22255. Make the install modal full screen (alexantonenko) [Forced Update!]

2017-10-19 Thread lpuskas
Repository: ambari
Updated Branches:
  refs/heads/feature-branch-AMBARI-21307 4c5e25101 -> d3120b009 (forced update)


AMBARI-22255. Make the install modal full screen (alexantonenko)


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 448d6a8b235583a20206b790bee8170de32f27b7
Parents: ce29f8c
Author: Alex Antonenko 
Authored: Tue Oct 17 20:26:49 2017 +0300
Committer: Alex Antonenko 
Committed: Tue Oct 17 20:26:49 2017 +0300

--
 ambari-web/app/messages.js |  1 +
 ambari-web/app/routes/installer.js |  3 +--
 ambari-web/app/routes/main.js  |  1 +
 ambari-web/app/styles/application.less |  3 +--
 ambari-web/app/styles/common.less  |  2 +-
 ambari-web/app/styles/wizard.less  | 24 +++-
 ambari-web/app/templates/installer.hbs |  2 +-
 7 files changed, 29 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/448d6a8b/ambari-web/app/messages.js
--
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 3c4f038..0123356 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -21,6 +21,7 @@ Em.I18n.translations = {
   'app.name':'Ambari',
   'app.name.subtitle':'Ambari - {0}',
   'app.name.subtitle.experimental':'Ambari Experimental',
+  'app.name.subtitle.installer':'Cluster Install Wizard',
   'app.reloadPopup.link': 'Reload Page',
   'app.reloadPopup.text': 'Trying to connect to server...',
   'app.reloadPopup.noClusterName.text': 'Failed to retrieve cluster name, 
trying to reload...',

http://git-wip-us.apache.org/repos/asf/ambari/blob/448d6a8b/ambari-web/app/routes/installer.js
--
diff --git a/ambari-web/app/routes/installer.js 
b/ambari-web/app/routes/installer.js
index ec8f1b9..f1f6659 100644
--- a/ambari-web/app/routes/installer.js
+++ b/ambari-web/app/routes/installer.js
@@ -35,8 +35,7 @@ module.exports = Em.Route.extend(App.RouterRedirections, {
   // check server/web client versions match
   
App.router.get('installerController').checkServerClientVersion().done(function 
() {
 
-var name = 'Cluster Install Wizard';
-$('title').text('Ambari - ' + name);
+
$('title').text(Em.I18n.t('app.name.subtitle').format(Em.I18n.t('app.name.subtitle.installer')));
 $('#main').addClass('install-wizard-content');
 
 App.router.get('mainViewsController').loadAmbariViews();

http://git-wip-us.apache.org/repos/asf/ambari/blob/448d6a8b/ambari-web/app/routes/main.js
--
diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js
index 7ed18de..d1f9012 100644
--- a/ambari-web/app/routes/main.js
+++ b/ambari-web/app/routes/main.js
@@ -40,6 +40,7 @@ module.exports = Em.Route.extend(App.RouterRedirections, {
   clusterController.loadAmbariProperties().complete(function () {
 App.router.get('mainViewsController').loadAmbariViews();
 clusterController.loadClusterName(false).done(function () {
+  $('#main').removeClass('install-wizard-content');
   if (App.get('testMode')) {
 router.get('mainController').initialize();
   } else {

http://git-wip-us.apache.org/repos/asf/ambari/blob/448d6a8b/ambari-web/app/styles/application.less
--
diff --git a/ambari-web/app/styles/application.less 
b/ambari-web/app/styles/application.less
index 099f3cf..d40ab8e 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -80,7 +80,6 @@ footer {
   color: #666;
   margin-top: -1 * @footer-height - 1;
   height: @footer-height - 60px;
-  margin-left: @side-navigation-width;
 }
 
 .editable-list-container {
@@ -2807,4 +2806,4 @@ a.abort-icon:hover {
 .container-wrap-table {
   padding: 0 10px;
   background-color: @diff-background-equal;
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/448d6a8b/ambari-web/app/styles/common.less
--
diff --git a/ambari-web/app/styles/common.less 
b/ambari-web/app/styles/common.less
index 7753a59..7202342 100644
--- a/ambari-web/app/styles/common.less
+++ b/ambari-web/app/styles/common.less
@@ -186,7 +186,7 @@
 }
 
 @footer-height: 100px;
-@side-navigation-width: 190px;
+@side-navigation-width: 230px;
 
 @default-font-size: 

[03/46] ambari git commit: AMBARI-22254. RU: RU failed on 'Updating configuration sqoop-atlas-application.properties' (ncole)

2017-10-19 Thread lpuskas
AMBARI-22254. RU: RU failed on 'Updating configuration 
sqoop-atlas-application.properties' (ncole)


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: c924ebdb6da802ab70f95c6f974087645a600b78
Parents: 53f028e
Author: Nate Cole 
Authored: Tue Oct 17 13:38:10 2017 -0400
Committer: Nate Cole 
Committed: Tue Oct 17 14:18:24 2017 -0400

--
 .../serveraction/upgrades/ConfigureAction.java  |  5 
 .../ambari/server/state/stack/UpgradePack.java  | 30 +++-
 .../state/stack/upgrade/ClusterGrouping.java| 13 +
 .../state/stack/upgrade/ConfigureTask.java  | 16 +++
 .../internal/UpgradeResourceProviderTest.java   | 13 +
 .../state/stack/ConfigUpgradeValidityTest.java  | 10 +++
 6 files changed, 86 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/c924ebdb/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/ConfigureAction.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/ConfigureAction.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/ConfigureAction.java
index a7f910f..f15a507 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/ConfigureAction.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/upgrades/ConfigureAction.java
@@ -183,6 +183,11 @@ public class ConfigureAction extends 
AbstractUpgradeServerAction {
 String configType = 
commandParameters.get(ConfigureTask.PARAMETER_CONFIG_TYPE);
 String serviceName = cluster.getServiceByConfigType(configType);
 
+// !!! we couldn't get the service based on its config type, so try the 
associated
+if (StringUtils.isBlank(serviceName)) {
+  serviceName = 
commandParameters.get(ConfigureTask.PARAMETER_ASSOCIATED_SERVICE);
+}
+
 RepositoryVersionEntity sourceRepoVersion = 
upgradeContext.getSourceRepositoryVersion(serviceName);
 RepositoryVersionEntity targetRepoVersion = 
upgradeContext.getTargetRepositoryVersion(serviceName);
 StackId sourceStackId = sourceRepoVersion.getStackId();

http://git-wip-us.apache.org/repos/asf/ambari/blob/c924ebdb/ambari-server/src/main/java/org/apache/ambari/server/state/stack/UpgradePack.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/UpgradePack.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/UpgradePack.java
index 256b71d..7c32f37 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/UpgradePack.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/UpgradePack.java
@@ -37,11 +37,13 @@ import javax.xml.bind.annotation.XmlValue;
 
 import org.apache.ambari.server.api.services.AmbariMetaInfo;
 import org.apache.ambari.server.state.stack.upgrade.ClusterGrouping;
+import org.apache.ambari.server.state.stack.upgrade.ConfigureTask;
 import org.apache.ambari.server.state.stack.upgrade.Direction;
 import org.apache.ambari.server.state.stack.upgrade.Grouping;
 import org.apache.ambari.server.state.stack.upgrade.ServiceCheckGrouping;
 import org.apache.ambari.server.state.stack.upgrade.Task;
 import org.apache.ambari.server.state.stack.upgrade.UpgradeType;
+import org.apache.commons.collections.CollectionUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -446,7 +448,7 @@ public class UpgradePack {
   private void initializeProcessingComponentMappings() {
 m_process = new LinkedHashMap<>();
 
-if (null == processing || processing.isEmpty()) {
+if (CollectionUtils.isEmpty(processing)) {
   return;
 }
 
@@ -574,6 +576,32 @@ public class UpgradePack {
 
 throw new RuntimeException(error);
   }
+
+  // !!! check for config tasks and mark the associated service
+  initializeTasks(service.name, preTasks);
+  initializeTasks(service.name, postTasks);
+  initializeTasks(service.name, tasks);
+  initializeTasks(service.name, preDowngradeTasks);
+  initializeTasks(service.name, postDowngradeTasks);
+}
+
+/**
+ * Checks for config tasks and marks the associated service.
+ * @param service
+ *  the service name
+ * @param tasks
+ *  the list of tasks to check
+ */
+private void initializeTasks(String service, List tasks) {
+  if (CollectionUtils.isEmpty(tasks)) {
+return;
+  }
+
+  for (Task 

[14/46] ambari git commit: AMBARI-22267 - Version registration failure during patch upgrade + Debian + Oracle run (jonathanhurley)

2017-10-19 Thread lpuskas
AMBARI-22267 - Version registration failure during patch upgrade + Debian + 
Oracle run (jonathanhurley)


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: b4eddc9770eda0e47fe025254ba6143a581a7855
Parents: 2ae81d9
Author: Jonathan Hurley 
Authored: Wed Oct 18 19:27:34 2017 -0400
Committer: Jonathan Hurley 
Committed: Wed Oct 18 19:41:23 2017 -0400

--
 .../ambari/server/orm/entities/RepositoryVersionEntity.java| 5 +
 .../ambari/server/orm/entities/ServiceDesiredStateEntity.java  | 6 +++---
 2 files changed, 4 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/b4eddc97/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RepositoryVersionEntity.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RepositoryVersionEntity.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RepositoryVersionEntity.java
index b4f59dc..7eedc4d 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RepositoryVersionEntity.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RepositoryVersionEntity.java
@@ -21,13 +21,11 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Set;
 
-import javax.persistence.Basic;
 import javax.persistence.CascadeType;
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.EnumType;
 import javax.persistence.Enumerated;
-import javax.persistence.FetchType;
 import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
@@ -92,7 +90,7 @@ import com.google.inject.Provider;
 query = "SELECT repositoryVersion FROM RepositoryVersionEntity 
repositoryVersion WHERE repositoryVersion.version = :version ORDER BY 
repositoryVersion.id DESC"),
 @NamedQuery(
 name = "findByServiceDesiredVersion",
-query = "SELECT DISTINCT sd.desiredRepositoryVersion from 
ServiceDesiredStateEntity sd WHERE sd.desiredRepositoryVersion IN ?1") })
+query = "SELECT repositoryVersion FROM RepositoryVersionEntity 
repositoryVersion WHERE repositoryVersion IN (SELECT DISTINCT 
sd1.desiredRepositoryVersion FROM ServiceDesiredStateEntity sd1 WHERE 
sd1.desiredRepositoryVersion IN ?1)") })
 @StaticallyInject
 public class RepositoryVersionEntity {
   private static final Logger LOG = 
LoggerFactory.getLogger(RepositoryVersionEntity.class);
@@ -129,7 +127,6 @@ public class RepositoryVersionEntity {
   @Enumerated(value = EnumType.STRING)
   private RepositoryType type = RepositoryType.STANDARD;
 
-  @Basic(fetch=FetchType.LAZY)
   @Lob
   @Column(name="version_xml", insertable = true, updatable = true)
   private String versionXml;

http://git-wip-us.apache.org/repos/asf/ambari/blob/b4eddc97/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceDesiredStateEntity.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceDesiredStateEntity.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceDesiredStateEntity.java
index fc26478..dbb999e 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceDesiredStateEntity.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceDesiredStateEntity.java
@@ -39,20 +39,20 @@ import org.apache.commons.lang.builder.EqualsBuilder;
 @Entity
 public class ServiceDesiredStateEntity {
 
-  @Column(name = "cluster_id", nullable = false, insertable = false, updatable 
= false, length = 10)
   @Id
+  @Column(name = "cluster_id", nullable = false, insertable = false, updatable 
= false, length = 10)  
   private Long clusterId;
 
-  @Column(name = "service_name", nullable = false, insertable = false, 
updatable = false)
   @Id
+  @Column(name = "service_name", nullable = false, insertable = false, 
updatable = false)
   private String serviceName;
 
   @Column(name = "desired_state", nullable = false, insertable = true, 
updatable = true)
   @Enumerated(value = EnumType.STRING)
   private State desiredState = State.INIT;
 
-  @Column(name = "desired_host_role_mapping", nullable = false, insertable = 
true, updatable = true, length = 10)
   @Basic
+  @Column(name = "desired_host_role_mapping", nullable = false, insertable = 
true, updatable = true, length = 10)  
   private int desiredHostRoleMapping = 0;
 
   @Column(name = "maintenance_st

[42/46] ambari git commit: AMBARI-21307 Added unit tests. Improved logging, refactoring: rename, organized classes into packages

2017-10-19 Thread lpuskas
AMBARI-21307 Added unit tests. Improved logging, refactoring: rename, organized 
classes into packages


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 3bb03e989424413b188474ee009f90d76951fb18
Parents: 010ff38
Author: lpuskas 
Authored: Fri Oct 13 17:19:41 2017 +0200
Committer: lpuskas 
Committed: Thu Oct 19 14:42:02 2017 +0200

--
 .../apache/ambari/server/ldap/LdapModule.java   |   2 +-
 .../AmbariLdapConfigurationProvider.java|  13 +-
 .../server/ldap/service/AmbariLdapFacade.java   |   2 +-
 .../service/LdapConnectionConfigService.java|   4 +-
 .../ads/DefaultLdapConfigurationService.java|  38 +++-
 .../ads/DefaultLdapConnectionConfigService.java | 116 ++
 .../DefaultLdapConnectionConfigService.java | 116 --
 .../server/ldap/LdapModuleFunctionalTest.java   |   4 +-
 ...estAmbariAmbariLdapConfigurationFactory.java |  29 ---
 .../TestAmbariLdapConfigurationFactory.java |  29 +++
 .../ldap/service/AmbariLdapFacadeTest.java  |   4 +-
 .../DefaultLdapConfigurationServiceTest.java| 221 +++
 12 files changed, 414 insertions(+), 164 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/3bb03e98/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapModule.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapModule.java 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapModule.java
index 4abf4e7..67e84dc 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapModule.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapModule.java
@@ -25,7 +25,7 @@ import 
org.apache.ambari.server.ldap.service.LdapConnectionConfigService;
 import org.apache.ambari.server.ldap.service.LdapFacade;
 import 
org.apache.ambari.server.ldap.service.ads.DefaultLdapAttributeDetectionService;
 import 
org.apache.ambari.server.ldap.service.ads.DefaultLdapConfigurationService;
-import 
org.apache.ambari.server.ldap.service.ads.detectors.DefaultLdapConnectionConfigService;
+import 
org.apache.ambari.server.ldap.service.ads.DefaultLdapConnectionConfigService;
 
 import com.google.inject.AbstractModule;
 import com.google.inject.assistedinject.FactoryModuleBuilder;

http://git-wip-us.apache.org/repos/asf/ambari/blob/3bb03e98/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapConfigurationProvider.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapConfigurationProvider.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapConfigurationProvider.java
index 9fad896..c88d420 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapConfigurationProvider.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapConfigurationProvider.java
@@ -36,7 +36,8 @@ import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
 
 /**
- * Provider implementation for LDAP configurations. It needs to be registered 
in the related GUICE module as a provider
+ * Provider implementation for LDAP configurations.
+ * It needs to be registered in the related GUICE module as a provider.
  * It's responsible for managing LDAP configurations in the application.
  * Whenever requested, this provider returns an AmbariLdapConfiguration which 
is always in sync with the persisted LDAP
  * configuration resource.
@@ -85,15 +86,15 @@ public class AmbariLdapConfigurationProvider implements 
Providerhttp://git-wip-us.apache.org/repos/asf/ambari/blob/3bb03e98/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
index bbfbc8e..0118840 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
@@ -33,7 +33,7 @@ public class AmbariLdapFacade implements LdapFacade {
   /**
* Additional parameters expected to be provided along with the configuration
*/
-  protected enum Parameters {
+  public enum Parameters {
 TEST_USER_NAME("ambari.ldap.test

[22/46] ambari git commit: AMBARI-21307 Draft skimplementation for the user related ldap config attribute validation

2017-10-19 Thread lpuskas
AMBARI-21307 Draft skimplementation for the user related ldap config attribute 
validation


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 5f2fbc15414c615085185b7f610f9eb459f3906c
Parents: 5f35e4d
Author: lpuskas 
Authored: Tue Jul 18 17:48:07 2017 +0200
Committer: lpuskas 
Committed: Thu Oct 19 14:41:57 2017 +0200

--
 ambari-project/pom.xml  |   1 +
 ambari-server/pom.xml   |   5 +
 .../AmbariConfigurationRequestSwagger.java  |   1 -
 .../services/ldap/AmbariConfigurationDTO.java   |  67 +++
 .../ldap/LdapCheckConfigurationRequest.java |  47 +
 .../api/services/ldap/LdapOperationRequest.java |  18 ++
 .../api/services/ldap/LdapRequestInfo.java  |  61 +++
 .../api/services/ldap/LdapRestService.java  | 132 ++
 .../ambari/server/controller/AmbariServer.java  |   3 +-
 .../server/controller/ControllerModule.java |   1 +
 .../server/ldap/AmbariLdapConfiguration.java| 129 ++
 .../server/ldap/LdapConfigurationFactory.java   |  21 +++
 .../ldap/LdapConfigurationValidatorService.java |  52 ++
 .../apache/ambari/server/ldap/LdapModule.java   |  37 
 .../ldap/service/AmbariLdapException.java   |  33 
 .../server/ldap/service/AmbariLdapFacade.java   | 107 +++
 .../ambari/server/ldap/service/LdapFacade.java  |  52 ++
 .../server/ldap/service/LdapSearchService.java  |  18 ++
 .../ad/AdLdapConfigurationValidatorService.java | 177 +++
 .../service/ad/LdapConfigurationConverter.java  |  50 ++
 .../api/services/ldap/LDAPServiceTest.java  |  85 +
 ...AdLdapConfigurationValidatorServiceTest.java | 129 ++
 22 files changed, 1224 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/5f2fbc15/ambari-project/pom.xml
--
diff --git a/ambari-project/pom.xml b/ambari-project/pom.xml
index 00ba1bc..e4d4423 100644
--- a/ambari-project/pom.xml
+++ b/ambari-project/pom.xml
@@ -31,6 +31,7 @@
 ${project.parent.basedir}
 1.6.3
 8.1.19.v20160209
+1.0.0
 6.19 
 1.5.10
 3.1.4

http://git-wip-us.apache.org/repos/asf/ambari/blob/5f2fbc15/ambari-server/pom.xml
--
diff --git a/ambari-server/pom.xml b/ambari-server/pom.xml
index e250da7..8d52821 100644
--- a/ambari-server/pom.xml
+++ b/ambari-server/pom.xml
@@ -1689,6 +1689,11 @@
   4.2.2
 
 
+  org.apache.directory.api
+  api-all
+  ${ldap-api.version}
+
+
   com.networknt
   json-schema-validator
   0.1.10

http://git-wip-us.apache.org/repos/asf/ambari/blob/5f2fbc15/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationRequestSwagger.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationRequestSwagger.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationRequestSwagger.java
index d6714f9..5e8094e 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationRequestSwagger.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationRequestSwagger.java
@@ -16,7 +16,6 @@ package org.apache.ambari.server.api.services;
 import java.util.Map;
 
 import org.apache.ambari.server.controller.ApiModel;
-import org.apache.ambari.server.orm.entities.ConfigurationBaseEntity;
 
 import io.swagger.annotations.ApiModelProperty;
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/5f2fbc15/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/AmbariConfigurationDTO.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/AmbariConfigurationDTO.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/AmbariConfigurationDTO.java
new file mode 100644
index 000..1b134fe
--- /dev/null
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/AmbariConfigurationDTO.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed 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 ag

[44/46] ambari git commit: AMBARI-21307 Added unit test, minor fixes

2017-10-19 Thread lpuskas
AMBARI-21307 Added unit test, minor fixes


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 3f64c096256951bfe4f124161b8b9eb4baf8af86
Parents: e3676a7
Author: lpuskas 
Authored: Wed Oct 18 15:07:28 2017 +0200
Committer: lpuskas 
Committed: Thu Oct 19 14:42:03 2017 +0200

--
 .../DefaultLdapAttributeDetectionService.java   |   2 +-
 .../ads/detectors/AttributeDetectorFactory.java |  21 +--
 ...efaultLdapAttributeDetectionServiceTest.java | 188 +++
 3 files changed, 198 insertions(+), 13 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/3f64c096/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapAttributeDetectionService.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapAttributeDetectionService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapAttributeDetectionService.java
index 25abce7..a9a9b53 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapAttributeDetectionService.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/DefaultLdapAttributeDetectionService.java
@@ -118,7 +118,7 @@ public class DefaultLdapAttributeDetectionService 
implements LdapAttributeDetect
 try {
 
   LdapConnectionTemplate ldapConnectionTemplate = 
ldapConnectionTemplateFactory.create(ambariLdapConfiguration);
-  AttributeDetector groupAttributeDetector = 
attributeDetectorFactory.groupAttributDetector();
+  AttributeDetector groupAttributeDetector = 
attributeDetectorFactory.groupAttributeDetector();
 
   SearchRequest searchRequest = 
assembleGroupSearchRequest(ldapConnectionTemplate, ambariLdapConfiguration);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/3f64c096/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/detectors/AttributeDetectorFactory.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/detectors/AttributeDetectorFactory.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/detectors/AttributeDetectorFactory.java
index 8155461..eba0bd9 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/detectors/AttributeDetectorFactory.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/ads/detectors/AttributeDetectorFactory.java
@@ -33,21 +33,18 @@ public class AttributeDetectorFactory {
   private static final Logger LOG = 
LoggerFactory.getLogger(AttributeDetectorFactory.class);
   private static final String USER_ATTRIBUTES_DETECTORS = 
"UserAttributesDetectors";
   private static final String GROUP_ATTRIBUTES_DETECTORS = 
"GroupAttributesDetectors";
-
-
-  /**
-   * The set of user attribute detectors, configured by GUICE (check the 
relevant guice module implementation)
-   */
-  @Inject
-  @Named(USER_ATTRIBUTES_DETECTORS)
-  private Set userAttributeDetectors;
-
   /**
* The set of group attribute detectors, configured by GUICE (check the 
relevant guice module implementation)
*/
   @Inject
   @Named(GROUP_ATTRIBUTES_DETECTORS)
   Set groupAttributeDetectors;
+  /**
+   * The set of user attribute detectors, configured by GUICE (check the 
relevant guice module implementation)
+   */
+  @Inject
+  @Named(USER_ATTRIBUTES_DETECTORS)
+  private Set userAttributeDetectors;
 
   @Inject
   public AttributeDetectorFactory() {
@@ -59,7 +56,7 @@ public class AttributeDetectorFactory {
* @return the constructed ChainedAttributeDetector instance
*/
   public ChainedAttributeDetector userAttributDetector() {
-LOG.info("Creating instance with user attribute detectors: [{}]", 
userAttributDetector());
+LOG.info("Creating instance with user attribute detectors: [{}]", 
userAttributeDetectors);
 return new ChainedAttributeDetector(userAttributeDetectors);
   }
 
@@ -69,8 +66,8 @@ public class AttributeDetectorFactory {
* @return the constructed ChainedAttributeDetector instance
*/
 
-  public ChainedAttributeDetector groupAttributDetector() {
-LOG.info("Creating instance with group attribute detectors: [{}]", 
groupAttributDetector());
+  public ChainedAttributeDetector groupAttributeDetector() {
+LOG.info("Creating instance with group attribute detectors: [{}]", 
groupAttributeDetectors);
 return new Cha

[31/46] ambari git commit: AMBARI-21307 Testing the attribute detection - fixing bugs, cleanup

2017-10-19 Thread lpuskas
AMBARI-21307 Testing the attribute detection - fixing bugs, cleanup


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 9b4bd20d5e3c2f0df9cfc55f66184221fc936238
Parents: 01295fe
Author: lpuskas 
Authored: Tue Sep 12 18:58:44 2017 +0200
Committer: lpuskas 
Committed: Thu Oct 19 14:42:00 2017 +0200

--
 .../api/services/ldap/LdapConfigurationService.java  | 11 +++
 .../ambari/server/ldap/AmbariLdapConfiguration.java  |  2 +-
 .../org/apache/ambari/server/ldap/LdapModule.java|  3 +++
 .../ambari/server/ldap/service/AmbariLdapFacade.java |  6 ++
 .../ads/DefaultAttributeDetectionService.java| 15 +++
 .../service/ads/DefaultLdapConfigurationService.java |  3 ---
 .../ads/detectors/GroupMemberAttrDetector.java   |  3 +++
 .../service/ads/detectors/GroupNameAttrDetector.java |  3 +++
 .../ads/detectors/GroupObjectClassDetector.java  |  3 +++
 .../ads/detectors/UserGroupMemberAttrDetector.java   |  3 +++
 .../service/ads/detectors/UserNameAttrDetector.java  |  3 +++
 .../ads/DefaultAttributeDetectionServiceTest.java|  3 +--
 .../ads/DefaultLdapConfigurationServiceTest.java |  4 ++--
 13 files changed, 42 insertions(+), 20 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/9b4bd20d/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
index 66809c3..ae47a87 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
@@ -86,6 +86,7 @@ public class LdapConfigurationService extends 
AmbariConfigurationService {
 authorize();
 
 Set groups = Sets.newHashSet();
+Object responseEntity = null;
 
 Result result = new ResultImpl(new ResultStatus(ResultStatus.STATUS.OK));
 try {
@@ -108,13 +109,14 @@ public class LdapConfigurationService extends 
AmbariConfigurationService {
 
   LOGGER.info("Testing LDAP attributes ");
   groups = 
ldapFacade.checkLdapAttributes(ldapConfigurationRequest.getRequestInfo().getParameters(),
 ambariLdapConfiguration);
-  setResult(groups, result);
+  responseEntity = groups;
 
   break;
 case DETECT_ATTRIBUTES:
 
   LOGGER.info("Detecting LDAP attributes ...");
-  ldapFacade.detectAttributes(ambariLdapConfiguration);
+  ambariLdapConfiguration = 
ldapFacade.detectAttributes(ambariLdapConfiguration);
+  responseEntity = ambariLdapConfiguration;
 
   break;
 default:
@@ -123,10 +125,11 @@ public class LdapConfigurationService extends 
AmbariConfigurationService {
   }
 
 } catch (Exception e) {
-  result.setResultStatus(new ResultStatus(ResultStatus.STATUS.BAD_REQUEST, 
e));
+  result.setResultStatus(new 
ResultStatus(ResultStatus.STATUS.SERVER_ERROR, e));
+  responseEntity = e.getMessage();
 }
 
-return 
Response.status(result.getStatus().getStatusCode()).entity(getResultSerializer().serialize(result)).build();
+return 
Response.status(result.getStatus().getStatusCode()).entity(responseEntity).build();
   }
 
   private void setResult(Set groups, Result result) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/9b4bd20d/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
index ebb567d..5bdda7a 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
@@ -62,7 +62,7 @@ public class AmbariLdapConfiguration {
 GROUP_OBJECT_CLASS("ambari.ldap.attributes.group.object_class"),
 GROUP_NAME_ATTRIBUTE("ambari.ldap.attributes.group.name_attr"),
 GROUP_MEMBER_ATTRIBUTE("ambari.ldap.attributes.group.member_attr"),
-GROUP_SEARCH_BASE("ambari.ldap.attributes.user.search_base"),
+   

[29/46] ambari git commit: AMBARI-21307 Add all known LDAP properties to AmbariConfigurationEnum (benyoka)

2017-10-19 Thread lpuskas
AMBARI-21307 Add all known LDAP properties to AmbariConfigurationEnum (benyoka)


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: d4b9215f6991599920aec886a8f79efd6e52ad0c
Parents: 38c2785
Author: Balazs Bence Sari 
Authored: Mon Sep 4 12:45:07 2017 +0200
Committer: lpuskas 
Committed: Thu Oct 19 14:41:59 2017 +0200

--
 .../ambari/server/ldap/AmbariLdapConfiguration.java  | 15 ++-
 1 file changed, 14 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/d4b9215f/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
index b1cbced..e913e77 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
@@ -40,22 +40,35 @@ public class AmbariLdapConfiguration {
 USE_SSL("ambari.ldap.usessl"),
 LDAP_SERVER_HOST("ambari.ldap.server.host"),
 LDAP_SERVER_PORT("ambari.ldap.server.port"),
+LDAP_TRUSTSTORE("ambari.ldap.truststore"),
 LDAP_TRUSTSTORE_TYPE("ambari.ldap.truststore.type"),
 LDAP_TRUSTSTORE_PATH("ambari.ldap.truststore.path"),
+LDAP_TRUSTSTORE_PASSWORD("ambari.ldap.truststore.password"),
 BASE_DN("ambari.ldap.bind.dn"),
+REFERRAL("ambari.ldap.referral"),
+PAGINATION_ENABLED("ambari.ldap.pagination.enabled"),
 
 BIND_ANONIMOUSLY("ambari.ldap.bindanonymously"),
 MANAGER_DN("ambari.ldap.managerdn"),
 MANAGER_PASSWORD("ambari.ldap.managerpassword"),
 USER_OBJECT_CLASS("ambari.ldap.user.object.class"),
 USER_NAME_ATTRIBUTE("ambari.ldap.user.name.attribute"),
+USER_NAME_FORCE_LOWERCASE("ambari.ldap.username.force.lowercase"),
 USER_SEARCH_BASE("ambari.ldap.user.search.base"),
+
SYNC_USER_MEMBER_REPLACE_PATTERN("ambari.ldap.sync.user.member.replacepattern"),
+SYNC_USER_MEMBER_FILTER("ambari.ldap.sync.user.member_filter"),
 
+ADMIN_GROUP_MAPPING_RULES ("ambari.ldap.admin.group.mappingrules"),
 GROUP_OBJECT_CLASS("ambari.ldap.group.object.class"),
 GROUP_NAME_ATTRIBUTE("ambari.ldap.group.name.attribute"),
 GROUP_MEMBER_ATTRIBUTE("ambari.ldap.group.member.attribute"),
 GROUP_SEARCH_BASE("ambari.ldap.group.search.base"),
-DN_ATTRIBUTE("authentication.ldap.dnAttribute");
+
SYNC_GROUP_MEMBER_REPLACE_PATTERN("ambari.ldap.sync.group.member.replacepattern"),
+SYNC_GROUP_MEMBER_FILTER("ambari.ldap.sync.group.member_filter"),
+DN_ATTRIBUTE("authentication.ldap.dnAttribute"),
+
+TEST_USER_NAME("ambari.ldap.test.user.name"),
+TEST_USER_PASSWORD("ambari.ldap.test.user.password");
 
 private String propertyName;
 



[13/46] ambari git commit: AMBARI-22268. Remove "Hotfix" from Admin Register Version. (Ishan Bhatt via yusaku)

2017-10-19 Thread lpuskas
AMBARI-22268. Remove "Hotfix" from Admin Register Version. (Ishan Bhatt via 
yusaku)


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 2ae81d99a55756bd5240a90d550d34ec2ff73927
Parents: 8852f33
Author: Yusaku Sako 
Authored: Wed Oct 18 15:12:07 2017 -0700
Committer: Yusaku Sako 
Committed: Wed Oct 18 15:12:07 2017 -0700

--
 .../src/main/resources/ui/admin-web/app/scripts/i18n.config.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/2ae81d99/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js
--
diff --git 
a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js 
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js
index 1711543..183a276 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js
@@ -344,7 +344,7 @@ angular.module('ambariAdminConsole')
 'users.alerts.usersEffectivePrivilege': '{{user_name}}\'s effective 
privilege through its Group(s) is higher than your selected privilege.',
 
 'versions.current': 'Current',
-'versions.addVersion': 'Add Version or Hotfix',
+'versions.addVersion': 'Add Version',
 'versions.defaultVersion': '(Default Version Definition)',
 'versions.inUse': 'In Use',
 'versions.installed': 'Installed',



[11/46] ambari git commit: AMBARI-22258. Use correct property attribute setter fn(). while setting 'tez.runtime.io.sort.mb' maximum value.

2017-10-19 Thread lpuskas
AMBARI-22258. Use correct property attribute setter fn(). while setting 
'tez.runtime.io.sort.mb' maximum value.


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 3b5cbed0983ef3e47b6a948dcbeeef0ac5d6a604
Parents: 37d59f2
Author: Swapan Shridhar 
Authored: Wed Oct 18 13:05:40 2017 -0700
Committer: Swapan Shridhar 
Committed: Wed Oct 18 13:05:40 2017 -0700

--
 .../resources/common-services/YARN/3.0.0.3.0/service_advisor.py | 3 ++-
 .../src/main/resources/stacks/HDP/2.5/services/stack_advisor.py | 3 ++-
 .../src/test/python/stacks/2.5/common/test_stack_advisor.py | 5 -
 3 files changed, 8 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/3b5cbed0/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/service_advisor.py
--
diff --git 
a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/service_advisor.py
 
b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/service_advisor.py
index ecf245d..70eb5be 100644
--- 
a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/service_advisor.py
+++ 
b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/service_advisor.py
@@ -580,6 +580,7 @@ class YARNRecommender(service_advisor.ServiceAdvisor):
 putHiveInteractiveEnvProperty = self.putProperty(configurations, 
"hive-interactive-env", services)
 putHiveInteractiveEnvPropertyAttribute = 
self.putPropertyAttribute(configurations, "hive-interactive-env")
 putTezInteractiveSiteProperty = self.putProperty(configurations, 
"tez-interactive-site", services)
+putTezInteractiveSitePropertyAttribute = 
self.putPropertyAttribute(configurations, "tez-interactive-site")
 llap_daemon_selected_queue_name = None
 selected_queue_is_ambari_managed_llap = None  # Queue named 'llap' at root 
level is Ambari managed.
 llap_selected_queue_am_percent = None
@@ -1047,7 +1048,7 @@ class YARNRecommender(service_advisor.ServiceAdvisor):
 putTezInteractiveSiteProperty('tez.runtime.io.sort.mb', 
tez_runtime_io_sort_mb)
 if "tez-site" in services["configurations"] and "tez.runtime.sorter.class" 
in services["configurations"]["tez-site"]["properties"]:
   if 
services["configurations"]["tez-site"]["properties"]["tez.runtime.sorter.class"]
 == "LEGACY":
-putTezInteractiveSiteProperty("tez.runtime.io.sort.mb", "maximum", 
1800)
+putTezInteractiveSitePropertyAttribute("tez.runtime.io.sort.mb", 
"maximum", 1800)
 
 
putTezInteractiveSiteProperty('tez.runtime.unordered.output.buffer.size-mb', 
tez_runtime_unordered_output_buffer_size)
 
putHiveInteractiveSiteProperty('hive.auto.convert.join.noconditionaltask.size', 
hive_auto_convert_join_noconditionaltask_size)

http://git-wip-us.apache.org/repos/asf/ambari/blob/3b5cbed0/ambari-server/src/main/resources/stacks/HDP/2.5/services/stack_advisor.py
--
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.5/services/stack_advisor.py 
b/ambari-server/src/main/resources/stacks/HDP/2.5/services/stack_advisor.py
index 92ce9b9..b6f2478 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.5/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/services/stack_advisor.py
@@ -860,6 +860,7 @@ class HDP25StackAdvisor(HDP24StackAdvisor):
 putHiveInteractiveEnvProperty = self.putProperty(configurations, 
"hive-interactive-env", services)
 putHiveInteractiveEnvPropertyAttribute = 
self.putPropertyAttribute(configurations, "hive-interactive-env")
 putTezInteractiveSiteProperty = self.putProperty(configurations, 
"tez-interactive-site", services)
+putTezInteractiveSitePropertyAttribute = 
self.putPropertyAttribute(configurations, "tez-interactive-site")
 llap_daemon_selected_queue_name = None
 selected_queue_is_ambari_managed_llap = None  # Queue named 'llap' at root 
level is Ambari managed.
 llap_selected_queue_am_percent = None
@@ -1331,7 +1332,7 @@ class HDP25StackAdvisor(HDP24StackAdvisor):
 putTezInteractiveSiteProperty('tez.runtime.io.sort.mb', 
tez_runtime_io_sort_mb)
 if "tez-site" in services["configurations"] and "tez.runtime.sorter.class" 
in services["configurations"]["tez-site"]["properties"]:
   if 
services["configurations"]["tez-site"]["properties"]["tez.runtime.sorter.class"]
 == "LEGACY":
-putTezInteractiveSiteProperty("tez.runtime.io.sort.mb", "maximum", 
1800)
+putTezInteractiveSitePropertyAttribute("tez.runtime.io.sor

[23/46] ambari git commit: AMBARI-21307 AddedLDAP configuration provider for loading and maintaining the LDAP configuration in the application

2017-10-19 Thread lpuskas
AMBARI-21307 AddedLDAP configuration provider for loading and maintaining the 
LDAP configuration in the application


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 38c2785a4205012e284c91172c2466068a2e8da7
Parents: 3c0b27b
Author: lpuskas 
Authored: Tue Aug 29 14:55:09 2017 +0200
Committer: lpuskas 
Committed: Thu Oct 19 14:41:58 2017 +0200

--
 .../services/ldap/LdapConfigurationService.java |   1 +
 .../AmbariConfigurationResourceProvider.java|  35 +-
 .../ambari/server/events/AmbariEvent.java   |  11 +-
 .../events/AmbariLdapConfigChangedEvent.java|  37 ++
 .../server/ldap/LdapConfigurationFactory.java   |   2 +-
 .../apache/ambari/server/ldap/LdapModule.java   |   3 +
 .../AmbariLdapConfigurationProvider.java| 114 +++
 .../server/ldap/service/AmbariLdapFacade.java   |   7 +-
 .../server/orm/dao/AmbariConfigurationDAO.java  |  48 
 .../orm/entities/AmbariConfigurationEntity.java |   4 +-
 .../DefaultLdapConfigurationServiceTest.java|  10 +-
 11 files changed, 260 insertions(+), 12 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/38c2785a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
index fc6bd41..1b8427b 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
@@ -82,6 +82,7 @@ public class LdapConfigurationService extends 
AmbariConfigurationService {
   @Produces(MediaType.APPLICATION_JSON)
   public Response validateConfiguration(LdapConfigurationRequest 
ldapConfigurationRequest) {
 
+// check if the user is authorized to perform the operation
 authorize();
 
 Set groups = Sets.newHashSet();

http://git-wip-us.apache.org/repos/asf/ambari/blob/38c2785a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariConfigurationResourceProvider.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariConfigurationResourceProvider.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariConfigurationResourceProvider.java
index 2302d8b..4f4cc70 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariConfigurationResourceProvider.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AmbariConfigurationResourceProvider.java
@@ -35,6 +35,9 @@ import 
org.apache.ambari.server.controller.spi.ResourceAlreadyExistsException;
 import org.apache.ambari.server.controller.spi.SystemException;
 import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
 import org.apache.ambari.server.controller.utilities.PredicateHelper;
+import org.apache.ambari.server.events.AmbariEvent;
+import org.apache.ambari.server.events.AmbariLdapConfigChangedEvent;
+import org.apache.ambari.server.events.publishers.AmbariEventPublisher;
 import org.apache.ambari.server.orm.dao.AmbariConfigurationDAO;
 import org.apache.ambari.server.orm.entities.AmbariConfigurationEntity;
 import org.apache.ambari.server.orm.entities.ConfigurationBaseEntity;
@@ -113,6 +116,10 @@ public class AmbariConfigurationResourceProvider extends 
AbstractAuthorizedResou
   @Inject
   private AmbariConfigurationDAO ambariConfigurationDAO;
 
+  @Inject
+  private AmbariEventPublisher publisher;
+
+
   private Gson gson;
 
   @AssistedInject
@@ -142,7 +149,18 @@ public class AmbariConfigurationResourceProvider extends 
AbstractAuthorizedResou
 }
 
 LOGGER.info("Persisting new ambari configuration: {} ", 
ambariConfigurationEntity);
-ambariConfigurationDAO.create(ambariConfigurationEntity);
+
+try {
+  ambariConfigurationDAO.create(ambariConfigurationEntity);
+} catch (Exception e) {
+  LOGGER.error("Failed to create resource", e);
+  throw new ResourceAlreadyExistsException(e.getMessage());
+}
+
+// todo filter by configuration type
+// notify subscribers about the configuration changes
+publisher.publish(new 
AmbariLdapConfigChangedEvent(AmbariEvent.AmbariEventType

[26/46] ambari git commit: AMBARI-21307 refactoring - renamed, moved classes, variables

2017-10-19 Thread lpuskas
AMBARI-21307 refactoring - renamed, moved classes, variables


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 3c0b27b3c1783a5b78b241472429d6caf54bffc2
Parents: 2e8d7b1
Author: lpuskas 
Authored: Tue Aug 22 10:03:24 2017 +0200
Committer: lpuskas 
Committed: Thu Oct 19 14:41:58 2017 +0200

--
 .../api/services/ldap/AmbariConfiguration.java  |  87 +++
 .../services/ldap/AmbariConfigurationDTO.java   |  67 -
 .../ldap/LdapCheckConfigurationRequest.java |  47 
 .../api/services/ldap/LdapConfigOperation.java  |  43 
 .../services/ldap/LdapConfigurationRequest.java |  49 
 .../services/ldap/LdapConfigurationService.java |  53 +---
 .../api/services/ldap/LdapOperationRequest.java |  18 --
 .../server/ldap/LdapConfigurationService.java   |  60 +
 .../ldap/LdapConfigurationValidatorService.java |  60 -
 .../apache/ambari/server/ldap/LdapModule.java   |   4 +-
 .../server/ldap/service/AmbariLdapFacade.java   |  10 +-
 .../ads/DefaultLdapConfigurationService.java| 243 +++
 ...efaultLdapConfigurationValidatorService.java | 243 ---
 .../api/services/ldap/LDAPServiceTest.java  |   6 +-
 .../DefaultLdapConfigurationServiceTest.java| 113 +
 ...ltLdapConfigurationValidatorServiceTest.java | 113 -
 16 files changed, 618 insertions(+), 598 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/3c0b27b3/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/AmbariConfiguration.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/AmbariConfiguration.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/AmbariConfiguration.java
new file mode 100644
index 000..b5cc921
--- /dev/null
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/AmbariConfiguration.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed 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.api.services.ldap;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Domain POJO representing generic ambari configuration data.
+ */
+public class AmbariConfiguration {
+
+  /**
+   * The type of the configuration,  eg.: ldap-configuration
+   */
+  private String type;
+
+  /**
+   * Version tag
+   */
+  private String versionTag;
+
+  /**
+   * Version number
+   */
+  private Integer version;
+
+  /**
+   * Created timestamp
+   */
+  private long createdTs;
+
+  private Set> data = Collections.emptySet();
+
+  public String getType() {
+return type;
+  }
+
+  public void setType(String type) {
+this.type = type;
+  }
+
+  public Set> getData() {
+return data;
+  }
+
+  public void setData(Set> data) {
+this.data = data;
+  }
+
+  public String getVersionTag() {
+return versionTag;
+  }
+
+  public void setVersionTag(String versionTag) {
+this.versionTag = versionTag;
+  }
+
+  public Integer getVersion() {
+return version;
+  }
+
+  public void setVersion(Integer version) {
+this.version = version;
+  }
+
+  public long getCreatedTs() {
+return createdTs;
+  }
+
+  public void setCreatedTs(long createdTs) {
+this.createdTs = createdTs;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/3c0b27b3/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/AmbariConfigurationDTO.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/AmbariConfigurationDTO.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/AmbariConfigurationDTO.java
deleted file mode 100644
index 1b134fe..000
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/AmbariConfigurationDTO.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use 

[30/46] ambari git commit: AMBARI-2130 ldap connections handled in thefacade. Code cleanup

2017-10-19 Thread lpuskas
AMBARI-2130 ldap connections handled in thefacade. Code cleanup


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 01295fe17d9b2f4017e113ec1014065cc7cff545
Parents: 92f2cc5
Author: lpuskas 
Authored: Tue Sep 12 15:38:25 2017 +0200
Committer: lpuskas 
Committed: Thu Oct 19 14:42:00 2017 +0200

--
 .../server/ldap/service/AmbariLdapFacade.java   | 51 +
 .../ldap/service/LdapConnectionService.java | 12 ++-
 .../ambari/server/ldap/service/LdapFacade.java  |  2 +-
 .../ads/DefaultLdapConfigurationService.java| 77 
 .../ads/DefaultLdapConnectionService.java   | 41 ++-
 .../OccurranceAndWeightBasedDetector.java   |  2 +-
 6 files changed, 103 insertions(+), 82 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/01295fe1/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
index f159418..d2bdef3 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
@@ -19,7 +19,6 @@ import java.util.Map;
 import java.util.Set;
 
 import javax.inject.Inject;
-import javax.inject.Provider;
 import javax.inject.Singleton;
 
 import org.apache.ambari.server.ldap.AmbariLdapConfiguration;
@@ -58,35 +57,59 @@ public class AmbariLdapFacade implements LdapFacade {
   @Inject
   private LdapAttributeDetectionService ldapAttributeDetectionService;
 
-  //todo remove this, added for testing purposes only
-  @Inject
-  private Provider ambariLdapConfigurationProvider;
-
   @Inject
   public AmbariLdapFacade() {
   }
 
   @Override
   public void checkConnection(AmbariLdapConfiguration ambariLdapConfiguration) 
throws AmbariLdapException {
+LdapConnection connection = null;
 try {
+
   LOGGER.info("Validating LDAP connection related configuration based on: 
{}", ambariLdapConfiguration);
-  LdapConnection connection = 
ldapConnectionService.createLdapConnection(ambariLdapConfiguration);
+  connection = 
ldapConnectionService.getBoundLdapConnection(ambariLdapConfiguration);
   ldapConfigurationService.checkConnection(connection, 
ambariLdapConfiguration);
-} catch (AmbariLdapException e) {
+  LOGGER.info("Validating LDAP connection related configuration: SUCCESS");
+
+} catch (Exception e) {
+
   LOGGER.error("Validating LDAP connection configuration failed", e);
-  throw e;
+  throw new AmbariLdapException(e);
+
+} finally {
+  try {
+connection.unBind();
+connection.close();
+  } catch (Exception e) {
+throw new AmbariLdapException(e);
+  }
 }
-LOGGER.info("Validating LDAP connection related configuration: SUCCESS");
+
   }
 
 
   @Override
-  public AmbariLdapConfiguration detectAttributes(AmbariLdapConfiguration 
ambariLdapConfiguration) {
+  public AmbariLdapConfiguration detectAttributes(AmbariLdapConfiguration 
ambariLdapConfiguration) throws AmbariLdapException {
 LOGGER.info("Detecting LDAP configuration attributes ...");
 
-LdapConnection connection = 
ldapConnectionService.createLdapConnection(ambariLdapConfiguration);
-ambariLdapConfiguration = 
ldapAttributeDetectionService.detectLdapUserAttributes(connection, 
ambariLdapConfiguration);
-return ambariLdapConfiguration;
+LdapConnection connection = 
ldapConnectionService.getBoundLdapConnection(ambariLdapConfiguration);
+try {
+
+  ambariLdapConfiguration = 
ldapAttributeDetectionService.detectLdapUserAttributes(connection, 
ambariLdapConfiguration);
+  ambariLdapConfiguration = 
ldapAttributeDetectionService.detectLdapGroupAttributes(connection, 
ambariLdapConfiguration);
+  return ambariLdapConfiguration;
+
+} catch (Exception e) {
+  LOGGER.error("Error during LDAP attribute detection", e);
+  throw new AmbariLdapException(e);
+} finally {
+  try {
+connection.unBind();
+connection.close();
+  } catch (Exception e) {
+throw new AmbariLdapException(e);
+  }
+}
   }
 
   @Override
@@ -98,7 +121,7 @@ public class AmbariLdapFacade implements LdapFacade {
   throw new IllegalArgumentException("No test user available for testin

[28/46] ambari git commit: AMBARI-21307 Added the supported ldap properties to the code. Refactored existing code relying on these properties

2017-10-19 Thread lpuskas
AMBARI-21307 Added the supported ldap properties to the code. Refactored 
existing code relying on these properties


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 4afe98147ba4be03e1280a35530bd5e35d048d14
Parents: d4b9215
Author: lpuskas 
Authored: Fri Sep 8 13:57:25 2017 +0300
Committer: lpuskas 
Committed: Thu Oct 19 14:41:59 2017 +0200

--
 .../server/ldap/AmbariLdapConfiguration.java| 189 ---
 .../AmbariLdapConfigurationProvider.java|   6 +-
 .../server/ldap/service/AmbariLdapFacade.java   |  10 +-
 .../service/LdapAttributeDetectionService.java  |  43 +
 .../ambari/server/ldap/service/LdapFacade.java  |   2 +-
 .../ads/DefaultAttributeDetectionService.java   |  47 +
 .../ads/DefaultLdapConfigurationService.java|   4 +-
 .../ads/DefaultLdapConnectionService.java   |   4 +-
 .../DefaultAttributeDetectionServiceTest.java   | 102 ++
 .../DefaultLdapConfigurationServiceTest.java|  30 ++-
 10 files changed, 348 insertions(+), 89 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/4afe9814/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
index e913e77..76faeed 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
@@ -34,63 +34,67 @@ public class AmbariLdapConfiguration {
   /**
* Constants representing supported LDAP related property names
*/
-  public enum LdapConfigProperty {
-LDAP_CONFIGURED("ambari.ldap.configured"),
-AUTOMATIC_ATTRIBUTE_DETECTION("ambari.ldap.automatic.attribute.detection"),
-USE_SSL("ambari.ldap.usessl"),
-LDAP_SERVER_HOST("ambari.ldap.server.host"),
-LDAP_SERVER_PORT("ambari.ldap.server.port"),
-LDAP_TRUSTSTORE("ambari.ldap.truststore"),
-LDAP_TRUSTSTORE_TYPE("ambari.ldap.truststore.type"),
-LDAP_TRUSTSTORE_PATH("ambari.ldap.truststore.path"),
-LDAP_TRUSTSTORE_PASSWORD("ambari.ldap.truststore.password"),
-BASE_DN("ambari.ldap.bind.dn"),
-REFERRAL("ambari.ldap.referral"),
-PAGINATION_ENABLED("ambari.ldap.pagination.enabled"),
-
-BIND_ANONIMOUSLY("ambari.ldap.bindanonymously"),
-MANAGER_DN("ambari.ldap.managerdn"),
-MANAGER_PASSWORD("ambari.ldap.managerpassword"),
-USER_OBJECT_CLASS("ambari.ldap.user.object.class"),
-USER_NAME_ATTRIBUTE("ambari.ldap.user.name.attribute"),
-USER_NAME_FORCE_LOWERCASE("ambari.ldap.username.force.lowercase"),
-USER_SEARCH_BASE("ambari.ldap.user.search.base"),
-
SYNC_USER_MEMBER_REPLACE_PATTERN("ambari.ldap.sync.user.member.replacepattern"),
-SYNC_USER_MEMBER_FILTER("ambari.ldap.sync.user.member_filter"),
-
-ADMIN_GROUP_MAPPING_RULES ("ambari.ldap.admin.group.mappingrules"),
-GROUP_OBJECT_CLASS("ambari.ldap.group.object.class"),
-GROUP_NAME_ATTRIBUTE("ambari.ldap.group.name.attribute"),
-GROUP_MEMBER_ATTRIBUTE("ambari.ldap.group.member.attribute"),
-GROUP_SEARCH_BASE("ambari.ldap.group.search.base"),
-
SYNC_GROUP_MEMBER_REPLACE_PATTERN("ambari.ldap.sync.group.member.replacepattern"),
-SYNC_GROUP_MEMBER_FILTER("ambari.ldap.sync.group.member_filter"),
-DN_ATTRIBUTE("authentication.ldap.dnAttribute"),
-
-TEST_USER_NAME("ambari.ldap.test.user.name"),
-TEST_USER_PASSWORD("ambari.ldap.test.user.password");
+  public enum AmbariLdapConfig {
+
+LDAP_ENABLED("ambari.ldap.authentication.enabled"),
+SERVER_HOST("ambari.ldap.connectivity.server.host"),
+SERVER_PORT("ambari.ldap.connectivity.server.port"),
+USE_SSL("ambari.ldap.connectivity.use_ssl"),
+
+TRUST_STORE("ambari.ldap.connectivity.trust_store"),
+TRUST_STORE_TYPE("ambari.ldap.connectivity.trust_store.type"),
+TRUST_STORE_PATH("ambari.ldap.connectivity.trust_store.path"),
+TRUST_STORE_PASSWORD("ambari.ldap.connectivity.trust_store.password"),
+ANONYMOU

[34/46] ambari git commit: AMBARI-21307 Ldapconnection template optimization, basic support for custom trust store

2017-10-19 Thread lpuskas
AMBARI-21307 Ldapconnection template optimization, basic support for custom 
trust store


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 71292fb1c7ed2fe3e1368ec22ab5b1dbf952d724
Parents: 1939f09
Author: lpuskas 
Authored: Mon Oct 9 17:20:38 2017 +0200
Committer: lpuskas 
Committed: Thu Oct 19 14:42:01 2017 +0200

--
 .../apache/ambari/server/ldap/LdapModule.java   |   8 +-
 .../service/LdapAttributeDetectionService.java  |   4 +-
 .../service/LdapConnectionConfigService.java|  34 ++
 .../service/LdapConnectionTemplateProvider.java |  56 -
 .../DefaultLdapAttributeDetectionService.java   |   4 +-
 .../ads/DefaultLdapConfigurationService.java|  11 +-
 .../ads/LdapConnectionTemplateFactory.java  |  56 +
 .../DefaultLdapConnectionConfigService.java | 116 +++
 .../server/ldap/LdapModuleFunctionalTest.java   |  28 +
 9 files changed, 224 insertions(+), 93 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/71292fb1/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapModule.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapModule.java 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapModule.java
index d59264a..4abf4e7 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapModule.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapModule.java
@@ -21,11 +21,11 @@ import 
org.apache.ambari.server.ldap.service.AmbariLdapConfigurationProvider;
 import org.apache.ambari.server.ldap.service.AmbariLdapFacade;
 import org.apache.ambari.server.ldap.service.LdapAttributeDetectionService;
 import org.apache.ambari.server.ldap.service.LdapConfigurationService;
-import org.apache.ambari.server.ldap.service.LdapConnectionTemplateProvider;
+import org.apache.ambari.server.ldap.service.LdapConnectionConfigService;
 import org.apache.ambari.server.ldap.service.LdapFacade;
 import 
org.apache.ambari.server.ldap.service.ads.DefaultLdapAttributeDetectionService;
 import 
org.apache.ambari.server.ldap.service.ads.DefaultLdapConfigurationService;
-import org.apache.directory.ldap.client.template.LdapConnectionTemplate;
+import 
org.apache.ambari.server.ldap.service.ads.detectors.DefaultLdapConnectionConfigService;
 
 import com.google.inject.AbstractModule;
 import com.google.inject.assistedinject.FactoryModuleBuilder;
@@ -40,13 +40,11 @@ public class LdapModule extends AbstractModule {
 bind(LdapFacade.class).to(AmbariLdapFacade.class);
 
bind(LdapConfigurationService.class).to(DefaultLdapConfigurationService.class);
 
bind(LdapAttributeDetectionService.class).to(DefaultLdapAttributeDetectionService.class);
+
bind(LdapConnectionConfigService.class).to(DefaultLdapConnectionConfigService.class);
 
 // this binding requires the JPA module!
 
bind(AmbariLdapConfiguration.class).toProvider(AmbariLdapConfigurationProvider.class);
 
-// bind to the provider implementation (let GUICE deal with instantiating 
3rd party instances)
-
bind(LdapConnectionTemplate.class).toProvider(LdapConnectionTemplateProvider.class);
-
 install(new 
FactoryModuleBuilder().build(AmbariLdapConfigurationFactory.class));
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/71292fb1/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/LdapAttributeDetectionService.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/LdapAttributeDetectionService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/LdapAttributeDetectionService.java
index 6cd369b..c08a2e0 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/LdapAttributeDetectionService.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/LdapAttributeDetectionService.java
@@ -27,7 +27,7 @@ public interface LdapAttributeDetectionService {
* @param ambariLdapConfiguration configuration instance holding connection 
details
* @return the configuration decorated with user related attributes
*/
-  AmbariLdapConfiguration detectLdapUserAttributes(AmbariLdapConfiguration 
ambariLdapConfiguration);
+  AmbariLdapConfiguration detectLdapUserAttributes(AmbariLdapConfiguration 
ambariLdapConfiguration) throws AmbariLdapException;
 
   /**
* Decorates the passed in configuration with the detected ldap group 
attribute values
@@ -35,6 +35,6 @@ public

[35/46] ambari git commit: AMBARI-21307 Extracted config keys into an enum. Organized code (created domain package, moved classes)

2017-10-19 Thread lpuskas
AMBARI-21307 Extracted config keys into an enum. Organized code (created domain 
package, moved classes)


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 6fc9fadeaa7ef88e96ff015d167589c83ed536d1
Parents: 25d6edf
Author: lpuskas 
Authored: Thu Sep 14 16:33:41 2017 +0200
Committer: lpuskas 
Committed: Thu Oct 19 14:42:01 2017 +0200

--
 .../services/ldap/LdapConfigurationService.java |   4 +-
 .../server/ldap/AmbariLdapConfiguration.java| 232 ---
 .../server/ldap/LdapConfigurationFactory.java   |  34 ---
 .../apache/ambari/server/ldap/LdapModule.java   |   2 +
 .../ldap/domain/AmbariLdapConfiguration.java| 180 ++
 .../ldap/domain/LdapConfigurationFactory.java   |  34 +++
 .../ldap/service/AmbariLdapConfigKeys.java  |  72 ++
 .../AmbariLdapConfigurationProvider.java|   4 +-
 .../server/ldap/service/AmbariLdapFacade.java   |   2 +-
 .../service/LdapAttributeDetectionService.java  |   2 +-
 .../ldap/service/LdapConfigurationService.java  |   2 +-
 .../ldap/service/LdapConnectionService.java |   2 +-
 .../ambari/server/ldap/service/LdapFacade.java  |   2 +-
 .../DefaultLdapAttributeDetectionService.java   |  15 +-
 .../ads/DefaultLdapConfigurationService.java|   2 +-
 .../ads/DefaultLdapConnectionService.java   |  16 +-
 ...efaultLdapAttributeDetectionServiceTest.java |  21 +-
 .../DefaultLdapConfigurationServiceTest.java|  31 +--
 18 files changed, 334 insertions(+), 323 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/6fc9fade/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
index ae47a87..ff95066 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
@@ -46,8 +46,8 @@ import org.apache.ambari.server.api.services.ResultImpl;
 import org.apache.ambari.server.api.services.ResultStatus;
 import org.apache.ambari.server.controller.internal.ResourceImpl;
 import org.apache.ambari.server.controller.spi.Resource;
-import org.apache.ambari.server.ldap.AmbariLdapConfiguration;
-import org.apache.ambari.server.ldap.LdapConfigurationFactory;
+import org.apache.ambari.server.ldap.domain.AmbariLdapConfiguration;
+import org.apache.ambari.server.ldap.domain.LdapConfigurationFactory;
 import org.apache.ambari.server.ldap.service.LdapFacade;
 import org.apache.ambari.server.security.authorization.AuthorizationException;
 import org.apache.ambari.server.security.authorization.AuthorizationHelper;

http://git-wip-us.apache.org/repos/asf/ambari/blob/6fc9fade/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
deleted file mode 100644
index 5bdda7a..000
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * Licensed 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.ldap;
-
-import java.util.Map;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.inject.assistedinject.Assisted;
-
-/**
- * This class is an immutable representation of all the LDAP related 
configurationMap entries.
- */
-@Singleton
-public class AmbariLdapConfiguration {
-
-  private static final Logger LOGGER = 
LoggerFactory.getLogger(AmbariLda

[39/46] ambari git commit: AMBARI-21307 Added unit test for the LdapFacade

2017-10-19 Thread lpuskas
AMBARI-21307 Added unit test for the LdapFacade


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 32c292c7a9708dd74407d3a677059964144ece61
Parents: e1fe7b6
Author: lpuskas 
Authored: Thu Oct 12 16:53:31 2017 +0200
Committer: lpuskas 
Committed: Thu Oct 19 14:42:02 2017 +0200

--
 .../services/AmbariConfigurationService.java|   2 +-
 .../ldap/domain/AmbariLdapConfiguration.java|  22 ++
 .../server/ldap/service/AmbariLdapFacade.java   |  10 +-
 .../ldap/service/AmbariLdapFacadeTest.java  | 215 +++
 4 files changed, 245 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/32c292c7/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java
index 492509f..38ae766 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationService.java
@@ -150,7 +150,7 @@ public class AmbariConfigurationService extends BaseService 
{
   @PUT
   @Path("{configurationId}")
   @Produces(MediaType.TEXT_PLAIN)
-  @ApiOperation(value = "Updates ambari configuration resources - Not 
implemented yet",
+  @ApiOperation(value = "Updates ambari configuration resources ",
 nickname = "AmbariConfigurationService#updateAmbariConfiguration")
   @ApiImplicitParams({
 @ApiImplicitParam(dataType = AMBARI_CONFIGURATION_REQUEST_TYPE, paramType 
= PARAM_TYPE_BODY),

http://git-wip-us.apache.org/repos/asf/ambari/blob/32c292c7/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfiguration.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfiguration.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfiguration.java
index d071ebe..8b26cd3 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfiguration.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfiguration.java
@@ -19,6 +19,8 @@ import java.util.Map;
 
 import javax.inject.Inject;
 
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -174,4 +176,24 @@ public class AmbariLdapConfiguration {
   public String toString() {
 return configurationMap.toString();
   }
+
+  @Override
+  public boolean equals(Object o) {
+if (this == o) return true;
+
+if (o == null || getClass() != o.getClass()) return false;
+
+AmbariLdapConfiguration that = (AmbariLdapConfiguration) o;
+
+return new EqualsBuilder()
+  .append(configurationMap, that.configurationMap)
+  .isEquals();
+  }
+
+  @Override
+  public int hashCode() {
+return new HashCodeBuilder(17, 37)
+  .append(configurationMap)
+  .toHashCode();
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/32c292c7/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
index c75b0c4..bbfbc8e 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
@@ -33,7 +33,7 @@ public class AmbariLdapFacade implements LdapFacade {
   /**
* Additional parameters expected to be provided along with the configuration
*/
-  private enum Parameters {
+  protected enum Parameters {
 TEST_USER_NAME("ambari.ldap.test.user.name"),
 TEST_USER_PASSWORD("ambari.ldap.test.user.password");
 
@@ -43,7 +43,7 @@ public class AmbariLdapFacade implements LdapFacade {
   this.parameterKey = parameterKey;
 }
 
-private String getParameterKey() {
+public String getParameterKey() {
   return parameterKey;
 }
 
@@ -62,6 

[15/46] ambari git commit: Added swagger annotations to the new endpoint

2017-10-19 Thread lpuskas
Added swagger annotations to the new endpoint


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: afc57b7481bef15ab8d1d04d5814a2760d024795
Parents: f55185c
Author: Balázs Bence Sári 
Authored: Thu Jul 6 18:36:18 2017 +0200
Committer: lpuskas 
Committed: Thu Oct 19 14:41:56 2017 +0200

--
 .../AmbariConfigurationRequestSwagger.java  | 48 +++
 .../AmbariConfigurationResponseSwagger.java | 40 +
 .../services/AmbariConfigurationService.java| 62 +---
 3 files changed, 143 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/afc57b74/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationRequestSwagger.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationRequestSwagger.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationRequestSwagger.java
new file mode 100644
index 000..d6714f9
--- /dev/null
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationRequestSwagger.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed 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.api.services;
+
+import java.util.Map;
+
+import org.apache.ambari.server.controller.ApiModel;
+import org.apache.ambari.server.orm.entities.ConfigurationBaseEntity;
+
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * Request data model for {@link 
org.apache.ambari.server.api.services.AmbariConfigurationService}
+ */
+public interface AmbariConfigurationRequestSwagger extends ApiModel {
+
+  @ApiModelProperty(name = "AmbariConfiguration")
+  AmbariConfigurationRequestInfo getAmbariConfiguration();
+
+  interface AmbariConfigurationRequestInfo {
+@ApiModelProperty
+Long getId();
+
+@ApiModelProperty
+Map getData();
+
+@ApiModelProperty
+String getType();
+
+@ApiModelProperty
+Long getVersion();
+
+@ApiModelProperty(name = "version_tag")
+String getVersionTag();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/afc57b74/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationResponseSwagger.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationResponseSwagger.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationResponseSwagger.java
new file mode 100644
index 000..c55ac1d
--- /dev/null
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariConfigurationResponseSwagger.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed 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.api.services;
+
+import java.util.Map;
+
+import org.apache.ambari.server.controller.ApiModel;
+
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * Response data model for {@link 
org.apache.ambari.server.api.services.AmbariConfigurationService}
+ */
+public interface AmbariConfigurationResponseSwagger extends ApiModel {
+
+  @ApiModelProperty(name = "AmbariConfiguration")
+  AmbariConfigurationResponseInfo getAmbariConfigurationResponse();
+
+  interface AmbariConfigurationResponseInfo {
+@ApiModelProperty
+Long getId();
+
+@ApiModelProperty
+Map getData();
+
+@ApiMode

[25/46] ambari git commit: AMBARI-21307 LDAP config rest service implementation extends the ambari config rest implementaiton

2017-10-19 Thread lpuskas
AMBARI-21307 LDAP config rest  service implementation extends the ambari config 
rest implementaiton


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 2e8d7b14875caf8d3d0c2a64a713b2be9226fb8e
Parents: 6c3dcc7
Author: lpuskas 
Authored: Mon Aug 21 15:53:45 2017 +0200
Committer: lpuskas 
Committed: Thu Oct 19 14:41:58 2017 +0200

--
 .../services/ldap/LdapConfigurationService.java | 208 +++
 .../api/services/ldap/LdapRestService.java  | 149 -
 2 files changed, 208 insertions(+), 149 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/2e8d7b14/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
new file mode 100644
index 000..52244bc
--- /dev/null
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
@@ -0,0 +1,208 @@
+/*
+ * Licensed 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.
+ */
+
+/*
+ * Licensed 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.api.services.ldap;
+
+import java.util.Set;
+
+import javax.inject.Inject;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.apache.ambari.annotations.ApiIgnore;
+import org.apache.ambari.server.StaticallyInject;
+import org.apache.ambari.server.api.services.AmbariConfigurationService;
+import org.apache.ambari.server.api.services.Result;
+import org.apache.ambari.server.api.services.ResultImpl;
+import org.apache.ambari.server.api.services.ResultStatus;
+import org.apache.ambari.server.controller.internal.ResourceImpl;
+import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.ambari.server.ldap.AmbariLdapConfiguration;
+import org.apache.ambari.server.ldap.LdapConfigurationFactory;
+import org.apache.ambari.server.ldap.service.LdapFacade;
+import org.apache.ambari.server.security.authorization.AuthorizationException;
+import org.apache.ambari.server.security.authorization.AuthorizationHelper;
+import org.apache.ambari.server.security.authorization.ResourceType;
+import org.apache.ambari.server.security.authorization.RoleAuthorization;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.security.core.Authentication;
+
+import com.google.common.collect.Sets;
+
+/**
+ * Endpoint designated to LDAP specific operations.
+ */
+@StaticallyInject
+@Path("/ldapconfigs/")
+public class LdapConfigurationService extends AmbariConfigurationService {
+
+  private static final Logger LOGGER = 
LoggerFactory.getLogger(LdapConfigurationService.class);
+
+  @Inject
+  private static LdapFacade ldapFacade;
+
+  @Inject
+  private static LdapConfigurationFactory ldapConfigurationFactory;
+
+  /**
+   * Actions supported by this endpoint
+   */
+  private enum LdapAction {
+TEST_CONNECTION("test-connection"),
+TEST_ATTRIBUTES("test-attributes"),
+DETECT_ATTRIBUTES("detect-attributes");
+
+private String actionStr;
+
+LdapAction(String actionStr) {
+  this.actionStr = actionStr;
+}
+
+public static LdapA

[21/46] ambari git commit: AMBARI-21307 Draft implementation of the group related attributes

2017-10-19 Thread lpuskas
AMBARI-21307 Draft implementation of the group related attributes


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: a65608b80166dad543744fea922a62cc571c2a9f
Parents: 5f2fbc1
Author: lpuskas 
Authored: Tue Aug 8 13:54:29 2017 +0200
Committer: lpuskas 
Committed: Thu Oct 19 14:41:57 2017 +0200

--
 .../server/ldap/AmbariLdapConfiguration.java|  22 +-
 .../ldap/LdapConfigurationValidatorService.java |  34 +--
 .../apache/ambari/server/ldap/LdapModule.java   |   4 +-
 .../server/ldap/service/AmbariLdapFacade.java   |  25 +-
 .../ldap/service/LdapConnectionService.java |  35 +++
 .../ambari/server/ldap/service/LdapFacade.java  |   9 +-
 .../ad/AdLdapConfigurationValidatorService.java | 177 --
 ...efaultLdapConfigurationValidatorService.java | 232 +++
 .../ad/DefaultLdapConnectionService.java|  63 +
 .../service/ad/LdapConfigurationConverter.java  |  50 
 ...AdLdapConfigurationValidatorServiceTest.java | 129 ---
 ...ltLdapConfigurationValidatorServiceTest.java | 156 +
 12 files changed, 552 insertions(+), 384 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/a65608b8/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
index 519f400..a6ff80b 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
@@ -53,7 +53,7 @@ public class AmbariLdapConfiguration {
 GROUP_OBJECT_CLASS("ambari.ldap.group.object.class"),
 GROUP_NAME_ATTRIBUTE("ambari.ldap.group.name.attribute"),
 GROUP_MEMBER_ATTRIBUTE("ambari.ldap.group.member.attribute"),
-GROUP_SEARCH_BASE("ambari.ldap.group.member.attribute"),
+GROUP_SEARCH_BASE("ambari.ldap.group.search.base"),
 DN_ATTRIBUTE("authentication.ldap.dnAttribute");
 
 private String propertyName;
@@ -126,4 +126,24 @@ public class AmbariLdapConfiguration {
 return (String) configurationValue(LdapConfigProperty.USER_NAME_ATTRIBUTE);
   }
 
+  public String userSearchBase() {
+return (String) configurationValue(LdapConfigProperty.USER_SEARCH_BASE);
+  }
+
+  public String groupObjectClass() {
+return (String) configurationValue(LdapConfigProperty.GROUP_OBJECT_CLASS);
+  }
+
+  public String groupNameAttribute() {
+return (String) 
configurationValue(LdapConfigProperty.GROUP_NAME_ATTRIBUTE);
+  }
+
+  public String groupMemberAttribute() {
+return (String) 
configurationValue(LdapConfigProperty.GROUP_MEMBER_ATTRIBUTE);
+  }
+
+  public String groupSearchBase() {
+return (String) configurationValue(LdapConfigProperty.GROUP_SEARCH_BASE);
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/a65608b8/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapConfigurationValidatorService.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapConfigurationValidatorService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapConfigurationValidatorService.java
index 4667721..7efa3b7 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapConfigurationValidatorService.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapConfigurationValidatorService.java
@@ -14,8 +14,11 @@
 
 package org.apache.ambari.server.ldap;
 
+import java.util.Set;
+
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.ldap.service.AmbariLdapException;
+import org.apache.directory.ldap.client.api.LdapConnection;
 
 /**
  * Collection of operations for validating ldap configuration.
@@ -26,27 +29,32 @@ public interface LdapConfigurationValidatorService {
   /**
* Tests the connection based on the provided configuration.
*
-   * @param configuration the ambari ldap configuration instance
+   * @param ldapConnection connection instance
+   * @param configuration  the ambari ldap configuration instance
* @throws AmbariLdapException if the connection is not possible
*/
-  void checkConnection(AmbariLdapConfiguration configuration) throws 
AmbariLdapException;
+  void checkConnection(LdapConnection ld

[33/46] ambari git commit: AMBARI-21307 added javadocs, organized and cleaned the code

2017-10-19 Thread lpuskas
AMBARI-21307 added javadocs, organized and cleaned the code


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 25d6edf9ca4aafec3e8a1eee94443fc2ffd245e0
Parents: 9b4bd20
Author: lpuskas 
Authored: Wed Sep 13 15:27:39 2017 +0200
Committer: lpuskas 
Committed: Thu Oct 19 14:42:00 2017 +0200

--
 .../server/ldap/LdapConfigurationFactory.java   |  13 +
 .../server/ldap/LdapConfigurationService.java   |  60 -
 .../apache/ambari/server/ldap/LdapModule.java   |   6 +-
 .../server/ldap/service/AmbariLdapFacade.java   |   9 +-
 .../server/ldap/service/AttributeDetector.java  |   3 +-
 .../ldap/service/LdapConfigurationService.java  |  60 +
 .../ambari/server/ldap/service/LdapFacade.java  |  10 +-
 .../ads/DefaultAttributeDetectionService.java   | 238 ---
 .../DefaultLdapAttributeDetectionService.java   | 238 +++
 .../ads/DefaultLdapConfigurationService.java|  17 +-
 .../detectors/UserGroupMemberAttrDetector.java  |   1 -
 .../DefaultAttributeDetectionServiceTest.java   | 108 -
 ...efaultLdapAttributeDetectionServiceTest.java | 108 +
 .../DefaultLdapConfigurationServiceTest.java|   2 +-
 14 files changed, 453 insertions(+), 420 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/25d6edf9/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapConfigurationFactory.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapConfigurationFactory.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapConfigurationFactory.java
index 57cdf6e..67ac092 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapConfigurationFactory.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapConfigurationFactory.java
@@ -16,6 +16,19 @@ package org.apache.ambari.server.ldap;
 
 import java.util.Map;
 
+/**
+ * Factory interface for AmbariLdapConfiguration instances.
+ * It's registered as a factory in the GUICE context ( so no implementations 
required)
+ *
+ * To be extended with other factory methods upon needs.
+ */
 public interface LdapConfigurationFactory {
+
+  /**
+   * Creates an AmbariLdapConfiguration instance with the provided map of 
configuration settings.
+   *
+   * @param configuration a map where keys are the configuration properties 
and values are the configuration values
+   * @return an AmbariLdapConfiguration instance
+   */
   AmbariLdapConfiguration createLdapConfiguration(Map 
configuration);
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/25d6edf9/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapConfigurationService.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapConfigurationService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapConfigurationService.java
deleted file mode 100644
index 69a641f..000
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapConfigurationService.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed 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.ldap;
-
-import java.util.Set;
-
-import org.apache.ambari.server.AmbariException;
-import org.apache.ambari.server.ldap.service.AmbariLdapException;
-import org.apache.directory.ldap.client.api.LdapConnection;
-
-/**
- * Collection of operations for validating ldap configuration.
- * It's intended to decouple implementations using different libraries.
- */
-public interface LdapConfigurationService {
-
-  /**
-   * Tests the connection based on the provided configuration.
-   *
-   * @param ldapConnection connection instance
-   * @param configuration  the ambari ldap configuration instance
-   * @throws AmbariLdapException if the connection is not possible
-   */
-  void checkConnection(LdapConnection ldapConnection, AmbariLdapConfiguration 
configurati

[10/46] ambari git commit: Revert "AMBARI-22258. Use correct property attribute setter fn(). while setting 'tez.runtime.io.sort.mb' maximum value."

2017-10-19 Thread lpuskas
Revert "AMBARI-22258. Use correct property attribute setter fn(). while setting 
'tez.runtime.io.sort.mb' maximum value."

This reverts commit b9f26708dd19c444918ea9b21150f66236fcdf2d.


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 37d59f281e682c17e0a34aa7e6d9a09c927febca
Parents: c9c96cd
Author: Swapan Shridhar 
Authored: Wed Oct 18 11:15:12 2017 -0700
Committer: Swapan Shridhar 
Committed: Wed Oct 18 11:15:12 2017 -0700

--
 .../src/main/resources/stacks/HDP/2.5/services/stack_advisor.py | 3 +--
 .../src/test/python/stacks/2.5/common/test_stack_advisor.py | 5 +
 2 files changed, 2 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/37d59f28/ambari-server/src/main/resources/stacks/HDP/2.5/services/stack_advisor.py
--
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.5/services/stack_advisor.py 
b/ambari-server/src/main/resources/stacks/HDP/2.5/services/stack_advisor.py
index b6f2478..92ce9b9 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.5/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.5/services/stack_advisor.py
@@ -860,7 +860,6 @@ class HDP25StackAdvisor(HDP24StackAdvisor):
 putHiveInteractiveEnvProperty = self.putProperty(configurations, 
"hive-interactive-env", services)
 putHiveInteractiveEnvPropertyAttribute = 
self.putPropertyAttribute(configurations, "hive-interactive-env")
 putTezInteractiveSiteProperty = self.putProperty(configurations, 
"tez-interactive-site", services)
-putTezInteractiveSitePropertyAttribute = 
self.putPropertyAttribute(configurations, "tez-interactive-site")
 llap_daemon_selected_queue_name = None
 selected_queue_is_ambari_managed_llap = None  # Queue named 'llap' at root 
level is Ambari managed.
 llap_selected_queue_am_percent = None
@@ -1332,7 +1331,7 @@ class HDP25StackAdvisor(HDP24StackAdvisor):
 putTezInteractiveSiteProperty('tez.runtime.io.sort.mb', 
tez_runtime_io_sort_mb)
 if "tez-site" in services["configurations"] and "tez.runtime.sorter.class" 
in services["configurations"]["tez-site"]["properties"]:
   if 
services["configurations"]["tez-site"]["properties"]["tez.runtime.sorter.class"]
 == "LEGACY":
-putTezInteractiveSitePropertyAttribute("tez.runtime.io.sort.mb", 
"maximum", 1800)
+putTezInteractiveSiteProperty("tez.runtime.io.sort.mb", "maximum", 
1800)
 
 
putTezInteractiveSiteProperty('tez.runtime.unordered.output.buffer.size-mb', 
tez_runtime_unordered_output_buffer_size)
 
putHiveInteractiveSiteProperty('hive.auto.convert.join.noconditionaltask.size', 
hive_auto_convert_join_noconditionaltask_size)

http://git-wip-us.apache.org/repos/asf/ambari/blob/37d59f28/ambari-server/src/test/python/stacks/2.5/common/test_stack_advisor.py
--
diff --git 
a/ambari-server/src/test/python/stacks/2.5/common/test_stack_advisor.py 
b/ambari-server/src/test/python/stacks/2.5/common/test_stack_advisor.py
index 407e78d..cf462de 100644
--- a/ambari-server/src/test/python/stacks/2.5/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.5/common/test_stack_advisor.py
@@ -4446,8 +4446,7 @@ class TestHDP25StackAdvisor(TestCase):
   },
 "tez-site": {
   "properties": {
-"tez.am.resource.memory.mb": "1024",
-"tez.runtime.sorter.class": "LEGACY"
+"tez.am.resource.memory.mb": "1024"
   }
 },
   }
@@ -4482,8 +4481,6 @@ class TestHDP25StackAdvisor(TestCase):
 
 
self.assertEqual(configurations['hive-interactive-site']['properties']['hive.llap.io.memory.size'],
 '186368')
 
self.assertEqual(configurations['hive-interactive-env']['properties']['llap_heap_size'],
 '9830')
-
self.assertEqual(configurations['tez-interactive-site']['properties']['tez.runtime.io.sort.mb'],
 '1092')
-
self.assertEquals(configurations['tez-interactive-site']['property_attributes']['tez.runtime.io.sort.mb'],
 {'maximum': '1800'})
 
 
 



[45/46] ambari git commit: AMBARI-21307 Improved the attribute detection implementation (using detector chains, added logging, improved guice setup).

2017-10-19 Thread lpuskas
AMBARI-21307 Improved the attribute detection implementation (using detector 
chains, added logging, improved guice setup).


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 468fdc3f2d250567fc3c6329dd43c48cbdf4e6ba
Parents: 3bb03e9
Author: lpuskas 
Authored: Mon Oct 16 18:24:32 2017 +0200
Committer: lpuskas 
Committed: Thu Oct 19 14:42:03 2017 +0200

--
 .../apache/ambari/server/ldap/LdapModule.java   | 32 +
 .../ldap/domain/AmbariLdapConfigKeys.java   | 11 +++
 .../server/ldap/service/AttributeDetector.java  |  6 +-
 .../DefaultLdapAttributeDetectionService.java   | 70 +---
 .../ads/detectors/AttributeDetectorFactory.java | 52 +++
 .../ads/detectors/ChainedAttributeDetector.java | 59 +
 .../ads/detectors/GroupMemberAttrDetector.java  |  6 ++
 .../ads/detectors/GroupNameAttrDetector.java|  6 ++
 .../ads/detectors/GroupObjectClassDetector.java |  6 ++
 .../OccurrenceAndWeightBasedDetector.java   | 10 ++-
 .../detectors/UserGroupMemberAttrDetector.java  |  6 ++
 .../ads/detectors/UserNameAttrDetector.java |  8 +++
 .../ads/detectors/UserObjectClassDetector.java  |  6 ++
 .../server/ldap/LdapModuleFunctionalTest.java   | 20 ++
 14 files changed, 255 insertions(+), 43 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/468fdc3f/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapModule.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapModule.java 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapModule.java
index 67e84dc..089da1d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapModule.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/ldap/LdapModule.java
@@ -19,6 +19,7 @@ import 
org.apache.ambari.server.ldap.domain.AmbariLdapConfiguration;
 import org.apache.ambari.server.ldap.domain.AmbariLdapConfigurationFactory;
 import org.apache.ambari.server.ldap.service.AmbariLdapConfigurationProvider;
 import org.apache.ambari.server.ldap.service.AmbariLdapFacade;
+import org.apache.ambari.server.ldap.service.AttributeDetector;
 import org.apache.ambari.server.ldap.service.LdapAttributeDetectionService;
 import org.apache.ambari.server.ldap.service.LdapConfigurationService;
 import org.apache.ambari.server.ldap.service.LdapConnectionConfigService;
@@ -26,15 +27,27 @@ import org.apache.ambari.server.ldap.service.LdapFacade;
 import 
org.apache.ambari.server.ldap.service.ads.DefaultLdapAttributeDetectionService;
 import 
org.apache.ambari.server.ldap.service.ads.DefaultLdapConfigurationService;
 import 
org.apache.ambari.server.ldap.service.ads.DefaultLdapConnectionConfigService;
+import 
org.apache.ambari.server.ldap.service.ads.detectors.AttributeDetectorFactory;
+import 
org.apache.ambari.server.ldap.service.ads.detectors.GroupMemberAttrDetector;
+import 
org.apache.ambari.server.ldap.service.ads.detectors.GroupNameAttrDetector;
+import 
org.apache.ambari.server.ldap.service.ads.detectors.GroupObjectClassDetector;
+import 
org.apache.ambari.server.ldap.service.ads.detectors.UserGroupMemberAttrDetector;
+import 
org.apache.ambari.server.ldap.service.ads.detectors.UserNameAttrDetector;
+import 
org.apache.ambari.server.ldap.service.ads.detectors.UserObjectClassDetector;
 
 import com.google.inject.AbstractModule;
 import com.google.inject.assistedinject.FactoryModuleBuilder;
+import com.google.inject.multibindings.Multibinder;
+import com.google.inject.name.Names;
 
 /**
  * GUICE configuration module for setting up LDAP related infrastructure.
  */
 public class LdapModule extends AbstractModule {
 
+  public static final String USER_ATTRIBUTES_DETECTORS = 
"UserAttributesDetectors";
+  public static final String GROUP_ATTRIBUTES_DETECTORS = 
"GroupAttributesDetectors";
+
   @Override
   protected void configure() {
 bind(LdapFacade.class).to(AmbariLdapFacade.class);
@@ -45,6 +58,25 @@ public class LdapModule extends AbstractModule {
 // this binding requires the JPA module!
 
bind(AmbariLdapConfiguration.class).toProvider(AmbariLdapConfigurationProvider.class);
 
+bind(AttributeDetectorFactory.class);
+
 install(new 
FactoryModuleBuilder().build(AmbariLdapConfigurationFactory.class));
+
+// binding the set of user attributes detector
+Multibinder userAttributeDetectorBinder = 
Multibinder.newSetBinder(binder(), AttributeDetector.class,
+  Names.named(USER_ATTRIBUTES_DETECTORS));
+userAttributeDetectorBi

[40/46] ambari git commit: AMBARI-21307 Fixed failing unit tests (in most cases the new guice module was needed)

2017-10-19 Thread lpuskas
AMBARI-21307 Fixed failing unit tests (in most cases the new guice module was 
needed)


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 010ff383af5e1e7a7de9ebf67bf76fc0274dc90a
Parents: 32c292c
Author: lpuskas 
Authored: Thu Oct 12 19:25:24 2017 +0200
Committer: lpuskas 
Committed: Thu Oct 19 14:42:02 2017 +0200

--
 .../main/resources/Ambari-DDL-Derby-CREATE.sql  |  2 +-
 .../main/resources/Ambari-DDL-MySQL-CREATE.sql  |  2 +-
 .../main/resources/Ambari-DDL-Oracle-CREATE.sql |  2 +-
 .../resources/Ambari-DDL-Postgres-CREATE.sql|  2 +-
 .../resources/Ambari-DDL-SQLAnywhere-CREATE.sql |  2 +-
 .../resources/Ambari-DDL-SQLServer-CREATE.sql   |  2 +-
 .../api/services/ldap/LDAPServiceTest.java  | 85 
 .../server/checks/UpgradeCheckOrderTest.java|  3 +-
 ...AmbariConfigurationResourceProviderTest.java | 24 +-
 .../server/ldap/LdapModuleFunctionalTest.java   |  4 +-
 .../notifications/DispatchFactoryTest.java  |  3 +-
 .../server/orm/InMemoryDefaultTestModule.java   |  2 +
 .../ambari/server/orm/JdbcPropertyTest.java |  5 +-
 ...uthenticationProviderForDNWithSpaceTest.java | 35 
 .../AmbariLdapAuthenticationProviderTest.java   |  3 +-
 .../AmbariLocalUserProviderTest.java|  3 +-
 .../authorization/LdapServerPropertiesTest.java |  5 +-
 17 files changed, 65 insertions(+), 119 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/010ff383/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
--
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql 
b/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
index cebd33e..20d64de 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
@@ -98,7 +98,7 @@ CREATE TABLE configuration_base (
 CREATE TABLE ambari_configuration (
   id BIGINT NOT NULL,
   CONSTRAINT PK_ambari_configuration PRIMARY KEY (id),
-  CONSTRAINT FK_ambari_configuration_configuration_base FOREIGN KEY (id) 
REFERENCES configuration_base (id)
+  CONSTRAINT FK_ambari_conf_conf_base FOREIGN KEY (id) REFERENCES 
configuration_base (id)
 );
 
 CREATE TABLE serviceconfig (

http://git-wip-us.apache.org/repos/asf/ambari/blob/010ff383/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
--
diff --git a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql 
b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
index b8b506a..dc1dea9 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
@@ -118,7 +118,7 @@ CREATE TABLE configuration_base (
 CREATE TABLE ambari_configuration (
   id BIGINT NOT NULL,
   CONSTRAINT PK_ambari_configuration PRIMARY KEY (id),
-  CONSTRAINT FK_ambari_configuration_configuration_base FOREIGN KEY (id) 
REFERENCES configuration_base (id)
+  CONSTRAINT FK_ambari_conf_conf_base FOREIGN KEY (id) REFERENCES 
configuration_base (id)
 );
 
 CREATE TABLE serviceconfig (

http://git-wip-us.apache.org/repos/asf/ambari/blob/010ff383/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
--
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql 
b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
index 1e90426..7c34304 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
@@ -98,7 +98,7 @@ CREATE TABLE configuration_base (
 CREATE TABLE ambari_configuration (
   id NUMBER(19) NOT NULL,
   CONSTRAINT PK_ambari_configuration PRIMARY KEY (id),
-  CONSTRAINT FK_ambari_configuration_configuration_base FOREIGN KEY (id) 
REFERENCES configuration_base (id)
+  CONSTRAINT FK_ambari_conf_conf_base FOREIGN KEY (id) REFERENCES 
configuration_base (id)
 );
 
 CREATE TABLE serviceconfig (

http://git-wip-us.apache.org/repos/asf/ambari/blob/010ff383/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
--
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql 
b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
index 583a51b..9270522 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres

[12/46] ambari git commit: AMBARI-22228 - Remove Remote Tea Runtime library dependency from Storm binaries (Arun Mahadevan via jonathanhurley)

2017-10-19 Thread lpuskas
AMBARI-8 - Remove Remote Tea Runtime library dependency from Storm binaries 
(Arun Mahadevan via jonathanhurley)


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 8852f33b90d4983dd9927184f0c20153eaf3b065
Parents: 3b5cbed
Author: Jonathan Hurley 
Authored: Wed Oct 18 16:54:16 2017 -0400
Committer: Jonathan Hurley 
Committed: Wed Oct 18 17:27:11 2017 -0400

--
 .../resources/stacks/HDP/2.3/upgrades/config-upgrade.xml  |  5 +
 .../stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml|  3 +++
 .../resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml |  1 +
 .../resources/stacks/HDP/2.4/upgrades/config-upgrade.xml  |  4 
 .../stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml|  3 +++
 .../resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml |  1 +
 .../resources/stacks/HDP/2.5/upgrades/config-upgrade.xml  | 10 ++
 .../stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.6.xml|  3 +++
 .../resources/stacks/HDP/2.5/upgrades/upgrade-2.6.xml |  1 +
 .../HDP/2.6/services/STORM/configuration/storm-site.xml   |  6 +++---
 .../resources/stacks/HDP/2.6/upgrades/config-upgrade.xml  |  4 
 .../stacks/HDP/2.6/upgrades/nonrolling-upgrade-2.6.xml|  4 
 .../resources/stacks/HDP/2.6/upgrades/upgrade-2.6.xml |  1 +
 13 files changed, 43 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/8852f33b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/config-upgrade.xml
--
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/config-upgrade.xml 
b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/config-upgrade.xml
index ff12150..c4a5b95 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/config-upgrade.xml
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/config-upgrade.xml
@@ -660,6 +660,11 @@
  
replace-with="${sys:workers.artifacts}/${sys:storm.id}/${sys:worker.port}/${sys:logfile.name}"/>
   
 
+  
+storm-site
+
+  
+
 
   
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/8852f33b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml
--
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml
 
b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml
index 4034f4b..907626d 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml
@@ -671,6 +671,9 @@
   Update Storm log directory in storm worker log4j
 
   
+  
+
+  
 
   
   

http://git-wip-us.apache.org/repos/asf/ambari/blob/8852f33b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml
--
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml 
b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml
index 2e2c9c3..567e6e1 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml
@@ -1130,6 +1130,7 @@
   
   
   
+  
 
 
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/8852f33b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/config-upgrade.xml
--
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/config-upgrade.xml 
b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/config-upgrade.xml
index 5c1f33f..64121a4 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/config-upgrade.xml
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/config-upgrade.xml
@@ -481,6 +481,10 @@
 
   
+  
+storm-site
+
+  
 
   
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/8852f33b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml
--
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml
 
b/ambari-server/src/main/resources/stac

[27/46] ambari git commit: AMBARI-21307 implemented user attribute detection. Organized code

2017-10-19 Thread lpuskas
AMBARI-21307 implemented user attribute detection. Organized code


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: b05842b2908190e6a79c7f3e336106644bb08808
Parents: 4afe981
Author: lpuskas 
Authored: Tue Sep 12 08:10:47 2017 +0200
Committer: lpuskas 
Committed: Thu Oct 19 14:41:59 2017 +0200

--
 .../services/ldap/LdapConfigurationService.java |   2 +-
 .../server/ldap/AmbariLdapConfiguration.java|   9 ++
 .../server/ldap/service/AmbariLdapFacade.java   |   2 +-
 .../server/ldap/service/AttributeDetector.java  |  38 ++
 .../service/LdapAttributeDetectionService.java  |   7 +-
 .../ambari/server/ldap/service/LdapFacade.java  |   2 +-
 .../server/ldap/service/LdapSearchService.java  |  18 ---
 .../ads/DefaultAttributeDetectionService.java   | 132 ++-
 .../ads/DefaultLdapConfigurationService.java|   2 +-
 .../ldap/service/ads/ObjectClassDetector.java   |  81 
 .../ads/OccurranceAndWeightBasedDetector.java   |  81 
 .../service/ads/UserNameAttributeDetector.java  |  75 +++
 .../DefaultAttributeDetectionServiceTest.java   |  35 ++---
 13 files changed, 440 insertions(+), 44 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/b05842b2/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
index 1b8427b..66809c3 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ldap/LdapConfigurationService.java
@@ -107,7 +107,7 @@ public class LdapConfigurationService extends 
AmbariConfigurationService {
 case TEST_ATTRIBUTES:
 
   LOGGER.info("Testing LDAP attributes ");
-  groups = 
ldapFacade.checkLdapAttibutes(ldapConfigurationRequest.getRequestInfo().getParameters(),
 ambariLdapConfiguration);
+  groups = 
ldapFacade.checkLdapAttributes(ldapConfigurationRequest.getRequestInfo().getParameters(),
 ambariLdapConfiguration);
   setResult(groups, result);
 
   break;

http://git-wip-us.apache.org/repos/asf/ambari/blob/b05842b2/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
index 76faeed..e28c6ed 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/AmbariLdapConfiguration.java
@@ -98,6 +98,10 @@ public class AmbariLdapConfiguration {
 return value;
   }
 
+  public void setValueFor(AmbariLdapConfig ambariLdapConfig, Object value) {
+configurationMap.put(ambariLdapConfig.key(), value);
+  }
+
   @Inject
   public AmbariLdapConfiguration(@Assisted Map configuration) {
 this.configurationMap = configuration;
@@ -219,4 +223,9 @@ public class AmbariLdapConfiguration {
 return (String) configValue(AmbariLdapConfig.REFERRAL_HANDLING);
   }
 
+
+  @Override
+  public String toString() {
+return configurationMap.toString();
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/b05842b2/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
index 16bf6b7..f159418 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/service/AmbariLdapFacade.java
@@ -90,7 +90,7 @@ public class AmbariLdapFacade implements LdapFacade {
   }
 
   @Override
-  public Set checkLdapAttibutes(Map parameters, 
AmbariLdapConfiguration ldapConfiguration) throws AmbariLdapException {
+  public Set checkLdapAttributes(Map parameters, 
AmbariLdapConfiguration ldapConfiguration) throws AmbariLdapException {
 Strin

[36/46] ambari git commit: AMBARI-21307 organized code, fixed build failures

2017-10-19 Thread lpuskas
AMBARI-21307 organized code, fixed build failures


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 1de16c84be4ae6fecb07604535e6850e872c8464
Parents: 6fc9fad
Author: lpuskas 
Authored: Thu Sep 14 17:58:59 2017 +0200
Committer: lpuskas 
Committed: Thu Oct 19 14:42:01 2017 +0200

--
 .../ldap/domain/AmbariLdapConfigKeys.java   | 72 
 .../ldap/domain/AmbariLdapConfiguration.java|  3 -
 .../ldap/domain/LdapConfigurationFactory.java   |  2 +-
 .../ldap/service/AmbariLdapConfigKeys.java  | 72 
 .../DefaultLdapAttributeDetectionService.java   |  2 +-
 .../domain/AmbariLdapConfigurationTest.java | 19 ++
 .../TestAmbariLdapConfigurationFactory.java | 29 
 ...efaultLdapAttributeDetectionServiceTest.java |  9 ++-
 .../DefaultLdapConfigurationServiceTest.java| 19 +-
 9 files changed, 144 insertions(+), 83 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/1de16c84/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfigKeys.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfigKeys.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfigKeys.java
new file mode 100644
index 000..b7b41a3
--- /dev/null
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ldap/domain/AmbariLdapConfigKeys.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed 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.ldap.domain;
+
+/**
+ * Constants representing supported LDAP related property names
+ * // todo extend this with validation information, description, defaults maybe
+ */
+public enum AmbariLdapConfigKeys {
+
+  LDAP_ENABLED("ambari.ldap.authentication.enabled"),
+  SERVER_HOST("ambari.ldap.connectivity.server.host"),
+  SERVER_PORT("ambari.ldap.connectivity.server.port"),
+  USE_SSL("ambari.ldap.connectivity.use_ssl"),
+
+  TRUST_STORE("ambari.ldap.connectivity.trust_store"),
+  TRUST_STORE_TYPE("ambari.ldap.connectivity.trust_store.type"),
+  TRUST_STORE_PATH("ambari.ldap.connectivity.trust_store.path"),
+  TRUST_STORE_PASSWORD("ambari.ldap.connectivity.trust_store.password"),
+  ANONYMOUS_BIND("ambari.ldap.connectivity.anonymous_bind"),
+
+  BIND_DN("ambari.ldap.connectivity.bind_dn"),
+  BIND_PASSWORD("ambari.ldap.connectivity.bind_password"),
+
+  ATTR_DETECTION("ambari.ldap.attributes.detection"), // manual | auto
+
+  DN_ATTRIBUTE("ambari.ldap.attributes.dn_attr"),
+
+  USER_OBJECT_CLASS("ambari.ldap.attributes.user.object_class"),
+  USER_NAME_ATTRIBUTE("ambari.ldap.attributes.user.name_attr"),
+  USER_GROUP_MEMBER_ATTRIBUTE("ambari.ldap.attributes.user.group_member_attr"),
+  USER_SEARCH_BASE("ambari.ldap.attributes.user.search_base"),
+
+  GROUP_OBJECT_CLASS("ambari.ldap.attributes.group.object_class"),
+  GROUP_NAME_ATTRIBUTE("ambari.ldap.attributes.group.name_attr"),
+  GROUP_MEMBER_ATTRIBUTE("ambari.ldap.attributes.group.member_attr"),
+  GROUP_SEARCH_BASE("ambari.ldap.attributes.group.search_base"),
+
+  USER_SEARCH_FILTER("ambari.ldap.advanced.user_search_filter"),
+  
USER_MEMBER_REPLACE_PATTERN("ambari.ldap.advanced.user_member_replace_pattern"),
+  USER_MEMBER_FILTER("ambari.ldap.advanced.user_member_filter"),
+
+  GROUP_SEARCH_FILTER("ambari.ldap.advanced.group_search_filter"),
+  
GROUP_MEMBER_REPLACE_PATTERN("ambari.ldap.advanced.group_member_replace_pattern"),
+  GROUP_MEMBER_FILTER("ambari.ldap.advanced.group_member_filter"),
+
+  FORCE_LOWERCASE_USERNAMES("ambari.ldap.advanced.force_lowercase_usernames"),
+  REFERRAL_HANDLING("ambari.ldap.advanced.referrals"), // folow
+  PAGINATION_ENABLED("ambari.ldap.a

  1   2   3   4   5   6   7   8   >