ambari git commit: AMBARI-21579 Ooozie quicklink configuration does not work with https (benyoka)

2017-07-28 Thread benyoka
Repository: ambari
Updated Branches:
  refs/heads/trunk 112885bef -> d9c300bc1


AMBARI-21579 Ooozie quicklink configuration does not work with https (benyoka)


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

Branch: refs/heads/trunk
Commit: d9c300bc1989ca42d38a01dff1e2c0a8be206ae0
Parents: 112885b
Author: Balazs Bence Sari <beny...@apache.org>
Authored: Fri Jul 28 14:38:29 2017 +0200
Committer: Balazs Bence Sari <beny...@apache.org>
Committed: Fri Jul 28 14:38:29 2017 +0200

--
 .../ambari/server/state/quicklinks/Port.java| 15 ++
 .../OOZIE/4.2.0.2.3/quicklinks/quicklinks.json  |  9 ++--
 .../OOZIE/4.2.0.3.0/quicklinks/quicklinks.json  |  9 ++--
 .../services/OOZIE/quicklinks/quicklinks.json   |  9 ++--
 .../services/OOZIE/quicklinks/quicklinks.json   |  9 ++--
 .../QuickLinksConfigurationModuleTest.java  | 14 ++
 .../src/test/resources/parent_quicklinks.json   |  1 +
 .../app/views/common/quick_view_link_view.js|  6 +++
 .../test/views/common/quick_link_view_test.js   | 50 
 9 files changed, 106 insertions(+), 16 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/d9c300bc/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinks/Port.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinks/Port.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinks/Port.java
index 7bd4b81..fa35ab9 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinks/Port.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinks/Port.java
@@ -40,6 +40,10 @@ public class Port{
   @JsonProperty("regex")
   private String regex;
 
+  @JsonProperty("https_regex")
+  private String httpsRegex;
+
+
   @JsonProperty("site")
   private String site;
 
@@ -83,6 +87,14 @@ public class Port{
 this.regex = regex;
   }
 
+  public String getHttpsRegex() {
+return httpsRegex;
+  }
+
+  public void setHttpsRegex(String httpsRegex) {
+this.httpsRegex = httpsRegex;
+  }
+
   public String getSite() {
 return site;
   }
@@ -110,6 +122,9 @@ public class Port{
 if(null == regex && null != parentPort.getRegex())
   regex = parentPort.getRegex();
 
+if(null == httpsRegex && null != parentPort.getHttpsRegex())
+  regex = parentPort.getHttpsRegex();
+
 if(null == site && null != parentPort.getSite())
   site = parentPort.getSite();
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/d9c300bc/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.2.3/quicklinks/quicklinks.json
--
diff --git 
a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.2.3/quicklinks/quicklinks.json
 
b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.2.3/quicklinks/quicklinks.json
index 6353220..f15ddd7 100644
--- 
a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.2.3/quicklinks/quicklinks.json
+++ 
b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.2.3/quicklinks/quicklinks.json
@@ -8,17 +8,17 @@
   "checks":[
 {
   "property":"oozie.https.port",
-  "desired":"EXISTS",
+  "desired":"EXIST",
   "site":"oozie-site"
 },
 {
   "property":"oozie.https.keystore.file",
-  "desired":"EXISTS",
+  "desired":"EXIST",
   "site":"oozie-site"
 },
 {
   "property":"oozie.https.keystore.pass",
-  "desired":"EXISTS",
+  "desired":"EXIST",
   "site":"oozie-site"
 }
   ]
@@ -34,9 +34,10 @@
 "port":{
   "http_property": "oozie.base.url",
   "http_default_port": "11000",
-  "https_property": "oozie.base.url",
+  "https_property": "oozie.https.port",
   "https_default_port": "11443",
   "regex": "\\w*:(\\d+)",
+  "https_regex": "(\\d+)",
   "site": "oozie-site"
 }
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/d9c300bc/ambari-serv

ambari git commit: AMBARI-21545 Stack Advisor support for LDAP configuration (benyoka)

2017-08-08 Thread benyoka
Repository: ambari
Updated Branches:
  refs/heads/feature-branch-AMBARI-21307 12c50a909 -> 3fd19fe70


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/3fd19fe7
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3fd19fe7
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3fd19fe7

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 3fd19fe7096f6227a769a21d6374a1c051b50fb0
Parents: 12c50a9
Author: Balazs Bence Sari <beny...@apache.org>
Authored: Tue Aug 8 20:17:14 2017 +0200
Committer: Balazs Bence Sari <beny...@apache.org>
Committed: Tue Aug 8 20:17:14 2017 +0200

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


http://git-wip-us.apache.org/repos/asf/ambari/blob/3fd19fe7/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/3fd19fe7/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 7ba1b18..b90eae6 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
@@ -30,6 +30,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.
  */
@@ -47,6 +49,7 @@ public class StackAdvisorRequest {
   private List changedConfigurations = new LinkedList<>();
   private Set configGroups;
   private Map<String, String> userContext = new HashMap<>();
+  private Map<String, Object> ldapConfig = new HashMap<>();
 
   public String getStackName() {
 return stackName;
@@ -92,6 +95,8 @@ public class StackAdvisorRequest {
 return configurations;
   }
 
+  public Map<String, Object> getLdapConfig() { return ldapConfig; }
+
   public List getChangedConfigurations() {
 return changedConfigurations;
   }
@@ -188,6 +193,13 @@ public class StackAdvisorRequest {
   return this;
 }
 
+public StackAdvisorRequestBuilder withLdapConfig(Map<String, Object> 
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/3fd19fe7/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/St

ambari git commit: AMBARI-14714. fix compiler errors (benyoka)

2017-10-06 Thread benyoka
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-14714 1e90bd576 -> 5dad3


AMBARI-14714. fix compiler errors (benyoka)


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

Branch: refs/heads/branch-feature-AMBARI-14714
Commit: 5dad30611575f7c853a83e21b5dce0c85c7f
Parents: 1e90bd5
Author: Balazs Bence Sari <beny...@apache.org>
Authored: Fri Oct 6 19:36:36 2017 +0200
Committer: Balazs Bence Sari <beny...@apache.org>
Committed: Fri Oct 6 19:36:36 2017 +0200

--
 .../apache/ambari/server/controller/StackV2.java| 16 +---
 .../ambari/server/topology/BlueprintImplV2.java |  6 +++---
 .../apache/ambari/server/topology/BlueprintV2.java  |  6 +++---
 .../apache/ambari/server/topology/HostGroupV2.java  |  4 ++--
 .../org/apache/ambari/server/topology/Service.java  |  4 ++--
 5 files changed, 23 insertions(+), 13 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/5dad/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2.java 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2.java
index 3e34951..8a2208d 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2.java
@@ -18,14 +18,24 @@
 
 package org.apache.ambari.server.controller;
 
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.orm.entities.StackEntity;
-import org.apache.ambari.server.state.*;
+import org.apache.ambari.server.state.AutoDeployInfo;
+import org.apache.ambari.server.state.ComponentInfo;
+import org.apache.ambari.server.state.DependencyInfo;
+import org.apache.ambari.server.state.PropertyDependencyInfo;
+import org.apache.ambari.server.state.PropertyInfo;
+import org.apache.ambari.server.state.ValueAttributesInfo;
 import org.apache.ambari.server.topology.Cardinality;
 import org.apache.ambari.server.topology.Configuration;
 
-import java.util.*;
-
 /**
  * Encapsulates stack information.
  */

http://git-wip-us.apache.org/repos/asf/ambari/blob/5dad/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java
index fa893b3b..9bde795 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java
@@ -19,13 +19,13 @@
 
 package org.apache.ambari.server.topology;
 
-import org.apache.ambari.server.controller.StackV2;
-import org.apache.ambari.server.orm.entities.BlueprintEntity;
-
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.ambari.server.controller.StackV2;
+import org.apache.ambari.server.orm.entities.BlueprintEntity;
+
 /**
  * Blueprint implementation.
  */

http://git-wip-us.apache.org/repos/asf/ambari/blob/5dad/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2.java
index 134a614..1fea966 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2.java
@@ -18,13 +18,13 @@
 
 package org.apache.ambari.server.topology;
 
-import org.apache.ambari.server.controller.StackV2;
-import org.apache.ambari.server.orm.entities.BlueprintEntity;
-
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.ambari.server.controller.StackV2;
+import org.apache.ambari.server.orm.entities.BlueprintEntity;
+
 /**
  * Blueprint representation.
  */

http://git-wip-us.apache.org/repos/asf/ambari/blob/5dad/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroupV2.java
--
diff --git 

ambari git commit: AMBARI-21307 Add all known LDAP properties to AmbariConfigurationEnum (benyoka)

2017-09-04 Thread benyoka
Repository: ambari
Updated Branches:
  refs/heads/feature-branch-AMBARI-21307 73ba1463a -> f5f29b312


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/f5f29b31
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f5f29b31
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f5f29b31

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: f5f29b31284b89aa2164dce0d48f0e828785815c
Parents: 73ba146
Author: Balazs Bence Sari <beny...@apache.org>
Authored: Mon Sep 4 12:45:07 2017 +0200
Committer: Balazs Bence Sari <beny...@apache.org>
Committed: Mon Sep 4 12:45:48 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/f5f29b31/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;
 



ambari git commit: AMBARI-14714. Fix compile errors (benyoka)

2017-10-05 Thread benyoka
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-14714-blueprint efc066ac3 -> 457b4080e


AMBARI-14714. Fix compile errors (benyoka)


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

Branch: refs/heads/branch-feature-AMBARI-14714-blueprint
Commit: 457b4080ef018907ab30f7d1225cbc44c8d5fabf
Parents: efc066a
Author: Balazs Bence Sari <beny...@apache.org>
Authored: Thu Oct 5 21:25:36 2017 +0200
Committer: Balazs Bence Sari <beny...@apache.org>
Committed: Thu Oct 5 21:25:36 2017 +0200

--
 .../controller/ServiceComponentHostRequest.java | 11 +
 .../controller/ServiceComponentRequest.java | 15 ++
 .../server/controller/ServiceRequest.java   | 15 ++
 .../ambari/server/mpack/MpackManager.java   | 34 +++--
 .../org/apache/ambari/server/state/Cluster.java |  8 
 .../ambari/server/state/ServiceFactory.java |  4 ++
 .../server/state/cluster/ClusterImpl.java   | 14 ++
 .../ambari/server/topology/Blueprint.java   |  8 ++--
 .../ambari/server/topology/BlueprintImpl.java   | 50 +---
 .../ambari/server/topology/Component.java   | 12 +
 .../ambari/server/topology/HostGroup.java   | 10 ++--
 .../ambari/server/topology/HostGroupImpl.java   | 12 +++--
 .../apache/ambari/server/topology/Service.java  |  2 +-
 13 files changed, 154 insertions(+), 41 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/457b4080/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostRequest.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostRequest.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostRequest.java
index 7c4c9ab..806e9d3 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostRequest.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostRequest.java
@@ -35,6 +35,17 @@ public class ServiceComponentHostRequest {
   private String adminState; // GET - predicate
   private String maintenanceState; // UPDATE
 
+
+  // TODO: BP3.0
+  @Deprecated
+  public ServiceComponentHostRequest(String clusterName,
+ String serviceName,
+ String componentName,
+ String hostname,
+ String desiredState) {
+throw new UnsupportedOperationException("Not supported with 3.0 
Blueprints.");
+  }
+
   public ServiceComponentHostRequest(String clusterName,
  String serviceGroupName,
  String serviceDisplayName,

http://git-wip-us.apache.org/repos/asf/ambari/blob/457b4080/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentRequest.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentRequest.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentRequest.java
index 1556b70..11aaf0b 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentRequest.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentRequest.java
@@ -29,6 +29,21 @@ public class ServiceComponentRequest {
   private String componentCategory;
   private String recoveryEnabled; // CREATE/UPDATE
 
+  // TODO: BP3.0
+  @Deprecated
+  public ServiceComponentRequest(String clusterName,
+ String componentName, String desiredState) {
+throw new UnsupportedOperationException("Not supported with 3.0 
Blueprints.");
+  }
+
+  // TODO: BP3.0
+  @Deprecated
+  public ServiceComponentRequest(String clusterName, String componentName,
+ String desiredState, String recoveryEnabled) {
+throw new UnsupportedOperationException("Not supported with 3.0 
Blueprints.");
+  }
+
+
   public ServiceComponentRequest(String clusterName, String serviceGroupName, 
String serviceDisplayName,
  String componentName, String desiredState) {
 this(clusterName, serviceGroupName, serviceDisplayName, componentName, 
desiredState, null, null);

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

ambari git commit: Create first unit test for Blueprint v2 data model (benyoka)

2017-10-18 Thread benyoka
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-14714-tmp-bence b45710fb2 -> 6c5c10bdb


Create first unit test for Blueprint v2 data model (benyoka)


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

Branch: refs/heads/branch-feature-AMBARI-14714-tmp-bence
Commit: 6c5c10bdbc93a129cce92c5e26a815f1c502ee60
Parents: b45710f
Author: Balazs Bence Sari <beny...@apache.org>
Authored: Wed Oct 18 18:29:56 2017 +0200
Committer: Balazs Bence Sari <beny...@apache.org>
Committed: Wed Oct 18 18:29:56 2017 +0200

--
 .../ambari/server/topology/BlueprintImplV2.java |  29 
 .../validators/BlueprintImplV2Test.java |  45 +-
 .../test/resources/blueprintv2/blueprintv2.json | 152 +++
 3 files changed, 196 insertions(+), 30 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/6c5c10bd/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java
index 776cb4a..bb41dfa 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java
@@ -19,7 +19,6 @@
 
 package org.apache.ambari.server.topology;
 
-import java.io.File;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
@@ -38,11 +37,6 @@ import org.apache.commons.lang.StringUtils;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.core.Version;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
-import com.fasterxml.jackson.databind.module.SimpleAbstractTypeResolver;
-import com.fasterxml.jackson.databind.module.SimpleModule;
 
 /**
  * Blueprint implementation.
@@ -288,27 +282,4 @@ public class BlueprintImplV2 implements BlueprintV2 {
 public Blueprints() { }
   }
 
-  public static void main(String[] args) throws Exception {
-ObjectMapper mapper = new ObjectMapper();
-SimpleModule module = new SimpleModule("CustomModel", 
Version.unknownVersion());
-SimpleAbstractTypeResolver resolver = new SimpleAbstractTypeResolver();
-resolver.addMapping(HostGroupV2.class, HostGroupV2Impl.class);
-module.setAbstractTypes(resolver);
-mapper.registerModule(module);
-mapper.enable(SerializationFeature.INDENT_OUTPUT);
-BlueprintImplV2 bp = mapper.readValue(new 
File("/Users/bsari/develop/blueprints/blueprintv2.json"), 
BlueprintImplV2.class);
-String bpJson = mapper.writeValueAsString(bp);
-System.out.println(bpJson);
-
System.out.println("\n\n\n\n");
-Map<String, Object> map = mapper.readValue(new 
File("/Users/bsari/develop/blueprints/blueprintv2.json"), HashMap.class);
-System.out.println(map);
-
System.out.println("\n\n\n\n");
-String bpJson2 = mapper.writeValueAsString(map);
-System.out.println(bpJson2);
-
System.out.println("\n\n\n\n");
-BlueprintImplV2 bp2 = mapper.readValue(bpJson2, BlueprintImplV2.class);
-System.out.println(bp2);
-  }
-
-
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/6c5c10bd/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/BlueprintImplV2Test.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/BlueprintImplV2Test.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/BlueprintImplV2Test.java
index dbe269a..5a676bc 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/BlueprintImplV2Test.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/BlueprintImplV2Test.java
@@ -1,9 +1,52 @@
 package org.apache.ambari.server.topology.validators;
 
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.ambari.server.topology.BlueprintImplV2;
+import org.apache.ambari.server.topology.HostGroupV2;
+import org.apache.ambari.server.topology.

[1/2] ambari git commit: Blueprint V2 data model (benyoka)

2017-10-18 Thread benyoka
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-14714-tmp-bence [created] b45710fb2


http://git-wip-us.apache.org/repos/asf/ambari/blob/b45710fb/ambari-server/src/main/java/org/apache/ambari/server/topology/RepositoryVersion.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/RepositoryVersion.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/RepositoryVersion.java
new file mode 100644
index 000..8eb6663
--- /dev/null
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/RepositoryVersion.java
@@ -0,0 +1,71 @@
+/*
+ * 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 distribut
+ * ed 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;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class RepositoryVersion {
+  @JsonProperty("stack_id")
+  private String stackId;
+
+  @JsonProperty("repository_version")
+  private String repositoryVersion;
+
+  public RepositoryVersion() { }
+
+  public RepositoryVersion(String stackId, String repositoryVersion) {
+this.stackId = stackId;
+this.repositoryVersion = repositoryVersion;
+  }
+
+  @Override
+  public boolean equals(Object o) {
+if (this == o) return true;
+if (o == null || getClass() != o.getClass()) return false;
+
+RepositoryVersion that = (RepositoryVersion) o;
+
+if (stackId != null ? !stackId.equals(that.stackId) : that.stackId != 
null) return false;
+return repositoryVersion != null ? 
repositoryVersion.equals(that.repositoryVersion) : that.repositoryVersion == 
null;
+  }
+
+  @Override
+  public int hashCode() {
+int result = stackId != null ? stackId.hashCode() : 0;
+result = 31 * result + (repositoryVersion != null ? 
repositoryVersion.hashCode() : 0);
+return result;
+  }
+
+  public String getStackId() {
+return stackId;
+  }
+
+  public void setStackId(String stackId) {
+this.stackId = stackId;
+  }
+
+  public String getRepositoryVersion() {
+return repositoryVersion;
+  }
+
+  public void setRepositoryVersion(String repositoryVersion) {
+this.repositoryVersion = repositoryVersion;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/b45710fb/ambari-server/src/main/java/org/apache/ambari/server/topology/SecurityConfiguration.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/SecurityConfiguration.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/SecurityConfiguration.java
index 4ff5504..7955169 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/SecurityConfiguration.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/SecurityConfiguration.java
@@ -21,6 +21,9 @@ package org.apache.ambari.server.topology;
 
 import org.apache.ambari.server.state.SecurityType;
 
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
 /**
  * Holds security related properties, the securityType and security descriptor 
(in case of KERBEROS
  * kerberos_descriptor) either contains the whole descriptor or just the 
reference to it.
@@ -43,7 +46,9 @@ public class SecurityConfiguration {
*/
   private String descriptor;
 
-  public SecurityConfiguration(SecurityType type) {
+
+  @JsonCreator
+  public SecurityConfiguration(@JsonProperty("type") SecurityType type) {
 this.type = type;
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/b45710fb/ambari-server/src/main/java/org/apache/ambari/server/topology/Service.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/Service.java 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/Service.java
index 62acdfd..1dde7ea 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/Service.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/Service.java
@@ -21,42 +21,19 @@ package org.apache.ambari.server.topology;
 
 import java.util.Set;
 
-import 

[2/2] ambari git commit: Blueprint V2 data model (benyoka)

2017-10-18 Thread benyoka
Blueprint V2 data model (benyoka)


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

Branch: refs/heads/branch-feature-AMBARI-14714-tmp-bence
Commit: b45710fb2248df539017ca2963c36c39baf24dea
Parents: 5ddb07c
Author: Balazs Bence Sari <beny...@apache.org>
Authored: Wed Oct 18 17:39:59 2017 +0200
Committer: Balazs Bence Sari <beny...@apache.org>
Committed: Wed Oct 18 17:39:59 2017 +0200

--
 .../ambari/server/controller/StackV2.java   | 417 +--
 .../server/controller/StackV2Factory.java   | 219 ++
 .../ambari/server/orm/dao/BlueprintV2DAO.java   | 136 ++
 .../server/orm/entities/BlueprintEntity.java|   1 -
 .../server/orm/entities/BlueprintV2Entity.java  | 119 ++
 .../orm/entities/HostGroupComponentEntity.java  |  17 +-
 .../ambari/server/orm/entities/StackEntity.java |  11 +-
 .../ambari/server/topology/BlueprintImplV2.java | 242 +--
 .../ambari/server/topology/BlueprintV2.java |  58 +--
 .../server/topology/BlueprintV2Factory.java | 170 
 .../server/topology/BlueprintValidatorV2.java   |  43 ++
 .../ambari/server/topology/ComponentV2.java |  85 +++-
 .../ambari/server/topology/Configurable.java|  40 ++
 .../ambari/server/topology/Configuration.java   |   7 +
 .../ambari/server/topology/HostGroupImpl.java   |   2 -
 .../ambari/server/topology/HostGroupV2.java |  15 +-
 .../ambari/server/topology/HostGroupV2Impl.java | 124 ++
 .../server/topology/RepositoryVersion.java  |  71 
 .../server/topology/SecurityConfiguration.java  |   7 +-
 .../apache/ambari/server/topology/Service.java  |  82 ++--
 .../ambari/server/topology/ServiceGroup.java|  41 +-
 .../ambari/server/topology/ServiceId.java   |  52 +++
 .../validators/BlueprintImplV2Test.java |   9 +
 23 files changed, 1513 insertions(+), 455 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/b45710fb/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2.java 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2.java
index 8a2208d..6f0b606 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2.java
@@ -25,10 +25,7 @@ import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.ambari.server.AmbariException;
-import org.apache.ambari.server.orm.entities.StackEntity;
 import org.apache.ambari.server.state.AutoDeployInfo;
-import org.apache.ambari.server.state.ComponentInfo;
 import org.apache.ambari.server.state.DependencyInfo;
 import org.apache.ambari.server.state.PropertyDependencyInfo;
 import org.apache.ambari.server.state.PropertyInfo;
@@ -40,43 +37,27 @@ import org.apache.ambari.server.topology.Configuration;
  * Encapsulates stack information.
  */
 public class StackV2 {
-  /**
-   * Stack name
-   */
-  private String name;
 
-  /**
-   * Stack version
-   */
-  private String version;
+  /** Stack name */
+  private final String name;
 
-/**
- * Repo version
-   */
-  private String repoVersion;
+  /** Stack version */
+  private final String version;
 
-  /**
-   * Map of service name to components
-   */
-  private Map<String, Collection> serviceComponents =
-new HashMap<>();
+  /** Repo version */
+  private final String repoVersion;
 
-  /**
-   * Map of component to service
-   */
-  private Map<String, String> componentService = new HashMap<>();
+  /** Map of service name to components */
+  private final Map<String, Collection> serviceComponents;
 
-  /**
-   * Map of component to dependencies
-   */
-  private Map<String, Collection> dependencies =
-new HashMap<>();
+  /** Map of component to service */
+  private final Map<String, String> componentService;
 
-  /**
-   * Map of dependency to conditional service
-   */
-  private Map<DependencyInfo, String> dependencyConditionalServiceMap =
-new HashMap<>();
+  /** Map of component to dependencies */
+  private final Map<String, Collection> dependencies;
+
+  /** Map of dependency to conditional service */
+  private final Map<DependencyInfo, String> dependencyConditionalServiceMap;
 
   /**
* Map of database component name to configuration property which indicates 
whether
@@ -84,129 +65,87 @@ public class StackV2 {
* If the value of the config property starts with

ambari git commit: AMBARI-22297 Enrich deserialized v2 blueprint (benyoka)

2017-10-24 Thread benyoka
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-14714 f50d9a2aa -> acab46dc6


AMBARI-22297 Enrich deserialized v2 blueprint (benyoka)


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

Branch: refs/heads/branch-feature-AMBARI-14714
Commit: acab46dc626d7eef9fdf610c8379b34645bcd758
Parents: f50d9a2
Author: Balazs Bence Sari <beny...@apache.org>
Authored: Tue Oct 24 13:52:46 2017 +0200
Committer: Balazs Bence Sari <beny...@apache.org>
Committed: Tue Oct 24 13:52:46 2017 +0200

--
 .../StackAdvisorBlueprintProcessor.java |2 +-
 .../ambari/server/controller/StackV2.java   | 1029 +-
 .../ambari/server/topology/BlueprintImplV2.java |  211 ++--
 .../ambari/server/topology/BlueprintV2.java |8 +-
 .../server/topology/BlueprintV2Factory.java |2 +
 .../ambari/server/topology/ComponentV2.java |9 +-
 .../ambari/server/topology/HostGroupV2.java |9 +-
 .../ambari/server/topology/HostGroupV2Impl.java |   37 +-
 .../apache/ambari/server/topology/Service.java  |   58 +-
 .../ambari/server/topology/ServiceGroup.java|   28 +-
 .../ambari/server/topology/ServiceId.java   |   10 +
 .../apache/ambari/server/topology/Setting.java  |   18 +-
 .../validators/BlueprintImplV2Test.java |   11 +
 .../test/resources/blueprintv2/blueprintv2.json |   24 +-
 14 files changed, 800 insertions(+), 656 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/acab46dc/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java
index 2e9ac9f..9bbdc37 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java
@@ -117,7 +117,7 @@ public class StackAdvisorBlueprintProcessor {
 
   private Map<String, Set> gatherHostGroupComponents(ClusterTopology 
clusterTopology) {
 Map<String, Set> hgComponentsMap = Maps.newHashMap();
-for (Map.Entry<String, HostGroupV2> hgEnrty: 
clusterTopology.getBlueprint().getHostGroups().entrySet()) {
+for (Map.Entry<String, ? extends HostGroupV2> hgEnrty: 
clusterTopology.getBlueprint().getHostGroups().entrySet()) {
   hgComponentsMap.put(hgEnrty.getKey(), 
Sets.newCopyOnWriteArraySet(hgEnrty.getValue().getComponentNames()));
 }
 return hgComponentsMap;

http://git-wip-us.apache.org/repos/asf/ambari/blob/acab46dc/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2.java 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2.java
index 169bf6a..040e604 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2.java
@@ -7,7 +7,7 @@
  * "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
+ *   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,
@@ -30,6 +30,7 @@ import org.apache.ambari.server.state.ComponentInfo;
 import org.apache.ambari.server.state.DependencyInfo;
 import org.apache.ambari.server.state.PropertyDependencyInfo;
 import org.apache.ambari.server.state.PropertyInfo;
+import org.apache.ambari.server.state.StackId;
 import org.apache.ambari.server.state.ValueAttributesInfo;
 import org.apache.ambari.server.topology.Cardinality;
 import org.apache.ambari.server.topology.Configuration;
@@ -39,568 +40,572 @@ import org.apache.ambari.server.topology.Configuration;
  */
 public class StackV2 {
 
-/** Stack name */
-private final String name;
-
-/** Stack version */
-private final String version;
-
-/** Repo version */
-private final String repoVersion;
-
-/** Map of service name to components */
-private final Map<Stri

ambari git commit: AMBARI-22325 Yet another fix for v2 blueprint json serialization/deserialization (benyoka)

2017-11-13 Thread benyoka
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-14714-blueprintv2 4b6c98401 -> 5574443c7


AMBARI-22325 Yet another fix for v2 blueprint json 
serialization/deserialization (benyoka)


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

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 5574443c7a45015f78859b0f150bdb15523a9b0d
Parents: 4b6c984
Author: Balazs Bence Sari <beny...@apache.org>
Authored: Mon Nov 13 11:20:21 2017 +0100
Committer: Balazs Bence Sari <beny...@apache.org>
Committed: Mon Nov 13 11:20:35 2017 +0100

--
 .../src/main/java/org/apache/ambari/server/topology/Service.java| 1 +
 .../ambari/server/topology/validators/BlueprintImplV2Test.java  | 1 +
 2 files changed, 2 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/5574443c/ambari-server/src/main/java/org/apache/ambari/server/topology/Service.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/Service.java 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/Service.java
index 7c5ee42..90b4764 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/Service.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/Service.java
@@ -165,6 +165,7 @@ public class Service implements Configurable {
   '}';
   }
 
+  @JsonIgnore
   public String getServiceGroupName() {
 if (serviceGroup != null) {
   return serviceGroup.getName();

http://git-wip-us.apache.org/repos/asf/ambari/blob/5574443c/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/BlueprintImplV2Test.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/BlueprintImplV2Test.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/BlueprintImplV2Test.java
index 99acfb7..611ada1 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/BlueprintImplV2Test.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/BlueprintImplV2Test.java
@@ -97,6 +97,7 @@ public class BlueprintImplV2Test {
 String bpSerialized = bpFactory.convertToJson(bp);
 System.out.println(bpSerialized);
 bp = (BlueprintImplV2)bpFactory.convertFromJson(bpSerialized);
+System.out.println(bp);
   }
 
 



ambari git commit: AMBARI-22325 Improve exception handling (benyoka)

2017-11-28 Thread benyoka
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-14714-blueprintv2 60169350a -> 87a7d61fe


AMBARI-22325 Improve exception handling (benyoka)


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

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 87a7d61fe9f67b7102bbc955c3a8950cbe57fecc
Parents: 6016935
Author: Balazs Bence Sari <beny...@apache.org>
Authored: Tue Nov 28 14:32:19 2017 +0100
Committer: Balazs Bence Sari <beny...@apache.org>
Committed: Tue Nov 28 14:34:59 2017 +0100

--
 .../ambari/server/ObjectNotFoundException.java  |  2 +-
 .../server/ParentObjectNotFoundException.java   |  2 +-
 .../ambari/server/StackAccessException.java | 18 +++-
 .../server/api/services/AmbariMetaInfo.java | 89 +++-
 .../AmbariManagementControllerImpl.java | 32 +--
 .../server/controller/StackV2Factory.java   |  8 +-
 .../server/topology/BlueprintV2Factory.java |  5 +-
 .../ambari/server/StackAccessExceptionTest.java | 57 +
 8 files changed, 159 insertions(+), 54 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/87a7d61f/ambari-server/src/main/java/org/apache/ambari/server/ObjectNotFoundException.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ObjectNotFoundException.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ObjectNotFoundException.java
index 75c9f3b..62fa788 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ObjectNotFoundException.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ObjectNotFoundException.java
@@ -28,7 +28,7 @@ public class ObjectNotFoundException extends AmbariException {
* @param cause  the root cause
*/
   public ObjectNotFoundException(String msg, ObjectNotFoundException cause) {
-super(msg + ".  " + cause.getMessage(), cause);
+super(msg + ". " + cause.getMessage(), cause);
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/87a7d61f/ambari-server/src/main/java/org/apache/ambari/server/ParentObjectNotFoundException.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ParentObjectNotFoundException.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ParentObjectNotFoundException.java
index 15bd7cb..1613b84 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/ParentObjectNotFoundException.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ParentObjectNotFoundException.java
@@ -30,7 +30,7 @@ public class ParentObjectNotFoundException extends 
ObjectNotFoundException {
* @param cause  the root cause
*/
   public ParentObjectNotFoundException(String msg, ObjectNotFoundException 
cause) {
-super(msg + ".  " + cause.getMessage(), cause);
+super(msg, cause);
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/87a7d61f/ambari-server/src/main/java/org/apache/ambari/server/StackAccessException.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/StackAccessException.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/StackAccessException.java
index b8bfff3..924617f 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/StackAccessException.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/StackAccessException.java
@@ -22,6 +22,22 @@ package org.apache.ambari.server;
 public class StackAccessException extends ObjectNotFoundException {
 
   public StackAccessException(String message) {
-super("Stack data, " + message);
+super(message);
   }
+
+  public StackAccessException(String... messageAttributes) {
+super(buildMessage(messageAttributes));
+  }
+
+  private static String buildMessage(String... messageAttributes) {
+StringBuilder bld = new StringBuilder("Stack data");
+boolean even = true;
+for (String messageAttribute: messageAttributes) {
+  bld.append(even ? ", " : "=");
+  bld.append(messageAttribute);
+  even = !even;
+}
+return bld.toString();
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/87a7d61f/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
 
b/

ambari git commit: AMBARI-22325 Fix build errors (benyoka)

2017-11-24 Thread benyoka
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-14714-blueprintv2 c0eaadd60 -> ad69a3478


AMBARI-22325 Fix build errors (benyoka)


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

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: ad69a3478091f7b8afbeadaee89743a21699714d
Parents: c0eaadd
Author: Balazs Bence Sari <beny...@apache.org>
Authored: Fri Nov 24 12:23:46 2017 +0100
Committer: Balazs Bence Sari <beny...@apache.org>
Committed: Fri Nov 24 12:24:08 2017 +0100

--
 .../apache/ambari/server/topology/SecurityConfiguration.java| 4 ++--
 .../ambari/server/topology/SecurityConfigurationTest.java   | 5 +++--
 .../ambari/server/topology/TopologyTemplateFactoryTest.java | 3 ---
 3 files changed, 5 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/ad69a347/ambari-server/src/main/java/org/apache/ambari/server/topology/SecurityConfiguration.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/SecurityConfiguration.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/SecurityConfiguration.java
index 864e802..00ad10b 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/SecurityConfiguration.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/SecurityConfiguration.java
@@ -22,12 +22,12 @@ package org.apache.ambari.server.topology;
 import java.io.IOException;
 import java.util.Map;
 
-import com.fasterxml.jackson.annotation.JsonIgnore;
 import org.apache.ambari.server.state.SecurityType;
 
 import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.fasterxml.jackson.annotation.JsonProperty;
-import org.codehaus.jackson.map.ObjectMapper;
+import com.fasterxml.jackson.databind.ObjectMapper;
 
 /**
  * Holds security related properties, the securityType and security descriptor 
(in case of KERBEROS

http://git-wip-us.apache.org/repos/asf/ambari/blob/ad69a347/ambari-server/src/test/java/org/apache/ambari/server/topology/SecurityConfigurationTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/SecurityConfigurationTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/SecurityConfigurationTest.java
index 4af0806..1e49a97 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/SecurityConfigurationTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/SecurityConfigurationTest.java
@@ -21,11 +21,12 @@ import static org.junit.Assert.assertEquals;
 
 import java.util.Map;
 
+import org.apache.ambari.server.utils.ResourceUtils;
+import org.junit.Test;
+
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
-import org.apache.ambari.server.utils.ResourceUtils;
-import org.junit.Test;
 
 public class SecurityConfigurationTest {
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/ad69a347/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyTemplateFactoryTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyTemplateFactoryTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyTemplateFactoryTest.java
index 7efbbd6..67c6590 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyTemplateFactoryTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyTemplateFactoryTest.java
@@ -23,17 +23,14 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 
-import java.io.IOException;
 import java.util.Map;
 
 import org.apache.ambari.server.state.SecurityType;
 import org.apache.ambari.server.utils.ResourceUtils;
 import org.junit.Test;
 
-import com.google.common.base.Charsets;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
-import com.google.common.io.Resources;
 
 public class TopologyTemplateFactoryTest {
 



ambari git commit: AMBARI-22325 SecurityConfigurationTest, small refactors (benyoka)

2017-11-23 Thread benyoka
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-14714-blueprintv2 45ac9fabd -> c0eaadd60


AMBARI-22325 SecurityConfigurationTest, small refactors (benyoka)


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

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: c0eaadd6005151e8f9c87b14c7ee109b4660fe98
Parents: 45ac9fa
Author: Balazs Bence Sari <beny...@apache.org>
Authored: Thu Nov 23 18:08:38 2017 +0100
Committer: Balazs Bence Sari <beny...@apache.org>
Committed: Thu Nov 23 18:10:33 2017 +0100

--
 .../server/topology/SecurityConfiguration.java  | 24 +++
 .../server/topology/ConfigurableTest.java   | 17 +
 .../topology/SecurityConfigurationTest.java | 71 
 .../server/topology/TopologyManagerTest.java|  1 -
 .../topology/TopologyTemplateFactoryTest.java   | 20 +++---
 .../ambari/server/utils/ResourceUtils.java  | 34 ++
 .../blueprintv2/cluster_template_v2.json| 58 +++-
 .../resources/blueprintv2/security_config.json  | 58 
 8 files changed, 270 insertions(+), 13 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/c0eaadd6/ambari-server/src/main/java/org/apache/ambari/server/topology/SecurityConfiguration.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/SecurityConfiguration.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/SecurityConfiguration.java
index 7a8b8a9..864e802 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/SecurityConfiguration.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/SecurityConfiguration.java
@@ -19,10 +19,15 @@
 
 package org.apache.ambari.server.topology;
 
+import java.io.IOException;
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
 import org.apache.ambari.server.state.SecurityType;
 
 import com.fasterxml.jackson.annotation.JsonCreator;
 import com.fasterxml.jackson.annotation.JsonProperty;
+import org.codehaus.jackson.map.ObjectMapper;
 
 /**
  * Holds security related properties, the securityType and security descriptor 
(in case of KERBEROS
@@ -36,16 +41,19 @@ public class SecurityConfiguration {
   /**
* Security Type
*/
+  @JsonProperty("type")
   private SecurityType type;
 
   /**
* Holds a reference to a kerberos_descriptor resource.
*/
+  @JsonProperty("kerberos_descriptor_reference")
   private String descriptorReference;
 
   /**
* Content of a kerberos_descriptor as String.
*/
+  @JsonProperty("kerberos_descriptor")
   private String descriptor;
 
 
@@ -64,6 +72,7 @@ public class SecurityConfiguration {
 return type;
   }
 
+  @JsonIgnore
   public String getDescriptor() {
 return descriptor;
   }
@@ -71,4 +80,19 @@ public class SecurityConfiguration {
   public String getDescriptorReference() {
 return descriptorReference;
   }
+
+  public void setDescriptorReference(String descriptorReference) {
+this.descriptorReference = descriptorReference;
+  }
+
+  @JsonIgnore
+  public void setDescriptor(String descriptor) {
+this.descriptor = descriptor;
+  }
+
+  @JsonProperty("kerberos_descriptor")
+  public void setKerberosDescriptorFromJson(Map<String, ?> kerberosDescriptor) 
throws IOException {
+setDescriptor(new ObjectMapper().writeValueAsString(kerberosDescriptor));
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/c0eaadd6/ambari-server/src/test/java/org/apache/ambari/server/topology/ConfigurableTest.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/ConfigurableTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/ConfigurableTest.java
index 2c74dc5..080438d 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/ConfigurableTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/ConfigurableTest.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/LICENS

ambari git commit: AMBARI-22325 Revert adding repo_version column for stack table (benyoka)

2017-12-18 Thread benyoka
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-14714 09724a276 -> 57051fa38


AMBARI-22325 Revert adding repo_version column for stack table (benyoka)


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

Branch: refs/heads/branch-feature-AMBARI-14714
Commit: 57051fa38be48a21e1dba8988a5456697ed6e044
Parents: 09724a2
Author: Balazs Bence Sari <beny...@apache.org>
Authored: Mon Dec 18 13:01:37 2017 +0100
Committer: Balazs Bence Sari <beny...@apache.org>
Committed: Mon Dec 18 13:01:56 2017 +0100

--
 .../ambari/server/orm/entities/StackEntity.java   | 11 ---
 .../apache/ambari/server/stack/StackManager.java  |  3 ---
 .../main/resources/Ambari-DDL-Derby-CREATE.sql|  1 -
 .../main/resources/Ambari-DDL-MySQL-CREATE.sql|  1 -
 .../main/resources/Ambari-DDL-Oracle-CREATE.sql   |  1 -
 .../main/resources/Ambari-DDL-Postgres-CREATE.sql |  1 -
 .../resources/Ambari-DDL-SQLAnywhere-CREATE.sql   |  1 -
 .../resources/Ambari-DDL-SQLServer-CREATE.sql |  1 -
 .../RepositoryVersionResourceProviderTest.java|  1 -
 .../apache/ambari/server/orm/OrmTestHelper.java   | 18 +-
 .../server/state/cluster/ClusterImplTest.java |  6 +++---
 .../ambari/server/state/cluster/ClustersTest.java | 10 +-
 .../ConcurrentServiceConfigVersionTest.java   |  2 +-
 ...eComponentHostConcurrentWriteDeadlockTest.java |  2 +-
 .../svccomphost/ServiceComponentHostTest.java |  2 +-
 15 files changed, 12 insertions(+), 49 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/57051fa3/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StackEntity.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StackEntity.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StackEntity.java
index c479cdd..e804797 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StackEntity.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StackEntity.java
@@ -60,9 +60,6 @@ public class StackEntity {
   @Column(name = "stack_version", length = 255, nullable = false)
   private String stackVersion;
 
-  @Column(name = "repo_version", length = 255, nullable = false)
-  private String repoVersion;
-
   @Column(name = "current_mpack_id")
   private Long currentMpackId;
 
@@ -128,14 +125,6 @@ public class StackEntity {
 this.stackVersion = stackVersion;
   }
 
-  public String getRepoVersion() {
-return repoVersion;
-  }
-
-  public void setRepoVersion(String repoVersion) {
-this.repoVersion = repoVersion;
-  }
-
   /**
*
*/

http://git-wip-us.apache.org/repos/asf/ambari/blob/57051fa3/ambari-server/src/main/java/org/apache/ambari/server/stack/StackManager.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/stack/StackManager.java 
b/ambari-server/src/main/java/org/apache/ambari/server/stack/StackManager.java
index dc77f19..fc49a24 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/stack/StackManager.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/stack/StackManager.java
@@ -307,9 +307,6 @@ public class StackManager {
 stackEntity.setStackName(stackName);
 stackEntity.setStackVersion(stackVersion);
 
-//TODO this is hack which should be removed during merge with BP branch
-stackEntity.setRepoVersion("");
-
 stackDao.create(stackEntity);
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/57051fa3/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 84349b6..4cef9da 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
@@ -39,7 +39,6 @@ CREATE TABLE stack (
   stack_id BIGINT NOT NULL,
   stack_name VARCHAR(255) NOT NULL,
   stack_version VARCHAR(255) NOT NULL,
-  repo_version VARCHAR(255) NOT NULL,
   current_mpack_id BIGINT,
   CONSTRAINT PK_stack PRIMARY KEY (stack_id),
   CONSTRAINT FK_mpacks FOREIGN KEY (current_mpack_id) REFERENCES mpacks(id),

http://git-wip-us.apache.org/repos/asf/ambari/blob/57051fa3/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
--

ambari git commit: AMBARI-22325 Cluster template object initial version (benyoka)

2017-11-17 Thread benyoka
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-14714-blueprintv2 b91ad4867 -> cf82733b8


AMBARI-22325 Cluster template object initial version (benyoka)


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

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: cf82733b81eec8d5b141508fa35149c923b1b7b3
Parents: b91ad48
Author: Balazs Bence Sari <beny...@apache.org>
Authored: Fri Nov 17 22:20:20 2017 +0100
Committer: Balazs Bence Sari <beny...@apache.org>
Committed: Fri Nov 17 22:21:27 2017 +0100

--
 .../server/topology/BlueprintV2Factory.java |  53 ++---
 .../ambari/server/topology/Credential.java  |   8 +-
 .../topology/ProvisionClusterTemplate.java  | 198 +++
 .../ProvisionClusterTemplateFactory.java|  48 +
 .../server/topology/BlueprintImplV2Test.java| 173 
 .../topology/ProvisionClusterTemplateTest.java  |  30 +++
 .../validators/BlueprintImplV2Test.java | 175 
 .../blueprintv2/cluster_template_v2.json|  66 +++
 8 files changed, 552 insertions(+), 199 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/cf82733b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
index e16ba86..3262c54 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
@@ -56,33 +56,35 @@ public class BlueprintV2Factory {
 
   // Host Groups
   protected static final String HOST_GROUP_PROPERTY_ID = "host_groups";
-  protected static final String HOST_GROUP_NAME_PROPERTY_ID = "name";
-  protected static final String HOST_GROUP_CARDINALITY_PROPERTY_ID = 
"cardinality";
+//  protected static final String HOST_GROUP_NAME_PROPERTY_ID = "name";
+//  protected static final String HOST_GROUP_CARDINALITY_PROPERTY_ID = 
"cardinality";
 
   // Host Group Components
-  protected static final String COMPONENT_PROPERTY_ID ="components";
+//  protected static final String COMPONENT_PROPERTY_ID ="components";
   protected static final String COMPONENT_NAME_PROPERTY_ID ="name";
-  protected static final String COMPONENT_PROVISION_ACTION_PROPERTY_ID = 
"provision_action";
+//  protected static final String COMPONENT_PROVISION_ACTION_PROPERTY_ID = 
"provision_action";
 
   // Configurations
-  protected static final String CONFIGURATION_PROPERTY_ID = "configurations";
+//  protected static final String CONFIGURATION_PROPERTY_ID = "configurations";
   protected static final String PROPERTIES_PROPERTY_ID = "properties";
-  protected static final String PROPERTIES_ATTRIBUTES_PROPERTY_ID = 
"properties_attributes";
+//  protected static final String PROPERTIES_ATTRIBUTES_PROPERTY_ID = 
"properties_attributes";
 
-  protected static final String SETTINGS_PROPERTY_ID = "settings";
+//  protected static final String SETTINGS_PROPERTY_ID = "settings";
 
-  private boolean prettyPrintJson = false;
   private static BlueprintV2DAO blueprintDAO;
   private static RepositoryVersionDAO repositoryVersionDAO;
 
   private StackV2Factory stackFactory;
 
-  protected BlueprintV2Factory() {
+  private ObjectMapper objectMapper;
 
+  protected BlueprintV2Factory() {
+createObjectMapper();
   }
 
   protected BlueprintV2Factory(StackV2Factory stackFactory) {
 this.stackFactory = stackFactory;
+createObjectMapper();
   }
 
   public static BlueprintV2Factory create(AmbariManagementController 
controller) {
@@ -100,7 +102,7 @@ public class BlueprintV2Factory {
   }
 
   public BlueprintV2 convertFromJson(String json) throws IOException {
-BlueprintImplV2 blueprintV2 = createObjectMapper().readValue(json, 
BlueprintImplV2.class);
+BlueprintImplV2 blueprintV2 = getObjectMapper().readValue(json, 
BlueprintImplV2.class);
 blueprintV2.postDeserialization();
 updateStacks(blueprintV2);
 return blueprintV2;
@@ -119,7 +121,7 @@ public class BlueprintV2Factory {
   }
 
   public Map<String, Object> convertToMap(BlueprintV2Entity entity) throws 
IOException {
-return createObjectMapper().readValue(entity.getContent(), new 
TypeReference<

ambari git commit: AMBARI-22325 Fix dependency injection in BaseClusterRequest (benyoka)

2017-11-13 Thread benyoka
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-14714-blueprintv2 a9b1f8704 -> c54a6b4ea


AMBARI-22325 Fix dependency injection in BaseClusterRequest (benyoka)


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

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: c54a6b4eaec9da12babdfe49d3d247fe394e0a01
Parents: a9b1f87
Author: Balazs Bence Sari <beny...@apache.org>
Authored: Mon Nov 13 14:55:16 2017 +0100
Committer: Balazs Bence Sari <beny...@apache.org>
Committed: Mon Nov 13 14:58:02 2017 +0100

--
 .../org/apache/ambari/server/controller/AmbariServer.java   | 2 +-
 .../server/controller/internal/BaseClusterRequest.java  | 9 +++--
 .../apache/ambari/server/topology/BlueprintV2Factory.java   | 1 +
 3 files changed, 5 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/c54a6b4e/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 b28cb11..970fb56 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
@@ -934,7 +934,7 @@ public class AmbariServer {
 
HostResourceProvider.setTopologyManager(injector.getInstance(TopologyManager.class));
 BlueprintFactory.init(injector.getInstance(BlueprintDAO.class));
 BlueprintV2Factory.init(injector.getInstance(BlueprintV2DAO.class));
-BaseClusterRequest.init(injector.getInstance(BlueprintV2Factory.class));
+
BaseClusterRequest.init(injector.getInstance(AmbariManagementController.class));
 AmbariContext.init(injector.getInstance(HostRoleCommandFactory.class));
 
 PermissionResourceProvider.init(injector.getInstance(PermissionDAO.class));

http://git-wip-us.apache.org/repos/asf/ambari/blob/c54a6b4e/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BaseClusterRequest.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BaseClusterRequest.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BaseClusterRequest.java
index a38f478..eefb31b 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BaseClusterRequest.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BaseClusterRequest.java
@@ -27,6 +27,7 @@ import java.util.Set;
 import org.apache.ambari.server.api.predicate.InvalidQueryException;
 import org.apache.ambari.server.api.predicate.QueryLexer;
 import org.apache.ambari.server.api.predicate.Token;
+import org.apache.ambari.server.controller.AmbariManagementController;
 import org.apache.ambari.server.controller.spi.Resource;
 import org.apache.ambari.server.controller.spi.ResourceProvider;
 import org.apache.ambari.server.controller.utilities.ClusterControllerHelper;
@@ -92,12 +93,8 @@ public abstract class BaseClusterRequest implements 
TopologyRequest {
   private static ResourceProvider hostResourceProvider;
 
 
-  /**
-   * inject blueprint factory
-   * @param factory  blueprint factory
-   */
-  public static void init(BlueprintV2Factory factory) {
-blueprintFactory = factory;
+  public static void init(AmbariManagementController controller) {
+blueprintFactory = BlueprintV2Factory.create(controller);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/c54a6b4e/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
index 9870dcb..47aed80 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
@@ -82,6 +82,7 @@ public class BlueprintV2Factory {
   protected BlueprintV2Factory() {
 
   }
+
   protected BlueprintV2Factory(StackV2Factory stackFactory) {
 this.stackFactory = stackFactory;
   }



ambari git commit: AMBARI-22325 Polish blueprint v2 unit tests (benyoka)

2017-11-13 Thread benyoka
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-14714-blueprintv2 c54a6b4ea -> 7711c51b3


AMBARI-22325 Polish blueprint v2 unit tests (benyoka)


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

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 7711c51b31426a0ce16454b4c7176816056bc928
Parents: c54a6b4
Author: Balazs Bence Sari <beny...@apache.org>
Authored: Mon Nov 13 18:34:02 2017 +0100
Committer: Balazs Bence Sari <beny...@apache.org>
Committed: Mon Nov 13 18:34:13 2017 +0100

--
 .../server/topology/BlueprintV2Factory.java |   2 +-
 .../validators/BlueprintImplV2Test.java | 167 +--
 2 files changed, 120 insertions(+), 49 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/7711c51b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
index 47aed80..fa12173 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
@@ -198,7 +198,7 @@ public class BlueprintV2Factory {
 this.prettyPrintJson = prettyPrintJson;
   }
 
-  ObjectMapper createObjectMapper() {
+  public ObjectMapper createObjectMapper() {
 ObjectMapper mapper = new ObjectMapper();
 SimpleModule module = new SimpleModule("CustomModel", 
Version.unknownVersion());
 SimpleAbstractTypeResolver resolver = new SimpleAbstractTypeResolver();

http://git-wip-us.apache.org/repos/asf/ambari/blob/7711c51b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/BlueprintImplV2Test.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/BlueprintImplV2Test.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/BlueprintImplV2Test.java
index 611ada1..41d1ca8 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/BlueprintImplV2Test.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/BlueprintImplV2Test.java
@@ -17,30 +17,28 @@
  */
 package org.apache.ambari.server.topology.validators;
 
-import static org.mockito.Mockito.anyString;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Matchers.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
+import com.google.common.base.Preconditions;
+import com.google.common.collect.ImmutableList;
 import org.apache.ambari.server.controller.StackV2;
 import org.apache.ambari.server.controller.StackV2Factory;
 import org.apache.ambari.server.state.StackId;
-import org.apache.ambari.server.topology.BlueprintImplV2;
+import org.apache.ambari.server.topology.BlueprintV2;
 import org.apache.ambari.server.topology.BlueprintV2Factory;
-import org.apache.ambari.server.topology.HostGroupV2;
-import org.apache.ambari.server.topology.HostGroupV2Impl;
+import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-import com.fasterxml.jackson.core.Version;
 import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
-import com.fasterxml.jackson.databind.module.SimpleAbstractTypeResolver;
-import com.fasterxml.jackson.databind.module.SimpleModule;
 import com.google.common.base.Charsets;
-import com.google.common.collect.ImmutableMap;
 import com.google.common.io.Resources;
 
 public class BlueprintImplV2Test {
@@ -48,6 +46,7 @@ public class BlueprintImplV2Test {
   static String BLUEPRINTV2_JSON;
   static String BLUEPRINTV2_2_JSON;
 
+  BlueprintV2Factory blueprintFactory;
 
   @BeforeClass
   public static void setUpClass() throws Exception {
@@ -55,50 +54,122 @@ public class BlueprintImplV2Test {
 BLUEPRINTV2_2_JSON = 
Resources.toString(Resources.getResource("blueprintv2/blueprintv2_2.json"), 
Charsets.UTF_8);
   }
 
+  @Before
+  public void setUp() throws Exception {
+StackV2Factory stackFactory = mock(StackV2Factory.class);
+when(stackFactory.create(any(StackId.class))).thenAnswer(invocation -> {
+  StackId stackId = invocation.getArgumentAt(0, StackId.class);
+  StackV2 st

[13/17] ambari git commit: AMBARI-22325. Fix impossible equality: ComponentV2 vs ProvisionAction (adoroszlai)

2017-11-14 Thread benyoka
AMBARI-22325. Fix impossible equality: ComponentV2 vs ProvisionAction 
(adoroszlai)


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

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: bc08e246d3bb5bc47d21b7801872dfa94d6b449e
Parents: ceeb382
Author: Attila Doroszlai 
Authored: Mon Nov 13 10:32:43 2017 +0100
Committer: Balazs Bence Sari 
Committed: Tue Nov 14 11:31:16 2017 +0100

--
 .../ambari/server/topology/HostGroupV2Impl.java | 33 +++-
 1 file changed, 12 insertions(+), 21 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/bc08e246/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroupV2Impl.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroupV2Impl.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroupV2Impl.java
index dd7a316..ff82ecf 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroupV2Impl.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroupV2Impl.java
@@ -17,23 +17,18 @@
  */
 package org.apache.ambari.server.topology;
 
+import static java.util.stream.Collectors.toList;
+
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.stream.Collectors;
 
-import javax.annotation.Nullable;
-
 import org.apache.ambari.server.controller.internal.ProvisionAction;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.google.common.base.Function;
 import com.google.common.base.Preconditions;
-import com.google.common.base.Predicates;
-import com.google.common.collect.Collections2;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
 
 public class HostGroupV2Impl implements HostGroupV2, Configurable {
 
@@ -73,22 +68,18 @@ public class HostGroupV2Impl implements HostGroupV2, 
Configurable {
   @Override
   @JsonIgnore
   public Collection getComponentNames() {
-return getComponentNames(components);
-  }
-
-  private Collection getComponentNames(List components) {
-return Lists.transform(components,
-  new Function() {
-@Override public String apply(@Nullable ComponentV2 input) { return 
input.getName(); }
-  });
+return components.stream()
+  .map(ComponentV2::getName)
+  .collect(toList());
   }
 
   @Override
   @JsonIgnore
   public Collection getComponentNames(ProvisionAction provisionAction) 
{
-List filtered =
-  ImmutableList.copyOf(Collections2.filter(components, 
Predicates.equalTo(provisionAction)));
-return getComponentNames(filtered);
+return components.stream()
+  .filter(c -> c.getProvisionAction().equals(provisionAction))
+  .map(ComponentV2::getName)
+  .collect(toList());
   }
 
   @Override
@@ -98,7 +89,7 @@ public class HostGroupV2Impl implements HostGroupV2, 
Configurable {
 
   @Override
   public Collection getComponentsByServiceId(ServiceId serviceId) 
{
-return components.stream().filter(c -> 
c.getServiceId().equals(serviceId)).collect(Collectors.toList());
+return components.stream().filter(c -> 
c.getServiceId().equals(serviceId)).collect(toList());
   }
 
   @Override
@@ -128,13 +119,13 @@ public class HostGroupV2Impl implements HostGroupV2, 
Configurable {
   @Override
   @JsonIgnore
   public Collection getServiceNames() {
-return 
serviceMap.values().stream().map(Service::getName).collect(Collectors.toList());
+return 
serviceMap.values().stream().map(Service::getName).collect(toList());
   }
 
   @JsonIgnore
   public void setServiceMap(Map serviceMap) {
 Preconditions.checkArgument(serviceMap.keySet().equals(this.serviceIds),
-  "Maitained list of service ids doesn't match with received service map: 
%s vs %s", serviceIds, serviceMap.keySet());
+  "Maintained list of service ids doesn't match with received service map: 
%s vs %s", serviceIds, serviceMap.keySet());
 this.serviceMap = serviceMap;
   }
 



[11/17] ambari git commit: AMBARI-22325 Fixes for v2 blueprint json serialization/deserialization (benyoka)

2017-11-14 Thread benyoka
AMBARI-22325 Fixes for v2 blueprint json serialization/deserialization (benyoka)


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

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 57bef16ce0b9326e93a343e4f167e215ea50169c
Parents: 35d704c
Author: Balazs Bence Sari <beny...@apache.org>
Authored: Mon Nov 6 11:18:55 2017 +0100
Committer: Balazs Bence Sari <beny...@apache.org>
Committed: Tue Nov 14 11:31:15 2017 +0100

--
 .../ambari/server/controller/AmbariServer.java  |   1 +
 .../ambari/server/topology/BlueprintImplV2.java |  24 +++-
 .../server/topology/BlueprintV2Factory.java |  29 +++-
 .../ambari/server/topology/ComponentV2.java |   5 +
 .../ambari/server/topology/Configurable.java|  25 +++-
 .../ambari/server/topology/HostGroupV2Impl.java |   7 +
 .../apache/ambari/server/topology/Service.java  |  15 ++
 .../validators/BlueprintImplV2Test.java |  32 -
 .../resources/blueprintv2/blueprintv2_2.json| 139 +++
 9 files changed, 261 insertions(+), 16 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/57bef16c/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 9bd8dd3..b28cb11 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
@@ -933,6 +933,7 @@ public class AmbariServer {
 .class), injector.getInstance(Gson.class));
 
HostResourceProvider.setTopologyManager(injector.getInstance(TopologyManager.class));
 BlueprintFactory.init(injector.getInstance(BlueprintDAO.class));
+BlueprintV2Factory.init(injector.getInstance(BlueprintV2DAO.class));
 BaseClusterRequest.init(injector.getInstance(BlueprintV2Factory.class));
 AmbariContext.init(injector.getInstance(HostRoleCommandFactory.class));
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/57bef16c/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java
index d31e9d4..d889fc2 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java
@@ -23,6 +23,7 @@ import static java.util.stream.Collectors.toList;
 import static java.util.stream.Collectors.toMap;
 import static java.util.stream.Collectors.toSet;
 
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
@@ -47,7 +48,7 @@ public class BlueprintImplV2 implements BlueprintV2 {
 
   private String name;
   private SecurityConfiguration securityConfiguration;
-  private Collection repositoryVersions;
+  private Collection repositoryVersions = new 
ArrayList<>(0);
   private Map<String, ServiceGroup> serviceGroups;
   private Setting setting;
   private Configuration configuration;
@@ -98,6 +99,11 @@ public class BlueprintImplV2 implements BlueprintV2 {
 this.repositoryVersions = repositoryVersions;
   }
 
+  @JsonProperty("repository_versions")
+  public Collection getRepositoryVersions() {
+return this.repositoryVersions;
+  }
+
   @JsonProperty("service_groups")
   public void setServiceGroups(Collection serviceGroups) {
 this.serviceGroups = serviceGroups.stream().collect(toMap( sg -> 
sg.getName(), sg -> sg ));
@@ -128,17 +134,24 @@ public class BlueprintImplV2 implements BlueprintV2 {
   }
 
   @Override
-  @JsonProperty("host_groups")
+  @JsonIgnore
   public Map<String, ? extends HostGroupV2> getHostGroups() {
 return hostGroupMap;
   }
 
+  @JsonProperty("host_groups")
+  public Collection getHostGroupsForSerialization() {
+return hostGroupMap.values();
+  }
+
   @Override
+  @JsonIgnore
   public Collection getStacks() {
 return stacks.values();
   }
 
   @Override
+  @JsonIgnore
   public Collection getStackIds() {
 return repositoryVersions.stream().map(rv -> 
rv.getStackId()).collect(toList());
   }
@@ -258,11 +271,16 @@ public class BlueprintImplV2 implements Bluepr

[06/17] ambari git commit: AMBARI-22249. Add service group dependencies. Part 2.(vbrodetskyi)

2017-11-14 Thread benyoka
AMBARI-22249. Add service group dependencies. Part 2.(vbrodetskyi)


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

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 6a78e1a1ab5ed046678c9fc4c907ac925cb6bbd5
Parents: 55e450e
Author: Vitaly Brodetskyi 
Authored: Mon Nov 13 18:20:50 2017 +0200
Committer: Vitaly Brodetskyi 
Committed: Mon Nov 13 18:20:50 2017 +0200

--
 .../api/services/ServiceGroupService.java   |  38 +++---
 .../ServiceGroupDependencyRequest.java  |  14 +--
 .../ServiceGroupDependencyResourceProvider.java |  66 +--
 .../ambari/server/orm/dao/ServiceGroupDAO.java  |  35 +-
 .../entities/ServiceGroupDependencyEntity.java  | 111 ++
 .../server/orm/entities/ServiceGroupEntity.java |  31 +++--
 .../org/apache/ambari/server/state/Cluster.java |  26 -
 .../ambari/server/state/ServiceGroup.java   |  12 +-
 .../ambari/server/state/ServiceGroupImpl.java   | 117 ---
 .../server/state/cluster/ClusterImpl.java   |  46 +++-
 .../main/resources/Ambari-DDL-Derby-CREATE.sql  |   8 +-
 .../main/resources/Ambari-DDL-MySQL-CREATE.sql  |   7 +-
 .../main/resources/Ambari-DDL-Oracle-CREATE.sql |   7 +-
 .../resources/Ambari-DDL-Postgres-CREATE.sql|   7 +-
 .../resources/Ambari-DDL-SQLAnywhere-CREATE.sql |   7 +-
 .../resources/Ambari-DDL-SQLServer-CREATE.sql   |   7 +-
 .../src/main/resources/META-INF/persistence.xml |   1 +
 17 files changed, 372 insertions(+), 168 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/6a78e1a1/ambari-server/src/main/java/org/apache/ambari/server/api/services/ServiceGroupService.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ServiceGroupService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ServiceGroupService.java
index 0638a06..ec63aec 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ServiceGroupService.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ServiceGroupService.java
@@ -298,10 +298,10 @@ public class ServiceGroupService extends BaseService {
   responseContainer = RESPONSE_CONTAINER_LIST)
   @ApiImplicitParams({
   @ApiImplicitParam(name = QUERY_FIELDS, value = 
QUERY_FILTER_DESCRIPTION,
-  defaultValue = "ServiceGroupInfo/service_group_name, 
ServiceGroupInfo/cluster_name",
+  defaultValue = 
"ServiceGroupDependencyInfo/dependency_service_group_id, 
ServiceGroupInfo/service_group_name, ServiceGroupInfo/cluster_name",
   dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY),
   @ApiImplicitParam(name = QUERY_SORT, value = QUERY_SORT_DESCRIPTION,
-  defaultValue = "ServiceGroupInfo/service_group_name.asc, 
ServiceGroupInfo/cluster_name.asc",
+  defaultValue = 
"ServiceGroupDependencyInfo/dependency_service_group_id.asc, 
ServiceGroupInfo/service_group_name.asc, ServiceGroupInfo/cluster_name.asc",
   dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY),
   @ApiImplicitParam(name = QUERY_PAGE_SIZE, value = 
QUERY_PAGE_SIZE_DESCRIPTION, defaultValue = DEFAULT_PAGE_SIZE, dataType = 
DATA_TYPE_INT, paramType = PARAM_TYPE_QUERY),
   @ApiImplicitParam(name = QUERY_FROM, value = QUERY_FROM_DESCRIPTION, 
defaultValue = DEFAULT_FROM, dataType = DATA_TYPE_STRING, paramType = 
PARAM_TYPE_QUERY),
@@ -322,14 +322,14 @@ public class ServiceGroupService extends BaseService {
* Handles URL: 
/clusters/{clusterName}/servicegroups/{serviceGroupName}/dependencies/{serviceGroupDependency}
* Get a specific servicegroupdependency.
*
-   * @param headers http headers
-   * @param ui  uri info
-   * @param serviceGroupNameservice group name
-   * @param serviceGroupDependency  service group dependency name
+   * @param headershttp headers
+   * @param ui uri info
+   * @param serviceGroupName   service group name
+   * @param serviceGroupDependencyId   service group dependency id
* @return servicegroupdependencyresource representation
*/
   @GET
-  @Path("{serviceGroupName}/dependencies/{serviceGroupDependency}")
+  @Path("{serviceGroupName}/dependencies/{serviceGroupDependencyId}")
   @Produces(MediaType.TEXT_PLAIN)
   @ApiOperation(value = "Get the details of a servicegroupdependency",
   nickname = 

[01/17] ambari git commit: AMBARI-22355 : New endpoint at ServiceLevel for configurations - POST, GET (mradhakrishnan) [Forced Update!]

2017-11-14 Thread benyoka
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-14714-blueprintv2 7711c51b3 -> 8a5518740 
(forced update)


AMBARI-22355 : New endpoint at ServiceLevel for configurations - POST, GET 
(mradhakrishnan)


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

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 5301b3f5c8d5ab826a89d83968cb64642d8347e9
Parents: 527c4a2
Author: Madhuvanthi Radhakrishnan 
Authored: Wed Nov 8 09:48:20 2017 -0800
Committer: Madhuvanthi Radhakrishnan 
Committed: Wed Nov 8 09:48:20 2017 -0800

--
 .../resources/ServiceResourceDefinition.java|   2 +-
 .../api/services/ConfigurationService.java  |  36 -
 .../server/api/services/ServiceService.java |  13 ++
 .../controller/AmbariManagementController.java  |   2 +-
 .../AmbariManagementControllerImpl.java | 130 +--
 .../server/controller/ConfigurationRequest.java |  40 +-
 .../controller/ConfigurationResponse.java   |  66 ++
 .../internal/ConfigurationResourceProvider.java | 100 --
 .../server/orm/dao/ClusterServiceDAO.java   |  16 +++
 .../orm/entities/ClusterConfigEntity.java   |  11 ++
 .../orm/entities/ClusterServiceEntity.java  |  10 +-
 .../org/apache/ambari/server/state/Cluster.java |  38 ++
 .../ambari/server/state/ConfigFactory.java  |   2 +-
 .../ambari/server/state/ConfigHelper.java   |   4 +-
 .../apache/ambari/server/state/ConfigImpl.java  |  15 ++-
 .../server/state/cluster/ClusterImpl.java   | 112 +++-
 .../state/configgroup/ConfigGroupImpl.java  |   3 +-
 .../server/upgrade/AbstractUpgradeCatalog.java  |   3 +-
 .../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 +
 24 files changed, 546 insertions(+), 69 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/5301b3f5/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ServiceResourceDefinition.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ServiceResourceDefinition.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ServiceResourceDefinition.java
index 0009c70..5f6b6ba 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ServiceResourceDefinition.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ServiceResourceDefinition.java
@@ -54,7 +54,7 @@ public class ServiceResourceDefinition extends 
BaseResourceDefinition {
 subs.add(new SubResourceDefinition(Resource.Type.Alert));
 //todo: dynamic sub-resource definition
 subs.add(new SubResourceDefinition(Resource.Type.Artifact));
-
+subs.add(new SubResourceDefinition(Resource.Type.Configuration));
 return subs;
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/5301b3f5/ambari-server/src/main/java/org/apache/ambari/server/api/services/ConfigurationService.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ConfigurationService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ConfigurationService.java
index 0eb8bd6..79128a2 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ConfigurationService.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ConfigurationService.java
@@ -44,14 +44,38 @@ public class ConfigurationService extends BaseService {
   private String m_clusterName;
 
   /**
+   * Parent service group name.
+   */
+  private String m_serviceGroupName = null;
+
+  /**
+   * Parent service name.
+   */
+  private String m_serviceName = null;
+
+
+  /**
* Constructor.
*
-   * @param clusterName cluster id
+   * @param clusterName cluster name
*/
   public ConfigurationService(String clusterName) {
 m_clusterName = clusterName;
   }
 
+  /**
+   * Constructor.
+   *
+   * @param clusterName cluster name
+   * @param serviceGroupName service group name
+   * @param serviceName service name
+   */
+  public ConfigurationService(String clusterName, String serviceGroupName, 
String serviceName) {
+m_clusterName = clusterName;
+

[12/17] ambari git commit: AMBARI-22325. Set stacks in blueprint (adoroszlai)

2017-11-14 Thread benyoka
AMBARI-22325. Set stacks in blueprint (adoroszlai)


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

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: c9e2f6e6fd808b538c4f1228e14fcd0c219cec62
Parents: 0c5232a
Author: Attila Doroszlai 
Authored: Mon Nov 13 11:24:47 2017 +0100
Committer: Balazs Bence Sari 
Committed: Tue Nov 14 11:31:16 2017 +0100

--
 .../server/controller/StackV2Factory.java   |  3 +--
 .../server/topology/BlueprintV2Factory.java | 23 ++--
 2 files changed, 12 insertions(+), 14 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/c9e2f6e6/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2Factory.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2Factory.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2Factory.java
index 0735171..c7113ae 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2Factory.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2Factory.java
@@ -52,8 +52,7 @@ public class StackV2Factory {
 return create(stack.getStackName(), stack.getStackVersion());
   }
 
-  public StackV2 create(String stackId) throws AmbariException {
-StackId id = new StackId(stackId);
+  public StackV2 create(StackId id) throws AmbariException {
 return create(id.getStackName(), id.getStackVersion());
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/c9e2f6e6/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
index 4f22aea..9870dcb 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
@@ -23,6 +23,7 @@ import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Optional;
+import java.util.function.Function;
 import java.util.stream.Collectors;
 
 import org.apache.ambari.server.AmbariException;
@@ -102,27 +103,29 @@ public class BlueprintV2Factory {
   public BlueprintV2 convertFromJson(String json) throws IOException {
 BlueprintImplV2 blueprintV2 = createObjectMapper().readValue(json, 
BlueprintImplV2.class);
 blueprintV2.postDeserialization();
-blueprintV2.setStacks(
-  blueprintV2.getStackIds().stream().collect(Collectors.toMap(
-StackId::new,
-stackId -> parseStack(new StackId(stackId))
-  ))
-);
+updateStacks(blueprintV2);
 return blueprintV2;
   }
 
+  private void updateStacks(BlueprintImplV2 blueprintV2) {
+Map stacks = blueprintV2.getStackIds().stream()
+  .map(StackId::new)
+  .collect(Collectors.toMap(Function.identity(), this::parseStack));
+blueprintV2.setStacks(stacks);
+  }
 
   public BlueprintV2 convertFromEntity(BlueprintV2Entity blueprintEntity) 
throws IOException {
 return convertFromJson(blueprintEntity.getContent());
   }
 
+  @SuppressWarnings("unchecked")
   public Map convertToMap(BlueprintV2Entity entity) throws 
IOException {
 return createObjectMapper().readValue(entity.getContent(), HashMap.class);
   }
 
   private StackV2 parseStack(StackId stackId) {
 try {
-  return stackFactory.create(stackId.getStackName(), 
stackId.getStackVersion());
+  return stackFactory.create(stackId);
 } catch (AmbariException e) {
   throw new IllegalArgumentException(
 String.format("Unable to parse stack. name=%s, version=%s", 
stackId.getStackName(), stackId.getStackVersion()),
@@ -156,7 +159,6 @@ public class BlueprintV2Factory {
* @param securityConfiguration security related properties
* @return new blueprint entity
*/
-  @SuppressWarnings("unchecked")
   public BlueprintV2 createBlueprint(Map properties, 
SecurityConfiguration securityConfiguration) throws NoSuchStackException, 
IOException {
 String name = String.valueOf(properties.get(BLUEPRINT_NAME_PROPERTY_ID));
 // String.valueOf() will return "null" if value is null
@@ -168,10 +170,7 @@ public class BlueprintV2Factory {
 String json = om.writeValueAsString(properties);
 BlueprintImplV2 blueprint = 

[14/17] ambari git commit: AMBARI-22325 Fix dependency injection in BaseClusterRequest (benyoka)

2017-11-14 Thread benyoka
AMBARI-22325 Fix dependency injection in BaseClusterRequest (benyoka)


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

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 26143bceb02f0fb54495dbb7fba9fa34e0b5f0c7
Parents: c9e2f6e
Author: Balazs Bence Sari <beny...@apache.org>
Authored: Mon Nov 13 14:55:16 2017 +0100
Committer: Balazs Bence Sari <beny...@apache.org>
Committed: Tue Nov 14 11:31:16 2017 +0100

--
 .../org/apache/ambari/server/controller/AmbariServer.java   | 2 +-
 .../server/controller/internal/BaseClusterRequest.java  | 9 +++--
 .../apache/ambari/server/topology/BlueprintV2Factory.java   | 1 +
 3 files changed, 5 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/26143bce/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 b28cb11..970fb56 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
@@ -934,7 +934,7 @@ public class AmbariServer {
 
HostResourceProvider.setTopologyManager(injector.getInstance(TopologyManager.class));
 BlueprintFactory.init(injector.getInstance(BlueprintDAO.class));
 BlueprintV2Factory.init(injector.getInstance(BlueprintV2DAO.class));
-BaseClusterRequest.init(injector.getInstance(BlueprintV2Factory.class));
+
BaseClusterRequest.init(injector.getInstance(AmbariManagementController.class));
 AmbariContext.init(injector.getInstance(HostRoleCommandFactory.class));
 
 PermissionResourceProvider.init(injector.getInstance(PermissionDAO.class));

http://git-wip-us.apache.org/repos/asf/ambari/blob/26143bce/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BaseClusterRequest.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BaseClusterRequest.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BaseClusterRequest.java
index a38f478..eefb31b 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BaseClusterRequest.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BaseClusterRequest.java
@@ -27,6 +27,7 @@ import java.util.Set;
 import org.apache.ambari.server.api.predicate.InvalidQueryException;
 import org.apache.ambari.server.api.predicate.QueryLexer;
 import org.apache.ambari.server.api.predicate.Token;
+import org.apache.ambari.server.controller.AmbariManagementController;
 import org.apache.ambari.server.controller.spi.Resource;
 import org.apache.ambari.server.controller.spi.ResourceProvider;
 import org.apache.ambari.server.controller.utilities.ClusterControllerHelper;
@@ -92,12 +93,8 @@ public abstract class BaseClusterRequest implements 
TopologyRequest {
   private static ResourceProvider hostResourceProvider;
 
 
-  /**
-   * inject blueprint factory
-   * @param factory  blueprint factory
-   */
-  public static void init(BlueprintV2Factory factory) {
-blueprintFactory = factory;
+  public static void init(AmbariManagementController controller) {
+blueprintFactory = BlueprintV2Factory.create(controller);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/26143bce/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
index 9870dcb..47aed80 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
@@ -82,6 +82,7 @@ public class BlueprintV2Factory {
   protected BlueprintV2Factory() {
 
   }
+
   protected BlueprintV2Factory(StackV2Factory stackFactory) {
 this.stackFactory = stackFactory;
   }



[07/17] ambari git commit: AMBARI-22345. Add service dependencies.Part 2.(vbrodetskyi)

2017-11-14 Thread benyoka
AMBARI-22345. Add service dependencies.Part 2.(vbrodetskyi)


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

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 19513a85f12fb235a01cecce12e68f405785a177
Parents: 6a78e1a
Author: Vitaly Brodetskyi 
Authored: Mon Nov 13 19:45:46 2017 +0200
Committer: Vitaly Brodetskyi 
Committed: Mon Nov 13 19:45:46 2017 +0200

--
 .../server/api/services/ServiceService.java |  22 +--
 .../controller/ServiceDependencyRequest.java|  28 +---
 .../ServiceDependencyResourceProvider.java  | 102 ++--
 .../server/orm/dao/ClusterServiceDAO.java   |  16 ++
 .../orm/entities/ClusterServiceEntity.java  |  29 ++--
 .../orm/entities/ServiceDependencyEntity.java   | 154 +++
 .../org/apache/ambari/server/state/Cluster.java |   5 +-
 .../org/apache/ambari/server/state/Service.java |   5 +
 .../apache/ambari/server/state/ServiceImpl.java | 110 ++---
 .../server/state/cluster/ClusterImpl.java   |  61 +++-
 .../main/resources/Ambari-DDL-Derby-CREATE.sql  |   8 +-
 .../main/resources/Ambari-DDL-MySQL-CREATE.sql  |   7 +-
 .../main/resources/Ambari-DDL-Oracle-CREATE.sql |   7 +-
 .../resources/Ambari-DDL-Postgres-CREATE.sql|   7 +-
 .../resources/Ambari-DDL-SQLAnywhere-CREATE.sql |  19 ++-
 .../resources/Ambari-DDL-SQLServer-CREATE.sql   |   7 +-
 .../src/main/resources/META-INF/persistence.xml |   1 +
 17 files changed, 411 insertions(+), 177 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/19513a85/ambari-server/src/main/java/org/apache/ambari/server/api/services/ServiceService.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ServiceService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ServiceService.java
index 1f3332f..76782d5 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ServiceService.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ServiceService.java
@@ -316,10 +316,10 @@ public class ServiceService extends BaseService {
   responseContainer = RESPONSE_CONTAINER_LIST)
   @ApiImplicitParams({
   @ApiImplicitParam(name = QUERY_FIELDS, value = 
QUERY_FILTER_DESCRIPTION,
-  defaultValue = "ServiceInfo/service_group_name, 
ServiceInfo/service_name, ServiceInfo/cluster_name",
+  defaultValue = "ServiceDependencyInfo/dependency_service_id, 
ServiceInfo/service_group_name, ServiceInfo/service_name, 
ServiceInfo/cluster_name",
   dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY),
   @ApiImplicitParam(name = QUERY_SORT, value = QUERY_SORT_DESCRIPTION,
-  defaultValue = "ServiceInfo/service_group_name.asc, 
ServiceInfo/service_name.asc, ServiceInfo/cluster_name.asc",
+  defaultValue = 
"ServiceDependencyInfo/dependency_service_id.asc, 
ServiceInfo/service_group_name.asc, ServiceInfo/service_name.asc, 
ServiceInfo/cluster_name.asc",
   dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY),
   @ApiImplicitParam(name = QUERY_PAGE_SIZE, value = 
QUERY_PAGE_SIZE_DESCRIPTION, defaultValue = DEFAULT_PAGE_SIZE, dataType = 
DATA_TYPE_INT, paramType = PARAM_TYPE_QUERY),
   @ApiImplicitParam(name = QUERY_FROM, value = QUERY_FROM_DESCRIPTION, 
defaultValue = DEFAULT_FROM, dataType = DATA_TYPE_STRING, paramType = 
PARAM_TYPE_QUERY),
@@ -336,7 +336,7 @@ public class ServiceService extends BaseService {
   }
 
   @GET
-  @Path("{serviceName}/dependencies/{dependencyServiceName}")
+  @Path("{serviceName}/dependencies/{dependencyServiceId}")
   @Produces(MediaType.TEXT_PLAIN)
   @ApiOperation(value = "Get the details of a service dependency",
   nickname = "ServiceService#getServiceDependency",
@@ -344,7 +344,7 @@ public class ServiceService extends BaseService {
   response = ServiceResponse.ServiceResponseSwagger.class,
   responseContainer = RESPONSE_CONTAINER_LIST)
   @ApiImplicitParams({
-  @ApiImplicitParam(name = QUERY_FIELDS, value = 
QUERY_FILTER_DESCRIPTION, defaultValue = "ServiceInfo/*",
+  @ApiImplicitParam(name = QUERY_FIELDS, value = 
QUERY_FILTER_DESCRIPTION, defaultValue = "ServiceDependencyInfo/*",
   dataType = DATA_TYPE_STRING, paramType = PARAM_TYPE_QUERY)
   })
   @ApiResponses(value = {
@@ -354,9 +354,9 @@ public class ServiceService extends BaseService {
   })
   public Response 

[04/17] ambari git commit: AMBARI-22366. POST, GET and UPDATE API for cluster settings. (/clusters/{clusterName}/settings).

2017-11-14 Thread benyoka
AMBARI-22366. POST, GET and UPDATE API for cluster settings. 
(/clusters/{clusterName}/settings).


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

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 4959206893da4060e66b6ece4cfba5136de79157
Parents: b558eda
Author: Swapan Shridhar 
Authored: Fri Nov 10 14:07:40 2017 -0800
Committer: Swapan Shridhar 
Committed: Fri Nov 10 14:07:40 2017 -0800

--
 .../server/ClusterSettingNotFoundException.java |  35 ++
 .../resources/ClusterResourceDefinition.java|   1 +
 .../ClusterSettingResourceDefinition.java   |  45 ++
 .../resources/ResourceInstanceFactoryImpl.java  |   4 +
 .../server/api/services/ClusterService.java |  13 +
 .../api/services/ClusterSettingService.java | 276 +
 .../controller/AmbariManagementController.java  |   8 +
 .../AmbariManagementControllerImpl.java |   8 +
 .../controller/ClusterSettingRequest.java   |  83 +++
 .../controller/ClusterSettingResponse.java  | 147 +
 .../server/controller/ControllerModule.java |   7 +
 .../controller/ResourceProviderFactory.java |   4 +-
 .../server/controller/ServiceGroupResponse.java |   2 +-
 .../AbstractControllerResourceProvider.java |   2 +
 .../ClusterSettingResourceProvider.java | 554 +++
 .../internal/DefaultProviderModule.java |   2 +
 .../internal/ServiceGroupResourceProvider.java  |   4 +-
 .../ambari/server/controller/spi/Resource.java  |   2 +
 .../server/events/ClusterSettingEvent.java  |  46 ++
 .../server/orm/dao/ClusterSettingDAO.java   | 100 
 .../server/orm/entities/ClusterEntity.java  |  11 +
 .../orm/entities/ClusterSettingEntity.java  | 131 +
 .../resources/RootLevelSettingsManager.java |   2 +-
 .../org/apache/ambari/server/state/Cluster.java |  70 +++
 .../ambari/server/state/ClusterSetting.java |  56 ++
 .../server/state/ClusterSettingFactory.java |  33 ++
 .../ambari/server/state/ClusterSettingImpl.java | 201 +++
 .../ambari/server/state/ServiceGroupImpl.java   |   4 +-
 .../server/state/cluster/ClusterImpl.java   | 149 -
 .../main/resources/Ambari-DDL-Derby-CREATE.sql  |  10 +
 .../main/resources/Ambari-DDL-MySQL-CREATE.sql  |   9 +
 .../main/resources/Ambari-DDL-Oracle-CREATE.sql |   9 +
 .../resources/Ambari-DDL-Postgres-CREATE.sql|   9 +
 .../resources/Ambari-DDL-SQLAnywhere-CREATE.sql |   9 +
 .../resources/Ambari-DDL-SQLServer-CREATE.sql   |   9 +
 .../src/main/resources/META-INF/persistence.xml |   1 +
 36 files changed, 2044 insertions(+), 12 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/49592068/ambari-server/src/main/java/org/apache/ambari/server/ClusterSettingNotFoundException.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/ClusterSettingNotFoundException.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/ClusterSettingNotFoundException.java
new file mode 100644
index 000..1720aea
--- /dev/null
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/ClusterSettingNotFoundException.java
@@ -0,0 +1,35 @@
+/**
+ * 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;
+
+@SuppressWarnings("serial")
+public class ClusterSettingNotFoundException extends ObjectNotFoundException {
+
+public ClusterSettingNotFoundException(String clusterName, String 
clusterSettingName) {
+super("ClusterSetting not found"
++ ", clusterName=" + clusterName
++ ", clusterSettingName=" + clusterSettingName);
+}
+
+public ClusterSettingNotFoundException(String clusterName, Long 
clusterSettingId) {
+super("ClusterSetting not found"
++ ", clusterName=" + clusterName
+ 

[17/17] ambari git commit: AMBARI-22325 Polish blueprint v2 unit tests (benyoka)

2017-11-14 Thread benyoka
AMBARI-22325 Polish blueprint v2 unit tests (benyoka)


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

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 8a55187406646a48426c01b8f9bde79755ebaef3
Parents: 26143bc
Author: Balazs Bence Sari <beny...@apache.org>
Authored: Mon Nov 13 18:34:02 2017 +0100
Committer: Balazs Bence Sari <beny...@apache.org>
Committed: Tue Nov 14 11:31:17 2017 +0100

--
 .../server/topology/BlueprintV2Factory.java |   2 +-
 .../validators/BlueprintImplV2Test.java | 167 +--
 2 files changed, 120 insertions(+), 49 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/8a551874/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
index 47aed80..fa12173 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
@@ -198,7 +198,7 @@ public class BlueprintV2Factory {
 this.prettyPrintJson = prettyPrintJson;
   }
 
-  ObjectMapper createObjectMapper() {
+  public ObjectMapper createObjectMapper() {
 ObjectMapper mapper = new ObjectMapper();
 SimpleModule module = new SimpleModule("CustomModel", 
Version.unknownVersion());
 SimpleAbstractTypeResolver resolver = new SimpleAbstractTypeResolver();

http://git-wip-us.apache.org/repos/asf/ambari/blob/8a551874/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/BlueprintImplV2Test.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/BlueprintImplV2Test.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/BlueprintImplV2Test.java
index 611ada1..41d1ca8 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/BlueprintImplV2Test.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/BlueprintImplV2Test.java
@@ -17,30 +17,28 @@
  */
 package org.apache.ambari.server.topology.validators;
 
-import static org.mockito.Mockito.anyString;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Matchers.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
+import com.google.common.base.Preconditions;
+import com.google.common.collect.ImmutableList;
 import org.apache.ambari.server.controller.StackV2;
 import org.apache.ambari.server.controller.StackV2Factory;
 import org.apache.ambari.server.state.StackId;
-import org.apache.ambari.server.topology.BlueprintImplV2;
+import org.apache.ambari.server.topology.BlueprintV2;
 import org.apache.ambari.server.topology.BlueprintV2Factory;
-import org.apache.ambari.server.topology.HostGroupV2;
-import org.apache.ambari.server.topology.HostGroupV2Impl;
+import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-import com.fasterxml.jackson.core.Version;
 import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
-import com.fasterxml.jackson.databind.module.SimpleAbstractTypeResolver;
-import com.fasterxml.jackson.databind.module.SimpleModule;
 import com.google.common.base.Charsets;
-import com.google.common.collect.ImmutableMap;
 import com.google.common.io.Resources;
 
 public class BlueprintImplV2Test {
@@ -48,6 +46,7 @@ public class BlueprintImplV2Test {
   static String BLUEPRINTV2_JSON;
   static String BLUEPRINTV2_2_JSON;
 
+  BlueprintV2Factory blueprintFactory;
 
   @BeforeClass
   public static void setUpClass() throws Exception {
@@ -55,50 +54,122 @@ public class BlueprintImplV2Test {
 BLUEPRINTV2_2_JSON = 
Resources.toString(Resources.getResource("blueprintv2/blueprintv2_2.json"), 
Charsets.UTF_8);
   }
 
+  @Before
+  public void setUp() throws Exception {
+StackV2Factory stackFactory = mock(StackV2Factory.class);
+when(stackFactory.create(any(StackId.class))).thenAnswer(invocation -> {
+  StackId stackId = invocation.getArgumentAt(0, StackId.class);
+  StackV2 stack = new StackV2(stackId.getStackName(), 
stackId.getStackVersion(), stackId.getStackVersion() + ".0-1",
+

[16/17] ambari git commit: AMBARI-22325. Code cleanup: delete useless javadoc (adoroszlai)

2017-11-14 Thread benyoka
AMBARI-22325. Code cleanup: delete useless javadoc (adoroszlai)


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

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 0c5232ae75f8dd99e92bfcf497fd9434f66a509e
Parents: 1a12110
Author: Attila Doroszlai 
Authored: Mon Nov 13 10:49:08 2017 +0100
Committer: Balazs Bence Sari 
Committed: Tue Nov 14 11:31:16 2017 +0100

--
 .../ambari/server/topology/BlueprintV2.java | 21 +---
 1 file changed, 1 insertion(+), 20 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/0c5232ae/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2.java
index 9ca0248..f6314be 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2.java
@@ -27,7 +27,6 @@ import javax.annotation.Nonnull;
 import org.apache.ambari.server.controller.StackV2;
 import org.apache.ambari.server.orm.entities.BlueprintEntity;
 
-
 /**
  * Blueprint representation.
  */
@@ -65,7 +64,7 @@ public interface BlueprintV2 {
   /**
   * @return associated stack ids
   **/
-  public Collection getStackIds();
+  Collection getStackIds();
 
   StackV2 getStackById(String stackId);
 
@@ -82,8 +81,6 @@ public interface BlueprintV2 {
 
   /**
* Get service by Id
-   * @param serviceId
-   * @return
*/
   Service getServiceById(ServiceId serviceId);
 
@@ -102,8 +99,6 @@ public interface BlueprintV2 {
   @Nonnull
   Collection getAllServiceNames();
 
-
-
   /**
* Get all of the service types represented in the blueprint.
*
@@ -122,9 +117,6 @@ public interface BlueprintV2 {
 
   /**
* Get services by type from a service group.
-   * @param serviceGroup
-   * @param serviceType
-   * @return
*/
   Collection getServicesFromServiceGroup(ServiceGroup serviceGroup, 
String serviceType);
 
@@ -149,16 +141,11 @@ public interface BlueprintV2 {
 
   Collection getComponents(Service service);
 
-
   /**
* Get components by type from a service.
-   * @param service
-   * @param componentType
-   * @return
*/
   Collection getComponentsByType(Service service, String 
componentType);
 
-
   /**
* Get the host groups which contain components for the specified service.
*
@@ -178,7 +165,6 @@ public interface BlueprintV2 {
*/
   Collection getHostGroupsForComponent(ComponentV2 component);
 
-
   /**
* Get the Blueprint cluster scoped configuration.
* The blueprint cluster scoped configuration has the stack
@@ -190,7 +176,6 @@ public interface BlueprintV2 {
   @Deprecated
   Configuration getConfiguration();
 
-
   /**
* Get the Blueprint cluster scoped setting.
* The blueprint cluster scoped setting has the setting properties
@@ -200,7 +185,6 @@ public interface BlueprintV2 {
*/
   Setting getSetting();
 
-
   /**
* Get whether a component is enabled for auto start.
*
@@ -233,10 +217,7 @@ public interface BlueprintV2 {
   void validateTopology() throws InvalidTopologyException;
 
   /**
-   *
* A config type is valid if there are services related to except 
cluster-env and global.
-   * @param configType
-   * @return
*/
   boolean isValidConfigType(String configType);
 



[08/17] ambari git commit: AMBARI-22432 : Getting NPE when trying to get services information from service group (mradhakrishnan)

2017-11-14 Thread benyoka
AMBARI-22432 : Getting NPE when trying to get services information from service 
group (mradhakrishnan)


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

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 35d704cb3aa12fcc887821ee7ccb83e11f3c878b
Parents: 19513a8
Author: Madhuvanthi Radhakrishnan 
Authored: Mon Nov 13 15:26:12 2017 -0800
Committer: Madhuvanthi Radhakrishnan 
Committed: Mon Nov 13 15:26:12 2017 -0800

--
 .../AmbariManagementControllerImpl.java | 63 ++--
 1 file changed, 31 insertions(+), 32 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/35d704cb/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 80b414578..875d9b6 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
@@ -1481,19 +1481,19 @@ public class AmbariManagementControllerImpl implements 
AmbariManagementControlle
   ConfigurationResponse response = null;
   Config config = null;
   //TODO : Remove after getting rid of cluster configurations
-  if (request.getServiceId() == null) {
-config = cluster.getConfig(request.getType(),
-request.getVersionTag());
+  if (request.getServiceId() != null) {
+config = cluster.getConfigByServiceId(request.getType(), 
request.getVersionTag(), request.getServiceId());
 if (null != config) {
   response = new ConfigurationResponse(
-  cluster.getClusterName(), config);
+  cluster.getClusterName(), config, request.getServiceId(), 
request.getServiceGroupId());
 }
   }
-  else {
-config = cluster.getConfigByServiceId(request.getType(), 
request.getVersionTag(), request.getServiceId());
+  if (response == null) {
+config = cluster.getConfig(request.getType(),
+request.getVersionTag());
 if (null != config) {
   response = new ConfigurationResponse(
-  cluster.getClusterName(), config, request.getServiceId(), 
request.getServiceGroupId());
+  cluster.getClusterName(), config);
 }
   }
   responses.add(response);
@@ -1505,9 +1505,9 @@ public class AmbariManagementControllerImpl implements 
AmbariManagementControlle
   //Get by type
   if (null != request.getType()) {
 //TODO : Remove after getting rid of cluster configurations
-if (request.getServiceId() == null) {
-  configs = cluster.getConfigsByType(
-  request.getType());
+if (request.getServiceId() != null) {
+  configs = cluster.getConfigsByServiceIdType(
+  request.getType(), request.getServiceId());
   if (null != configs) {
 for (Entry entry : configs.entrySet()) {
   Config config = entry.getValue();
@@ -1517,14 +1517,14 @@ public class AmbariManagementControllerImpl implements 
AmbariManagementControlle
   config.getTag(), entry.getValue().getVersion(),
   includeProps ? config.getProperties() : new HashMap<>(),
   includeProps ? config.getPropertiesAttributes() : new 
HashMap<>(),
-  config.getPropertiesTypes());
+  config.getPropertiesTypes(), request.getServiceId(), 
request.getServiceGroupId());
   responses.add(response);
 }
   }
 }
-else {
-  configs = cluster.getConfigsByServiceIdType(
-  request.getType(), request.getServiceId());
+if (responses == null || responses.isEmpty()) {
+  configs = cluster.getConfigsByType(
+  request.getType());
   if (null != configs) {
 for (Entry entry : configs.entrySet()) {
   Config config = entry.getValue();
@@ -1534,42 +1534,41 @@ public class AmbariManagementControllerImpl implements 
AmbariManagementControlle
   config.getTag(), entry.getValue().getVersion(),
   includeProps ? config.getProperties() : new 

[09/17] ambari git commit: AMBARI-22325. Simplify lambdas (adoroszlai)

2017-11-14 Thread benyoka
AMBARI-22325. Simplify lambdas (adoroszlai)


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

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: ceeb3829f065b3dfdb1f0d76ba330841f257789f
Parents: e15f057
Author: Attila Doroszlai 
Authored: Mon Nov 13 09:41:16 2017 +0100
Committer: Balazs Bence Sari 
Committed: Tue Nov 14 11:31:15 2017 +0100

--
 .../controller/DeleteIdentityHandler.java   |  2 +-
 .../server/controller/StackV2Factory.java   |  2 +-
 .../utilities/RemovableIdentities.java  |  4 +--
 .../controller/utilities/UsedIdentities.java|  2 +-
 .../ambari/server/topology/BlueprintImplV2.java | 35 ++--
 .../server/topology/BlueprintV2Factory.java |  2 +-
 .../ambari/server/topology/HostGroupV2Impl.java |  6 ++--
 .../ambari/server/topology/ServiceGroup.java|  3 +-
 .../apache/ambari/server/topology/Setting.java  |  2 +-
 9 files changed, 30 insertions(+), 28 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/ceeb3829/ambari-server/src/main/java/org/apache/ambari/server/controller/DeleteIdentityHandler.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/DeleteIdentityHandler.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/DeleteIdentityHandler.java
index f5d51c3..91035f8 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/DeleteIdentityHandler.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/DeleteIdentityHandler.java
@@ -234,7 +234,7 @@ class DeleteIdentityHandler {
 }
 
 private Set serviceNames() {
-  return componentFilter().stream().map(component -> 
component.getServiceName()).collect(toSet());
+  return 
componentFilter().stream().map(Component::getServiceName).collect(toSet());
 }
 
 private List componentFilter() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/ceeb3829/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2Factory.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2Factory.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2Factory.java
index 784b368..0735171 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2Factory.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2Factory.java
@@ -85,7 +85,7 @@ public class StackV2Factory {
 List> componentServices = 
stackData.serviceComponents.entrySet().stream().
   flatMap(e -> e.getValue().stream().map( v -> new 
SimpleImmutableEntry<>(e.getKey(), v))).
   collect(Collectors.toList());
-componentServices.stream().forEach( componentService -> {
+componentServices.forEach( componentService -> {
   try {
 ComponentInfo componentInfo = 
controller.getAmbariMetaInfo().getComponent(stackData.stackName,
   stackData.stackVersion, componentService.getKey(), 
componentService.getValue());

http://git-wip-us.apache.org/repos/asf/ambari/blob/ceeb3829/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/RemovableIdentities.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/RemovableIdentities.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/RemovableIdentities.java
index cd23e83..ef9518d 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/RemovableIdentities.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/RemovableIdentities.java
@@ -101,7 +101,7 @@ public class RemovableIdentities {
   }
 
   private static ServiceExclude excludeService(String excludedServiceName) {
-return serviceName -> excludedServiceName.equals(serviceName);
+return excludedServiceName::equals;
   }
 
   private static ComponentExclude excludeComponent(String excludedServiceName, 
String excludedComponentName, String excludedHostName) {
@@ -116,7 +116,7 @@ public class RemovableIdentities {
 
   private static List 
componentIdentities(List componentNames, KerberosServiceDescriptor 
serviceDescriptor) throws AmbariException {
 return componentNames.stream()
-  .map(componentName -> serviceDescriptor.getComponent(componentName))
+  

[02/17] ambari git commit: AMBARI-22380 : Add stack name and version to registry API (mradhakrishnan)

2017-11-14 Thread benyoka
AMBARI-22380 : Add stack name and version to registry API (mradhakrishnan)


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

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: b558eda2d45724c865914e3f49a2af16abe43f86
Parents: 5301b3f
Author: Madhuvanthi Radhakrishnan 
Authored: Wed Nov 8 09:52:54 2017 -0800
Committer: Madhuvanthi Radhakrishnan 
Committed: Wed Nov 8 09:52:54 2017 -0800

--
 .../controller/RegistryMpackVersionResponse.java   | 14 +-
 .../RegistryMpackVersionResourceProvider.java  | 17 ++---
 .../server/registry/RegistryMpackVersion.java  |  7 +++
 .../registry/json/JsonRegistryMpackVersion.java|  8 
 4 files changed, 42 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/b558eda2/ambari-server/src/main/java/org/apache/ambari/server/controller/RegistryMpackVersionResponse.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/RegistryMpackVersionResponse.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/RegistryMpackVersionResponse.java
index a0674ee..5929c4c 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/RegistryMpackVersionResponse.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/RegistryMpackVersionResponse.java
@@ -33,6 +33,7 @@ public class RegistryMpackVersionResponse {
   private String mpackName;
   private String mpackVersion;
   private String mpackBuildNumber;
+  private String stackId;
   private String mpackUrl;
   private String mpackDocUrl;
   private List mpackServices;
@@ -48,12 +49,13 @@ public class RegistryMpackVersionResponse {
* @param mpackDocUrl   mpack documentation url
* @param mpackServices list of mpack services
* @param compatibleMpacks  list of compatible mpacks
+   * @param stackId   stack id of the mpack version
*/
   public RegistryMpackVersionResponse(
 Long registryId, String mpackName, String mpackVersion, String 
mpackBuildNumber,
 String mpackUrl, String mpackDocUrl,
 List mpackServices,
-List compatibleMpacks) {
+List compatibleMpacks, String 
stackId) {
 this.registryId = registryId;
 this.mpackName = mpackName;
 this.mpackVersion = mpackVersion;
@@ -62,6 +64,7 @@ public class RegistryMpackVersionResponse {
 this.mpackDocUrl = mpackDocUrl;
 this.mpackServices = mpackServices;
 this.compatibleMpacks = compatibleMpacks;
+this.stackId = stackId;
   }
 
   public Long getRegistryId() {
@@ -96,6 +99,15 @@ public class RegistryMpackVersionResponse {
 return compatibleMpacks;
   }
 
+
+  public String getStackId() {
+return stackId;
+  }
+
+  public void setStackId(String stackId) {
+this.stackId = stackId;
+  }
+
   @Override
   public int hashCode() {
 int result = 1;

http://git-wip-us.apache.org/repos/asf/ambari/blob/b558eda2/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RegistryMpackVersionResourceProvider.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RegistryMpackVersionResourceProvider.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RegistryMpackVersionResourceProvider.java
index 3b8a3f5..9020146 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RegistryMpackVersionResourceProvider.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RegistryMpackVersionResourceProvider.java
@@ -65,6 +65,10 @@ public class RegistryMpackVersionResourceProvider extends 
AbstractControllerReso
   public static final String REGISTRY_MPACK_DOC_URL = RESPONSE_KEY + 
PropertyHelper.EXTERNAL_PATH_SEP + "mpack_doc_url";
   public static final String REGISTRY_MPACK_SERVICES = RESPONSE_KEY + 
PropertyHelper.EXTERNAL_PATH_SEP + "services";
   public static final String REGISTRY_MPACK_COMPATIBLE_MPACKS = RESPONSE_KEY + 
PropertyHelper.EXTERNAL_PATH_SEP + "compatible_mpacks";
+  public static final String REGISTRY_MPACK_STACK_NAME_PROPERTY_ID = 
RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + "stack_name";
+  public static final String REGISTRY_MPACK_STACK_VERSION_PROPERTY_ID =
+  RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + "stack_version";
+
 
   private static Set pkPropertyIds = new HashSet<>(
 Arrays.asList(REGISTRY_ID, REGISTRY_MPACK_NAME));

[15/17] ambari git commit: AMBARI-22325 Yet another fix for v2 blueprint json serialization/deserialization (benyoka)

2017-11-14 Thread benyoka
AMBARI-22325 Yet another fix for v2 blueprint json 
serialization/deserialization (benyoka)


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

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 1a121106e94306943795522d7578e938e418dd02
Parents: bc08e24
Author: Balazs Bence Sari <beny...@apache.org>
Authored: Mon Nov 13 11:20:21 2017 +0100
Committer: Balazs Bence Sari <beny...@apache.org>
Committed: Tue Nov 14 11:31:16 2017 +0100

--
 .../src/main/java/org/apache/ambari/server/topology/Service.java| 1 +
 .../ambari/server/topology/validators/BlueprintImplV2Test.java  | 1 +
 2 files changed, 2 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/1a121106/ambari-server/src/main/java/org/apache/ambari/server/topology/Service.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/Service.java 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/Service.java
index 7c5ee42..90b4764 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/Service.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/Service.java
@@ -165,6 +165,7 @@ public class Service implements Configurable {
   '}';
   }
 
+  @JsonIgnore
   public String getServiceGroupName() {
 if (serviceGroup != null) {
   return serviceGroup.getName();

http://git-wip-us.apache.org/repos/asf/ambari/blob/1a121106/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/BlueprintImplV2Test.java
--
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/BlueprintImplV2Test.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/BlueprintImplV2Test.java
index 99acfb7..611ada1 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/BlueprintImplV2Test.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/BlueprintImplV2Test.java
@@ -97,6 +97,7 @@ public class BlueprintImplV2Test {
 String bpSerialized = bpFactory.convertToJson(bp);
 System.out.println(bpSerialized);
 bp = (BlueprintImplV2)bpFactory.convertFromJson(bpSerialized);
+System.out.println(bp);
   }
 
 



[10/17] ambari git commit: AMBARI-22325. Log blueprint JSON parse error when loading from DB (adoroszlai)

2017-11-14 Thread benyoka
AMBARI-22325. Log blueprint JSON parse error when loading from DB (adoroszlai)


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

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: e15f05760d88e4095f9f0e3cf58a6047c2f6786e
Parents: 57bef16
Author: Attila Doroszlai 
Authored: Mon Nov 13 09:16:44 2017 +0100
Committer: Balazs Bence Sari 
Committed: Tue Nov 14 11:31:15 2017 +0100

--
 .../ambari/server/controller/internal/ProvisionClusterRequest.java  | 1 +
 1 file changed, 1 insertion(+)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/e15f0576/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 f773fc8..48d5016 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
@@ -325,6 +325,7 @@ public class ProvisionClusterRequest extends 
BaseClusterRequest {
 try {
   setBlueprint(getBlueprintFactory().getBlueprint(blueprintName));
 } catch (IOException e) {
+  LOG.error("Could not parse JSON stored in DB for blueprint {}", 
blueprintName, e);
   throw new NoSuchBlueprintException(blueprintName);
 }
 



[05/17] ambari git commit: AMBARI-22355 : Addendum patch for adding service_id to clusterconfig (mradhakrishnan)

2017-11-14 Thread benyoka
AMBARI-22355 : Addendum patch for adding service_id to clusterconfig 
(mradhakrishnan)


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

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 55e450eea40030d21addbb3aa06bf5d87668ae6e
Parents: 4959206
Author: Madhuvanthi Radhakrishnan 
Authored: Fri Nov 10 15:57:00 2017 -0800
Committer: Madhuvanthi Radhakrishnan 
Committed: Fri Nov 10 15:57:00 2017 -0800

--
 .../main/resources/Ambari-DDL-Derby-CREATE.sql  | 44 ++--
 .../main/resources/Ambari-DDL-MySQL-CREATE.sql  | 44 ++--
 .../main/resources/Ambari-DDL-Oracle-CREATE.sql | 43 +--
 .../resources/Ambari-DDL-Postgres-CREATE.sql| 43 +--
 .../resources/Ambari-DDL-SQLAnywhere-CREATE.sql | 43 +--
 .../resources/Ambari-DDL-SQLServer-CREATE.sql   | 43 +--
 6 files changed, 134 insertions(+), 126 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/55e450ee/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 039d8af..a591bbf 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
@@ -86,27 +86,6 @@ CREATE TABLE clusters (
   CONSTRAINT FK_clusters_desired_stack_id FOREIGN KEY (desired_stack_id) 
REFERENCES stack(stack_id),
   CONSTRAINT FK_clusters_resource_id FOREIGN KEY (resource_id) REFERENCES 
adminresource(resource_id));
 
-CREATE TABLE clusterconfig (
-  config_id BIGINT NOT NULL,
-  version_tag VARCHAR(255) NOT NULL,
-  version BIGINT NOT NULL,
-  type_name VARCHAR(255) NOT NULL,
-  cluster_id BIGINT NOT NULL,
-  stack_id BIGINT NOT NULL,
-  selected SMALLINT NOT NULL DEFAULT 0,
-  config_data VARCHAR(3000) NOT NULL,
-  config_attributes VARCHAR(3000),
-  create_timestamp BIGINT NOT NULL,
-  unmapped SMALLINT NOT NULL DEFAULT 0,
-  selected_timestamp BIGINT NOT NULL DEFAULT 0,
-  service_id BIGINT,
-  CONSTRAINT PK_clusterconfig PRIMARY KEY (config_id),
-  CONSTRAINT FK_clusterconfig_cluster_id FOREIGN KEY (cluster_id) REFERENCES 
clusters (cluster_id),
-  CONSTRAINT FK_clusterconfig_stack_id FOREIGN KEY (stack_id) REFERENCES 
stack(stack_id),
-  CONSTRAINT FK_clusterconfig_service_id FOREIGN KEY (service_id) REFERENCES 
clusterservices(id),
-  CONSTRAINT UQ_config_type_tag UNIQUE (version_tag, type_name, cluster_id),
-  CONSTRAINT UQ_config_type_version UNIQUE (cluster_id, type_name, version));
-
 CREATE TABLE configuration_base (
   id BIGINT NOT NULL,
   version_tag VARCHAR(255) NOT NULL,
@@ -176,8 +155,31 @@ CREATE TABLE clusterservices (
   service_group_id BIGINT NOT NULL,
   service_enabled INTEGER NOT NULL,
   CONSTRAINT PK_clusterservices PRIMARY KEY (id, service_group_id, cluster_id),
+  CONSTRAINT UQ_service_id UNIQUE (id),
   CONSTRAINT FK_clusterservices_cluster_id FOREIGN KEY (service_group_id, 
cluster_id) REFERENCES servicegroups (id, cluster_id));
 
+CREATE TABLE clusterconfig (
+  config_id BIGINT NOT NULL,
+  version_tag VARCHAR(255) NOT NULL,
+  version BIGINT NOT NULL,
+  type_name VARCHAR(255) NOT NULL,
+  cluster_id BIGINT NOT NULL,
+  stack_id BIGINT NOT NULL,
+  selected SMALLINT NOT NULL DEFAULT 0,
+  config_data VARCHAR(3000) NOT NULL,
+  config_attributes VARCHAR(3000),
+  create_timestamp BIGINT NOT NULL,
+  unmapped SMALLINT NOT NULL DEFAULT 0,
+  selected_timestamp BIGINT NOT NULL DEFAULT 0,
+  service_id BIGINT,
+  CONSTRAINT PK_clusterconfig PRIMARY KEY (config_id),
+  CONSTRAINT FK_clusterconfig_cluster_id FOREIGN KEY (cluster_id) REFERENCES 
clusters (cluster_id),
+  CONSTRAINT FK_clusterconfig_stack_id FOREIGN KEY (stack_id) REFERENCES 
stack(stack_id),
+  CONSTRAINT FK_clusterconfig_service_id FOREIGN KEY (service_id) REFERENCES 
clusterservices(id),
+  CONSTRAINT UQ_config_type_tag UNIQUE (version_tag, type_name, cluster_id),
+  CONSTRAINT UQ_config_type_version UNIQUE (cluster_id, type_name, version));
+
+
 CREATE TABLE servicedependencies (
   service_id BIGINT NOT NULL,
   service_group_id BIGINT NOT NULL,

http://git-wip-us.apache.org/repos/asf/ambari/blob/55e450ee/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

[03/17] ambari git commit: AMBARI-22366. POST, GET and UPDATE API for cluster settings. (/clusters/{clusterName}/settings).

2017-11-14 Thread benyoka
http://git-wip-us.apache.org/repos/asf/ambari/blob/49592068/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java 
b/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java
index f12759e..77bf62b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java
@@ -24,6 +24,8 @@ import java.util.Map;
 import java.util.Set;
 
 import org.apache.ambari.server.AmbariException;
+
+import org.apache.ambari.server.ClusterSettingNotFoundException;
 import org.apache.ambari.server.ServiceGroupNotFoundException;
 import org.apache.ambari.server.controller.ClusterResponse;
 import org.apache.ambari.server.controller.ServiceComponentHostResponse;
@@ -98,6 +100,36 @@ public interface Cluster {
 
   ServiceGroup addServiceGroupDependency(String serviceGroupName, String 
dependencyServiceGroupName) throws AmbariException;
 
+
+  ClusterSetting addClusterSetting(String clusterSettingName, String 
clusterSettingValue) throws AmbariException;
+
+  /**
+   * Add 'cluster setting' to the cluster
+   *
+   * @param clusterSetting
+   * @return
+   * @throws AmbariException
+   */
+  void addClusterSetting(ClusterSetting clusterSetting);
+
+  /**
+   * Update 'cluster setting' in the cluster
+   *
+   * @param clusterSettingName Cluster setting name
+   * @return
+   * @throws AmbariException
+   */
+  ClusterSetting updateClusterSetting(String clusterSettingName, String 
clusterSettingValue) throws AmbariException;
+
+  /**
+   * Add 'cluster setting' in the cluster
+   *
+   * @param clusterSetting
+   * @return
+   * @throws AmbariException
+   */
+  void updateClusterSetting(ClusterSetting clusterSetting);
+
   //TODO remove when UI starts using service groups
   /**
* Get a service
@@ -153,6 +185,29 @@ public interface Cluster {
   Map getServiceGroups() throws AmbariException;
 
   /**
+   * Get a cluster setting
+   *
+   * @param clusterSettingName
+   * @return
+   */
+  ClusterSetting getClusterSetting(String clusterSettingName) throws 
ClusterSettingNotFoundException;
+
+  /**
+   * Get a cluster setting
+   *
+   * @param clusterSettingId
+   * @return
+   */
+  ClusterSetting getClusterSetting(Long clusterSettingId) throws 
ClusterSettingNotFoundException;
+
+  /**
+   * Get all cluster settings
+   *
+   * @return
+   */
+  Map getClusterSettings() throws AmbariException;
+
+  /**
* Get all ServiceComponentHosts on a given host
*
* @param hostname
@@ -562,6 +617,21 @@ public interface Cluster {
   void deleteServiceGroupDependency(String serviceGroupName, String 
dependencyServiceGroupName) throws AmbariException;
 
   /**
+   * Delete all the cluster settings associated with this cluster
+   *
+   * @throws AmbariException
+   */
+  void deleteAllClusterSettings() throws AmbariException;
+
+  /**
+   * Delete the named cluster setting associated with this cluster
+   *
+   * @param clusterSettingName
+   * @throws AmbariException
+   */
+  void deleteClusterSetting(String clusterSettingName) throws AmbariException;
+
+  /**
* Gets if the cluster can be deleted
*
* @return

http://git-wip-us.apache.org/repos/asf/ambari/blob/49592068/ambari-server/src/main/java/org/apache/ambari/server/state/ClusterSetting.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/state/ClusterSetting.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/state/ClusterSetting.java
new file mode 100644
index 000..0a10907
--- /dev/null
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/state/ClusterSetting.java
@@ -0,0 +1,56 @@
+/**
+ * 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.state;
+
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.controller.ClusterSettingResponse;
+
+public interface ClusterSetting {
+
+Long getClusterSettingId();
+
+

ambari git commit: AMBARI-22325 Cluster template object improvements (benyoka)

2017-11-21 Thread benyoka
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-14714-blueprintv2 94a93a6bb -> 7275cb668


AMBARI-22325 Cluster template object improvements (benyoka)


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

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 7275cb668d1a7bc642c9aaf46f8e8efa46f725b3
Parents: 94a93a6
Author: Balazs Bence Sari <beny...@apache.org>
Authored: Tue Nov 21 10:32:23 2017 +0100
Committer: Balazs Bence Sari <beny...@apache.org>
Committed: Tue Nov 21 10:32:47 2017 +0100

--
 .../ambari/server/topology/ComponentV2.java |  6 +-
 .../topology/ProvisionClusterTemplate.java  | 72 
 .../ProvisionClusterTemplateFactory.java|  9 +--
 .../apache/ambari/server/topology/Service.java  |  6 +-
 .../ambari/server/topology/ServiceId.java   | 27 +++-
 .../server/topology/BlueprintV2FactoryTest.java | 16 ++---
 .../topology/ProvisionClusterTemplateTest.java  | 49 -
 .../blueprintv2/cluster_template_v2.json| 15 +++-
 .../cluster_template_v2_invalid_hostgroup.json  | 70 +++
 9 files changed, 215 insertions(+), 55 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/7275cb66/ambari-server/src/main/java/org/apache/ambari/server/topology/ComponentV2.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/ComponentV2.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/ComponentV2.java
index 0d26ef6..42158f4 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/ComponentV2.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/ComponentV2.java
@@ -30,7 +30,7 @@ public class ComponentV2 implements Configurable {
 
   private String name;
 
-  private ServiceId serviceId = new ServiceId();
+  private ServiceId serviceId = new ServiceId(null, null);
 
   private ProvisionAction provisionAction = ProvisionAction.INSTALL_AND_START;
 
@@ -110,12 +110,12 @@ public class ComponentV2 implements Configurable {
 
   @JsonProperty("service_group")
   public void setServiceGroup(String serviceGroup) {
-serviceId.setServiceGroup(serviceGroup);
+this.serviceId = new ServiceId(this.serviceId.getName(), serviceGroup);
   }
 
   @JsonProperty("service_name")
   public void setServiceName(String serviceName) {
-serviceId.setName(serviceName);
+this.serviceId = new ServiceId(serviceName, 
this.serviceId.getServiceGroup());
   }
 
   public String getServiceName() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/7275cb66/ambari-server/src/main/java/org/apache/ambari/server/topology/ProvisionClusterTemplate.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/ProvisionClusterTemplate.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/ProvisionClusterTemplate.java
index 5ef6517..90da776 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/ProvisionClusterTemplate.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/ProvisionClusterTemplate.java
@@ -18,26 +18,39 @@
  */
 package org.apache.ambari.server.topology;
 
+import static java.util.stream.Collectors.toMap;
+
 import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+
+import javax.annotation.Nullable;
 
 import org.apache.ambari.server.controller.internal.ProvisionAction;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
 
 public class ProvisionClusterTemplate {
 
-  private String blueprint;
+  private String blueprint = null;
+
   @JsonProperty("default_password")
-  private String defaultPassword;
+  private String defaultPassword = null;
+
   @JsonProperty("config_recommendation_strategy")
   private ConfigRecommendationStrategy configRecommendationStrategy;
+
   @JsonProperty("provision_action")
   private ProvisionAction provisionAction;
-  private Collection services;
-  @JsonProperty("host_groups")
-  private Collection hostGroups;
+
+  private Map<ServiceId, ProvisionClusterTemplate.Service> servicesById = 
Collections.emptyMap();
+
+  private Map<String, ProvisionClusterTemplate.HostGroup> hostGroups = 
Collections.emptyMap();
+
   private Collection credentials;
+
   @JsonProperty("security")
   private Securit

ambari git commit: AMBARI-22325 Rename ProvisionClusterTemplate to TopologyTemplate (benyoka)

2017-11-21 Thread benyoka
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-14714-blueprintv2 7275cb668 -> 677bc9f1a


AMBARI-22325 Rename ProvisionClusterTemplate to TopologyTemplate (benyoka)


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

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 677bc9f1a39e0ed4d710f135312280bd91590960
Parents: 7275cb6
Author: Balazs Bence Sari <beny...@apache.org>
Authored: Tue Nov 21 11:27:42 2017 +0100
Committer: Balazs Bence Sari <beny...@apache.org>
Committed: Tue Nov 21 11:27:58 2017 +0100

--
 .../topology/ProvisionClusterTemplate.java  | 263 ---
 .../ProvisionClusterTemplateFactory.java|  63 -
 .../server/topology/TopologyTemplate.java   | 263 +++
 .../topology/TopologyTemplateFactory.java   |  63 +
 .../topology/ProvisionClusterTemplateTest.java  |  94 ---
 .../topology/TopologyTemplateFactoryTest.java   |  94 +++
 6 files changed, 420 insertions(+), 420 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/677bc9f1/ambari-server/src/main/java/org/apache/ambari/server/topology/ProvisionClusterTemplate.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/ProvisionClusterTemplate.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/ProvisionClusterTemplate.java
deleted file mode 100644
index 90da776..000
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/ProvisionClusterTemplate.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * 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 distribut
- * ed 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;
-
-import static java.util.stream.Collectors.toMap;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Map;
-
-import javax.annotation.Nullable;
-
-import org.apache.ambari.server.controller.internal.ProvisionAction;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.google.common.base.Preconditions;
-
-public class ProvisionClusterTemplate {
-
-  private String blueprint = null;
-
-  @JsonProperty("default_password")
-  private String defaultPassword = null;
-
-  @JsonProperty("config_recommendation_strategy")
-  private ConfigRecommendationStrategy configRecommendationStrategy;
-
-  @JsonProperty("provision_action")
-  private ProvisionAction provisionAction;
-
-  private Map<ServiceId, ProvisionClusterTemplate.Service> servicesById = 
Collections.emptyMap();
-
-  private Map<String, ProvisionClusterTemplate.HostGroup> hostGroups = 
Collections.emptyMap();
-
-  private Collection credentials;
-
-  @JsonProperty("security")
-  private SecurityConfiguration securityConfiguration;
-
-  public String getBlueprint() {
-return blueprint;
-  }
-
-  public void setBlueprint(String blueprint) {
-this.blueprint = blueprint;
-  }
-
-  public String getDefaultPassword() {
-return defaultPassword;
-  }
-
-  public void setDefaultPassword(String defaultPassword) {
-this.defaultPassword = defaultPassword;
-  }
-
-  public @Nullable Service getServiceById(ServiceId serviceId) {
-return servicesById.get(serviceId);
-  }
-
-  @JsonProperty("services")
-  public Collection getServices() {
-return servicesById.values();
-  }
-
-  @JsonProperty("services")
-  public void setServices(Collection services) {
-this.servicesById = services.stream().collect(toMap(
-  s -> s.getId(),
-  s -> s
-));
-  }
-
-  public Collection getCredentials() {
-return credentials;
-  }
-
-  public void setCredentials(Collection credentials) {
-this.credentials = credentials;
-  }
-
-  public SecurityConfigurati

ambari git commit: AMBARI-22325 Support for attributes in configuration (benyoka)

2017-11-21 Thread benyoka
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-14714-blueprintv2 a092c43e1 -> c49a0a5ff


AMBARI-22325 Support for attributes in configuration (benyoka)


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

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: c49a0a5ff164b41b8010834bd841b6c4055751e2
Parents: a092c43
Author: Balazs Bence Sari <beny...@apache.org>
Authored: Tue Nov 21 23:05:57 2017 +0100
Committer: Balazs Bence Sari <beny...@apache.org>
Committed: Tue Nov 21 23:06:17 2017 +0100

--
 .../ambari/server/topology/Configurable.java|  40 +--
 .../server/topology/ConfigurableTest.java   | 120 +++
 2 files changed, 150 insertions(+), 10 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/c49a0a5f/ambari-server/src/main/java/org/apache/ambari/server/topology/Configurable.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/Configurable.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/Configurable.java
index af91e40..dca16e0 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/Configurable.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/Configurable.java
@@ -18,7 +18,6 @@
 
 package org.apache.ambari.server.topology;
 
-import static java.util.Collections.singletonMap;
 import static java.util.stream.Collectors.toList;
 import static java.util.stream.Collectors.toMap;
 
@@ -26,34 +25,55 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Set;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Sets;
 
 public interface Configurable {
   void setConfiguration(Configuration configuration);
   Configuration getConfiguration();
 
   @JsonProperty("configurations")
-  default void setConfigs(Collection<Map<String, Map<String, Map<String, 
String>>>> configs) {
+  default void setConfigs(Collection<Map<String, Map<String, Map<String, ? 
extends Object>>>> configs) {
 if (null != configs) {
   Map<String, Map<String, String>> allProps = configs.stream().
 filter(map -> map != null && !map.isEmpty() && 
map.values().iterator().next().get(Configuration.PROPERTIES_KEY) != null).
 collect(toMap(
   config -> config.keySet().iterator().next(),
-  config -> 
config.values().iterator().next().get(Configuration.PROPERTIES_KEY)
+  config -> (Map<String, 
String>)config.values().iterator().next().get(Configuration.PROPERTIES_KEY)
 ));
-  setConfiguration(new Configuration(allProps, new HashMap<>()));
+  Map<String, Map<String, Map<String, String>>> allAttributes = 
configs.stream().
+filter(map -> map != null && !map.isEmpty() && 
map.values().iterator().next().get(Configuration.ATTRIBUTES_KEY) != null).
+collect(toMap(
+  config -> config.keySet().iterator().next(),
+  config -> (Map<String, Map<String, String>>)
+config.values().iterator().next().get(Configuration.ATTRIBUTES_KEY)
+));
+  setConfiguration(new Configuration(allProps, allAttributes));
 }
   }
 
   @JsonProperty("configurations")
-  default Collection<Map<String, Map<String, Map<String, String>>>> 
getConfigs() {
+  default Collection<Map<String, Map<String, Map<String, ? extends Object>>>> 
getConfigs() {
 Configuration config = getConfiguration();
-return config != null
-  ? config.getProperties().entrySet().stream()
-.map(e -> singletonMap(e.getKey(), 
singletonMap(Configuration.PROPERTIES_KEY, e.getValue(
-.collect(toList())
-  : Collections.emptyList();
+if (config != null) {
+  Set keys = Sets.union(config.getProperties().keySet(), 
config.getAttributes().keySet());
+  return keys.stream().map(key -> {
+Map<String, Map<String, ? extends Object>> map = new HashMap<>(2);
+if (config.getProperties().containsKey(key)) {
+  map.put(Configuration.PROPERTIES_KEY, 
config.getProperties().get(key));
+}
+if (config.getAttributes().containsKey(key)) {
+  map.put(Configuration.ATTRIBUTES_KEY, 
config.getAttributes().get(key));
+ 

ambari git commit: AMBARI-22325 Fix repository versions (benyoka)

2017-11-16 Thread benyoka
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-14714-blueprintv2 4065f35e6 -> f7d4d7322


AMBARI-22325 Fix repository versions (benyoka)


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

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: f7d4d73229b4d42864db3c8767494e1bceaf71dc
Parents: 4065f35
Author: Balazs Bence Sari <beny...@apache.org>
Authored: Thu Nov 16 12:09:19 2017 +0100
Committer: Balazs Bence Sari <beny...@apache.org>
Committed: Thu Nov 16 12:10:21 2017 +0100

--
 .../AmbariManagementControllerImpl.java |  8 ++--
 .../ambari/server/controller/AmbariServer.java  |  8 ++--
 .../server/controller/RepositoryResponse.java   | 10 +
 .../server/controller/StackV2Factory.java   | 30 +
 .../internal/BlueprintV2ResourceProvider.java   | 10 ++---
 .../ambari/server/orm/entities/StackEntity.java | 11 -
 .../server/topology/BlueprintV2Factory.java | 44 +++-
 .../main/resources/Ambari-DDL-Derby-CREATE.sql  |  1 -
 .../main/resources/Ambari-DDL-MySQL-CREATE.sql  |  1 -
 .../resources/Ambari-DDL-Postgres-CREATE.sql|  1 -
 .../resources/Ambari-DDL-SQLAnywhere-CREATE.sql |  1 -
 .../resources/Ambari-DDL-SQLServer-CREATE.sql   |  1 -
 .../validators/BlueprintImplV2Test.java |  4 +-
 13 files changed, 60 insertions(+), 70 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/f7d4d732/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 875d9b6..37eb613 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
@@ -4634,11 +4634,8 @@ public class AmbariManagementControllerImpl implements 
AmbariManagementControlle
 
 // !!! when asking for Repository responses for a versionDefinition, it is 
either for
 // an established repo version (a Long) OR from the in-memory generated 
ones (a String)
-if (null == repositoryVersionId && null != versionDefinitionId) {
-
-  if (NumberUtils.isDigits(versionDefinitionId)) {
-repositoryVersionId = Long.valueOf(versionDefinitionId);
-  }
+if (null == repositoryVersionId && 
NumberUtils.isDigits(versionDefinitionId)) {
+  repositoryVersionId = Long.valueOf(versionDefinitionId);
 }
 
 Set responses = new HashSet<>();
@@ -4658,6 +4655,7 @@ public class AmbariManagementControllerImpl implements 
AmbariManagementControlle
   }
   response.setStackName(repositoryVersion.getStackName());
   response.setStackVersion(repositoryVersion.getStackVersion());
+  response.setRepoVersion(repositoryVersion.getVersion());
   responses.add(response);
 }
 break;

http://git-wip-us.apache.org/repos/asf/ambari/blob/f7d4d732/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 970fb56..4377f04 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
@@ -91,6 +91,7 @@ import org.apache.ambari.server.orm.dao.MetainfoDAO;
 import org.apache.ambari.server.orm.dao.PermissionDAO;
 import org.apache.ambari.server.orm.dao.PrincipalDAO;
 import org.apache.ambari.server.orm.dao.PrivilegeDAO;
+import org.apache.ambari.server.orm.dao.RepositoryVersionDAO;
 import org.apache.ambari.server.orm.dao.ResourceDAO;
 import org.apache.ambari.server.orm.dao.UserDAO;
 import org.apache.ambari.server.orm.dao.ViewInstanceDAO;
@@ -924,16 +925,15 @@ public class AmbariServer {
 
BlueprintResourceProvider.init(injector.getInstance(BlueprintFactory.class),
 injector.getInstance(BlueprintDAO.class), 
injector.getInstance(SecurityConfigurationFactory.class),
 injector.getInstance(Gson.class), ambariMetaInfo);
-
BlueprintV2ResourceProvider.init(injector.getInstance(BlueprintV2Factor

ambari git commit: AMBARI-22325 Fixes for v2 blueprint json serialization/deserialization (benyoka)

2017-11-07 Thread benyoka
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-14714-blueprintv2 [created] 70b7d14b4


AMBARI-22325 Fixes for v2 blueprint json serialization/deserialization (benyoka)


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

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 70b7d14b44a1781ee57a5fdf1bdeee8daaf8b0c5
Parents: 527c4a2
Author: Balazs Bence Sari <beny...@apache.org>
Authored: Mon Nov 6 11:18:55 2017 +0100
Committer: Balazs Bence Sari <beny...@apache.org>
Committed: Mon Nov 6 11:18:55 2017 +0100

--
 .../ambari/server/controller/AmbariServer.java  |   1 +
 .../ambari/server/topology/BlueprintImplV2.java |  24 +++-
 .../server/topology/BlueprintV2Factory.java |  29 +++-
 .../ambari/server/topology/ComponentV2.java |   5 +
 .../ambari/server/topology/Configurable.java|  25 +++-
 .../ambari/server/topology/HostGroupV2Impl.java |   7 +
 .../apache/ambari/server/topology/Service.java  |  15 ++
 .../validators/BlueprintImplV2Test.java |  32 -
 .../resources/blueprintv2/blueprintv2_2.json| 139 +++
 9 files changed, 261 insertions(+), 16 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/70b7d14b/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 9bd8dd3..b28cb11 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
@@ -933,6 +933,7 @@ public class AmbariServer {
 .class), injector.getInstance(Gson.class));
 
HostResourceProvider.setTopologyManager(injector.getInstance(TopologyManager.class));
 BlueprintFactory.init(injector.getInstance(BlueprintDAO.class));
+BlueprintV2Factory.init(injector.getInstance(BlueprintV2DAO.class));
 BaseClusterRequest.init(injector.getInstance(BlueprintV2Factory.class));
 AmbariContext.init(injector.getInstance(HostRoleCommandFactory.class));
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/70b7d14b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java
index d31e9d4..d889fc2 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintImplV2.java
@@ -23,6 +23,7 @@ import static java.util.stream.Collectors.toList;
 import static java.util.stream.Collectors.toMap;
 import static java.util.stream.Collectors.toSet;
 
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
@@ -47,7 +48,7 @@ public class BlueprintImplV2 implements BlueprintV2 {
 
   private String name;
   private SecurityConfiguration securityConfiguration;
-  private Collection repositoryVersions;
+  private Collection repositoryVersions = new 
ArrayList<>(0);
   private Map<String, ServiceGroup> serviceGroups;
   private Setting setting;
   private Configuration configuration;
@@ -98,6 +99,11 @@ public class BlueprintImplV2 implements BlueprintV2 {
 this.repositoryVersions = repositoryVersions;
   }
 
+  @JsonProperty("repository_versions")
+  public Collection getRepositoryVersions() {
+return this.repositoryVersions;
+  }
+
   @JsonProperty("service_groups")
   public void setServiceGroups(Collection serviceGroups) {
 this.serviceGroups = serviceGroups.stream().collect(toMap( sg -> 
sg.getName(), sg -> sg ));
@@ -128,17 +134,24 @@ public class BlueprintImplV2 implements BlueprintV2 {
   }
 
   @Override
-  @JsonProperty("host_groups")
+  @JsonIgnore
   public Map<String, ? extends HostGroupV2> getHostGroups() {
 return hostGroupMap;
   }
 
+  @JsonProperty("host_groups")
+  public Collection getHostGroupsForSerialization() {
+return hostGroupMap.values();
+  }
+
   @Override
+  @JsonIgnore
   public Collection getStacks() {
 return stacks.values();
   }
 
   @Override
+  @JsonIgnore
   public Collection getStackIds() {
 return repositoryVersions.stream().map(rv -&g

ambari git commit: AMBARI-22325 Use javax.inject.Inject (benyoka)

2017-12-06 Thread benyoka
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-14714-blueprintv2 9c70083f8 -> 55c86a222


AMBARI-22325 Use javax.inject.Inject (benyoka)


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

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 55c86a222660873058182e374fde7cdc7afe0db6
Parents: 9c70083
Author: Balazs Bence Sari <beny...@apache.org>
Authored: Wed Dec 6 18:58:44 2017 +0100
Committer: Balazs Bence Sari <beny...@apache.org>
Committed: Wed Dec 6 18:59:05 2017 +0100

--
 .../java/org/apache/ambari/server/controller/StackV2Factory.java | 4 ++--
 .../ambari/server/controller/internal/BaseClusterRequest.java| 4 ++--
 .../org/apache/ambari/server/topology/BlueprintV2Factory.java| 3 ++-
 3 files changed, 6 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/55c86a22/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2Factory.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2Factory.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2Factory.java
index 0cd5ecd..8c81ffa 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2Factory.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2Factory.java
@@ -25,6 +25,8 @@ import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 
+import javax.inject.Inject;
+
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.ObjectNotFoundException;
 import org.apache.ambari.server.orm.dao.RepositoryVersionDAO;
@@ -37,8 +39,6 @@ import org.apache.ambari.server.state.StackId;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.inject.Inject;
-
 public class StackV2Factory {
   private final static Logger LOG = 
LoggerFactory.getLogger(StackV2Factory.class);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/55c86a22/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BaseClusterRequest.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BaseClusterRequest.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BaseClusterRequest.java
index b575a92..ab7c698 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BaseClusterRequest.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BaseClusterRequest.java
@@ -26,6 +26,8 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
 
+import javax.inject.Inject;
+
 import org.apache.ambari.server.StaticallyInject;
 import org.apache.ambari.server.api.predicate.InvalidQueryException;
 import org.apache.ambari.server.api.predicate.QueryLexer;
@@ -41,8 +43,6 @@ import 
org.apache.ambari.server.topology.SecurityConfiguration;
 import org.apache.ambari.server.topology.Service;
 import org.apache.ambari.server.topology.TopologyRequest;
 
-import com.google.inject.Inject;
-
 /**
  * Provides common cluster request functionality.
  */

http://git-wip-us.apache.org/repos/asf/ambari/blob/55c86a22/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
index eea2771..e5b8e13 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/BlueprintV2Factory.java
@@ -24,6 +24,8 @@ import java.util.Map;
 import java.util.Optional;
 import java.util.stream.Collectors;
 
+import javax.inject.Inject;
+
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.controller.StackV2;
 import org.apache.ambari.server.controller.StackV2Factory;
@@ -41,7 +43,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.SerializationFeature;
 import com.fasterxml.jackson.databind.module.SimpleAbstractTypeResolver;
 import com.fasterxml.jackson.databind.module.SimpleModule;
-import com.google.inject.Inject;
 
 public class BlueprintV2Factory {
   // Blueprints



ambari git commit: AMBARI-22325 Fix dependency injection for BlueprintV2Factory (benyoka)

2017-12-06 Thread benyoka
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-14714-blueprintv2 bcc0277aa -> 9c70083f8


AMBARI-22325 Fix dependency injection for BlueprintV2Factory (benyoka)


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

Branch: refs/heads/branch-feature-AMBARI-14714-blueprintv2
Commit: 9c70083f84244f3f44c5ff850d558ccc45521483
Parents: bcc0277
Author: Balazs Bence Sari <beny...@apache.org>
Authored: Wed Dec 6 16:07:11 2017 +0100
Committer: Balazs Bence Sari <beny...@apache.org>
Committed: Wed Dec 6 16:07:22 2017 +0100

--
 .../ambari/server/controller/AmbariServer.java  | 10 +++
 .../server/controller/ControllerModule.java |  4 ++-
 .../server/controller/StackV2Factory.java   | 29 +++
 .../AbstractControllerResourceProvider.java |  1 +
 .../controller/internal/BaseClusterRequest.java | 10 +++
 .../internal/BlueprintV2ResourceProvider.java   |  7 ++---
 .../server/topology/BlueprintFactory.java   |  5 ++--
 .../server/topology/BlueprintV2Factory.java | 30 +++-
 .../server/topology/BlueprintV2FactoryTest.java |  3 +-
 9 files changed, 42 insertions(+), 57 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/9c70083f/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 5b3d79e..89d66b9 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
@@ -62,7 +62,6 @@ import 
org.apache.ambari.server.configuration.ComponentSSLConfiguration;
 import org.apache.ambari.server.configuration.Configuration;
 import 
org.apache.ambari.server.controller.internal.AbstractControllerResourceProvider;
 import 
org.apache.ambari.server.controller.internal.AmbariPrivilegeResourceProvider;
-import org.apache.ambari.server.controller.internal.BaseClusterRequest;
 import org.apache.ambari.server.controller.internal.BlueprintResourceProvider;
 import 
org.apache.ambari.server.controller.internal.BlueprintV2ResourceProvider;
 import 
org.apache.ambari.server.controller.internal.ClusterPrivilegeResourceProvider;
@@ -91,7 +90,6 @@ import org.apache.ambari.server.orm.dao.MetainfoDAO;
 import org.apache.ambari.server.orm.dao.PermissionDAO;
 import org.apache.ambari.server.orm.dao.PrincipalDAO;
 import org.apache.ambari.server.orm.dao.PrivilegeDAO;
-import org.apache.ambari.server.orm.dao.RepositoryVersionDAO;
 import org.apache.ambari.server.orm.dao.ResourceDAO;
 import org.apache.ambari.server.orm.dao.UserDAO;
 import org.apache.ambari.server.orm.dao.ViewInstanceDAO;
@@ -928,15 +926,15 @@ public class AmbariServer {
 injector.getInstance(BlueprintDAO.class), 
injector.getInstance(SecurityConfigurationFactory.class),
 injector.getInstance(Gson.class), ambariMetaInfo);
 
BlueprintV2ResourceProvider.init(injector.getInstance(BlueprintV2DAO.class),
-  injector.getInstance(SecurityConfigurationFactory.class), 
ambariMetaInfo);
+injector.getInstance(SecurityConfigurationFactory.class),
+ambariMetaInfo,
+injector.getInstance(BlueprintV2Factory.class));
 StackDependencyResourceProvider.init(ambariMetaInfo);
 ClusterResourceProvider.init(injector.getInstance(TopologyManager.class),
 injector.getInstance(TopologyRequestFactoryImpl.class), 
injector.getInstance(SecurityConfigurationFactory
 .class), injector.getInstance(Gson.class));
 
HostResourceProvider.setTopologyManager(injector.getInstance(TopologyManager.class));
 BlueprintFactory.init(injector.getInstance(BlueprintDAO.class));
-BlueprintV2Factory.init(injector.getInstance(BlueprintV2DAO.class), 
injector.getInstance(RepositoryVersionDAO.class));
-
BaseClusterRequest.init(injector.getInstance(AmbariManagementController.class));
 AmbariContext.init(injector.getInstance(HostRoleCommandFactory.class));
 
 PermissionResourceProvider.init(injector.getInstance(PermissionDAO.class));
@@ -1074,10 +1072,10 @@ public class AmbariServer {
 
   public static void main(String[] args) throws Exception {
 logStartup();
-Injector injector = Guice.createInjector(new ControllerModule(), new 
AuditLoggerModule(), new LdapModule());
 
 AmbariServer server = null;
 try {
+  Injector injector = Guice.createInjector(new Controll

ambari git commit: AMBARI-22297 Fix DDL Scripts: fix stack table and add blueprintv2 table (benyoka)

2017-10-25 Thread benyoka
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-14714 c118e515a -> b0f5639cb


AMBARI-22297 Fix DDL Scripts: fix stack table and add blueprintv2 table  
(benyoka)


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

Branch: refs/heads/branch-feature-AMBARI-14714
Commit: b0f5639cb03be37d841b2b526be54a52d20e9d08
Parents: c118e51
Author: Balazs Bence Sari <beny...@apache.org>
Authored: Wed Oct 25 14:24:47 2017 +0200
Committer: Balazs Bence Sari <beny...@apache.org>
Committed: Wed Oct 25 14:25:03 2017 +0200

--
 .../src/main/resources/Ambari-DDL-Derby-CREATE.sql   | 10 ++
 .../src/main/resources/Ambari-DDL-MySQL-CREATE.sql   | 10 ++
 .../src/main/resources/Ambari-DDL-Oracle-CREATE.sql  | 11 +++
 .../src/main/resources/Ambari-DDL-Postgres-CREATE.sql| 10 ++
 .../src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql | 11 +++
 .../src/main/resources/Ambari-DDL-SQLServer-CREATE.sql   | 11 +++
 6 files changed, 63 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/b0f5639c/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 b8c0a42..0d82cd4 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
@@ -39,6 +39,7 @@ CREATE TABLE stack (
   stack_id BIGINT NOT NULL,
   stack_name VARCHAR(255) NOT NULL,
   stack_version VARCHAR(255) NOT NULL,
+  repo_version VARCHAR(255) NOT NULL,
   current_mpack_id BIGINT,
   CONSTRAINT PK_stack PRIMARY KEY (stack_id),
   CONSTRAINT FK_mpacks FOREIGN KEY (current_mpack_id) REFERENCES mpacks(id),
@@ -529,6 +530,15 @@ CREATE TABLE blueprint (
   CONSTRAINT PK_blueprint PRIMARY KEY (blueprint_name),
   CONSTRAINT FK_blueprint_stack_id FOREIGN KEY (stack_id) REFERENCES 
stack(stack_id));
 
+CREATE TABLE blueprintv2 (
+  blueprint_name VARCHAR(255) NOT NULL,
+  security_type VARCHAR(32) NOT NULL DEFAULT 'NONE',
+  security_descriptor_reference VARCHAR(255),
+  stack_id BIGINT NOT NULL,
+  content VARCHAR(32000) NOT NULL,
+  CONSTRAINT PK_blueprintv2 PRIMARY KEY (blueprint_name),
+  CONSTRAINT FK_blueprintv2_stack_id FOREIGN KEY (stack_id) REFERENCES 
stack(stack_id));
+
 CREATE TABLE hostgroup (
   blueprint_name VARCHAR(255) NOT NULL,
   name VARCHAR(255) NOT NULL,

http://git-wip-us.apache.org/repos/asf/ambari/blob/b0f5639c/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 c56e486..d70d853 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
@@ -58,6 +58,7 @@ CREATE TABLE stack (
   stack_id BIGINT NOT NULL,
   stack_name VARCHAR(100) NOT NULL,
   stack_version VARCHAR(100) NOT NULL,
+  repo_version VARCHAR(255) NOT NULL,
   current_mpack_id BIGINT,
   CONSTRAINT PK_stack PRIMARY KEY (stack_id),
   CONSTRAINT FK_mpacks FOREIGN KEY (current_mpack_id) REFERENCES mpacks(id),
@@ -546,6 +547,15 @@ CREATE TABLE blueprint (
   CONSTRAINT PK_blueprint PRIMARY KEY (blueprint_name),
   CONSTRAINT FK_blueprint_stack_id FOREIGN KEY (stack_id) REFERENCES 
stack(stack_id));
 
+CREATE TABLE blueprintv2 (
+  blueprint_name VARCHAR(255) NOT NULL,
+  security_type VARCHAR(32) NOT NULL DEFAULT 'NONE',
+  security_descriptor_reference VARCHAR(255),
+  stack_id BIGINT NOT NULL,
+  content LONGTEXT NOT NULL,
+  CONSTRAINT PK_blueprintv2 PRIMARY KEY (blueprint_name),
+  CONSTRAINT FK_blueprintv2_stack_id FOREIGN KEY (stack_id) REFERENCES 
stack(stack_id));
+
 CREATE TABLE hostgroup (
   blueprint_name VARCHAR(100) NOT NULL,
   name VARCHAR(100) NOT NULL,

http://git-wip-us.apache.org/repos/asf/ambari/blob/b0f5639c/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 8917d48..54e890d 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
@@ -39,6 +39,7 @@ CREATE TABLE stack (
   stack_id NUMBER(19) NOT NULL,
   stack_name VARCHAR

ambari git commit: AMBARI-22297 Fix getComponentInfo (benyoka)

2017-10-25 Thread benyoka
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-14714 e1fb736bd -> c118e515a


AMBARI-22297 Fix getComponentInfo  (benyoka)


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

Branch: refs/heads/branch-feature-AMBARI-14714
Commit: c118e515ab1973603362d149d253269c8b7c17a4
Parents: e1fb736
Author: Balazs Bence Sari <beny...@apache.org>
Authored: Wed Oct 25 12:00:08 2017 +0200
Committer: Balazs Bence Sari <beny...@apache.org>
Committed: Wed Oct 25 12:18:28 2017 +0200

--
 .../ambari/server/controller/StackV2.java   | 18 ---
 .../server/controller/StackV2Factory.java   | 34 +++-
 2 files changed, 39 insertions(+), 13 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/c118e515/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2.java 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2.java
index 040e604..0b0329c 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2.java
@@ -91,6 +91,8 @@ public class StackV2 {
   /** Map of service to set of excluded config types */
   private final Map<String, Set> excludedConfigurationTypes;
 
+  private final Map<String, ComponentInfo> componentInfos;
+
   public StackV2(String name,
String version,
String repoVersion,
@@ -101,7 +103,8 @@ public class StackV2 {
Map<String, Map<String, Map<String, ConfigProperty>>> 
serviceConfigurations,
Map<String, Map<String, Map<String, ConfigProperty>>> 
requiredServiceConfigurations,
Map<String, Map<String, ConfigProperty>> stackConfigurations,
-   Map<String, Set> excludedConfigurationTypes) {
+   Map<String, Set> excludedConfigurationTypes,
+   Map<String, ComponentInfo> componentInfos) {
 this.name = name;
 this.version = version;
 this.repoVersion = repoVersion;
@@ -128,6 +131,7 @@ public class StackV2 {
 this.requiredServiceConfigurations = requiredServiceConfigurations;
 this.stackConfigurations = stackConfigurations;
 this.excludedConfigurationTypes = excludedConfigurationTypes;
+this.componentInfos = componentInfos;
   }
 
   /** @return stack name */
@@ -181,17 +185,7 @@ public class StackV2 {
  */
 @Deprecated
 public ComponentInfo getComponentInfo(String component) {
-ComponentInfo componentInfo = null;
-//String service = getServiceForComponent(component);
-//if (service != null) {
-//  try {
-//  componentInfo = controller.getAmbariMetaInfo().getComponent(
-//getName(), getVersion(), service, component);
-//  } catch (AmbariException e) {
-//  // just return null if component doesn't exist
-//  }
-//}
-return componentInfo;
+  return componentInfos.get(component);
 }
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/c118e515/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2Factory.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2Factory.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2Factory.java
index ed1bbf8..784b368 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2Factory.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackV2Factory.java
@@ -18,20 +18,29 @@
 
 package org.apache.ambari.server.controller;
 
+import static java.util.AbstractMap.SimpleImmutableEntry;
+
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.stream.Collectors;
 
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.orm.entities.StackEntity;
 import org.apache.ambari.server.state.AutoDeployInfo;
+import org.apache.ambari.server.state.ComponentInfo;
 import org.apache.ambari.server.state.DependencyInfo;
 import org.apache.ambari.server.state.StackId;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class StackV2Factory {
+  private final static Logger LOG = 
LoggerFactory.getLogger(StackV2Factory.class);
+
 
   pr

ambari git commit: AMBARI-22325 Save/Retrieve v2 blueprints fix: service ids stored in set in blueprint (benyoka)

2017-10-31 Thread benyoka
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-14714 6837c1964 -> eaeed81e5


AMBARI-22325 Save/Retrieve v2 blueprints fix: service ids stored in set in 
blueprint (benyoka)


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

Branch: refs/heads/branch-feature-AMBARI-14714
Commit: eaeed81e560223ede5218efb630bb59697f6a805
Parents: 6837c19
Author: Balazs Bence Sari <beny...@apache.org>
Authored: Tue Oct 31 15:43:48 2017 +0100
Committer: Balazs Bence Sari <beny...@apache.org>
Committed: Tue Oct 31 15:44:01 2017 +0100

--
 .../org/apache/ambari/server/topology/HostGroupV2Impl.java   | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/eaeed81e/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroupV2Impl.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroupV2Impl.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroupV2Impl.java
index 2c9d1dd..01f34da 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroupV2Impl.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/HostGroupV2Impl.java
@@ -20,6 +20,7 @@ package org.apache.ambari.server.topology;
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.stream.Collectors;
 
 import javax.annotation.Nullable;
@@ -32,7 +33,6 @@ import com.google.common.base.Preconditions;
 import com.google.common.base.Predicates;
 import com.google.common.collect.Collections2;
 import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Lists;
 
 public class HostGroupV2Impl implements HostGroupV2, Configurable {
@@ -40,7 +40,7 @@ public class HostGroupV2Impl implements HostGroupV2, 
Configurable {
   private String name;
   private String blueprintName;
   private List components;
-  private List serviceIds;
+  private Set serviceIds;
   private Configuration configuration;
   private String cardinality;
   private boolean containsMasterComponent;
@@ -128,7 +128,7 @@ public class HostGroupV2Impl implements HostGroupV2, 
Configurable {
 
   @JsonIgnore
   public void setServiceMap(Map<ServiceId, Service> serviceMap) {
-
Preconditions.checkArgument(serviceMap.keySet().equals(ImmutableSet.copyOf(this.serviceIds)),
+Preconditions.checkArgument(serviceMap.keySet().equals(this.serviceIds),
   "Maitained list of service ids doesn't match with received service map: 
%s vs %s", serviceIds, serviceMap.keySet());
 this.serviceMap = serviceMap;
   }
@@ -154,7 +154,7 @@ public class HostGroupV2Impl implements HostGroupV2, 
Configurable {
   public void setComponents(List components) {
 this.components = components;
 this.containsMasterComponent = components.stream().anyMatch(c -> 
c.isMasterComponent());
-this.serviceIds = components.stream().map(c -> 
c.getServiceId()).collect(Collectors.toList());
+this.serviceIds = components.stream().map(c -> 
c.getServiceId()).collect(Collectors.toSet());
   }
 
   public void setConfiguration(Configuration configuration) {



ambari git commit: AMBARI-22325 Save/Retrieve v2 blueprints (benyoka)

2017-10-31 Thread benyoka
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-14714 70077fe02 -> 6837c1964


AMBARI-22325 Save/Retrieve v2 blueprints (benyoka)


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

Branch: refs/heads/branch-feature-AMBARI-14714
Commit: 6837c196434ee722bf666d6894fe4510858a0ea0
Parents: 70077fe
Author: Balazs Bence Sari <beny...@apache.org>
Authored: Tue Oct 31 11:39:01 2017 +0100
Committer: Balazs Bence Sari <beny...@apache.org>
Committed: Tue Oct 31 11:39:45 2017 +0100

--
 .../internal/BlueprintV2ResourceProvider.java |  7 +++
 .../apache/ambari/server/orm/dao/BlueprintV2DAO.java  | 11 ---
 .../ambari/server/topology/BlueprintImplV2.java   | 14 +-
 .../ambari/server/topology/BlueprintV2Factory.java|  7 +++
 .../src/main/resources/Ambari-DDL-Derby-CREATE.sql|  4 +---
 .../src/main/resources/Ambari-DDL-MySQL-CREATE.sql|  4 +---
 .../src/main/resources/Ambari-DDL-Oracle-CREATE.sql   |  4 +---
 .../src/main/resources/Ambari-DDL-Postgres-CREATE.sql |  4 +---
 .../main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql  |  4 +---
 .../main/resources/Ambari-DDL-SQLServer-CREATE.sql|  4 +---
 .../src/main/resources/META-INF/persistence.xml   |  1 +
 ambari-server/src/main/resources/properties.json  |  5 +++--
 .../src/test/resources/blueprintv2/blueprintv2.json   |  2 +-
 13 files changed, 46 insertions(+), 25 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/6837c196/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintV2ResourceProvider.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintV2ResourceProvider.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintV2ResourceProvider.java
index ccc9836..6d2c4f0 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintV2ResourceProvider.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintV2ResourceProvider.java
@@ -139,6 +139,7 @@ public class BlueprintV2ResourceProvider extends 
AbstractControllerResourceProvi
 AmbariManagementController controller) {
 
 super(propertyIds, keyPropertyIds, controller);
+blueprintFactory = BlueprintV2Factory.create(controller);
   }
 
   /**
@@ -286,6 +287,12 @@ public class BlueprintV2ResourceProvider extends 
AbstractControllerResourceProvi
 applySelectFilters(requestedIds, blueprintAsMap, filteredMap);
 blueprintAsMap = filteredMap;
   }
+  // flatten the Blueprint property category
+  Map<String, Object> blueprintPc = (Map<String, 
Object>)blueprintAsMap.remove(BLUEPRINTS_PROPERTY_ID);
+  for (Map.Entry<String, Object> entry: blueprintPc.entrySet()) {
+blueprintAsMap.put(BLUEPRINTS_PROPERTY_ID + "/" + entry.getKey(), 
entry.getValue());
+  }
+  // set resources
   blueprintAsMap.entrySet().forEach( entry -> 
resource.setProperty(entry.getKey(), entry.getValue()) );
   return resource;
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/6837c196/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/BlueprintV2DAO.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/BlueprintV2DAO.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/BlueprintV2DAO.java
index 267ae05..6a054e8 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/BlueprintV2DAO.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/BlueprintV2DAO.java
@@ -25,6 +25,8 @@ import javax.persistence.TypedQuery;
 
 import org.apache.ambari.server.orm.RequiresSession;
 import org.apache.ambari.server.orm.entities.BlueprintV2Entity;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.google.inject.Inject;
 import com.google.inject.Provider;
@@ -37,6 +39,8 @@ import com.google.inject.persist.Transactional;
 @Singleton
 public class BlueprintV2DAO {
 
+  protected final static Logger LOG = 
LoggerFactory.getLogger(BlueprintV2DAO.class);
+
   /**
* JPA entity manager
*/
@@ -114,11 +118,12 @@ public class BlueprintV2DAO {
 
   /**
* Remove entity instance by primary key
-   * @param blueprint_name Primary key: blueprint name
+   * @param blueprintName Primary key: blueprint name
*/
   @Transactional
-  public void removeByName(String bl

[ambari] branch branch-feature-AMBARI-14714 updated: AMBARI-23575 - Download mpacks during blueprint luster provisioning (benyoka) (#1209)

2018-05-08 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch branch-feature-AMBARI-14714
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-feature-AMBARI-14714 by 
this push:
 new 3782e18  AMBARI-23575 - Download mpacks during blueprint luster 
provisioning (benyoka) (#1209)
3782e18 is described below

commit 3782e18bdd5cbf72a61e57fe2f8ab662bb56e9ff
Author: benyoka <beny...@users.noreply.github.com>
AuthorDate: Tue May 8 20:47:04 2018 +0200

AMBARI-23575 - Download mpacks during blueprint luster provisioning 
(benyoka) (#1209)

* AMBARI-23575 download mpacks during custer provisioning (benyoka)

* AMBARI-23575 add javadoc (benyoka)

* AMBARI-23575 unit test for DownloadMpackTask (benyoka)

* AMBARI-23575 fix TopologyManager unit tests WIP (benyoka)

* AMBARI-23575 fix TopologyManagerTest

* AMBARI-23575 add new topology manager test (benyoka)

* AMBARI-23575 small improvements (benyoka)

* AMBARI-23575 remove static dependencies from DownloadMpackTask (benyoka)
---
 .../ambari/server/controller/MpackRequest.java |   3 +-
 .../internal/ProvisionClusterRequest.java  |  11 ++
 .../ambari/server/topology/DownloadMpacksTask.java | 111 +
 .../ambari/server/topology/TopologyManager.java|   9 +-
 .../server/topology/DownloadMpacksTaskTest.java| 138 +
 .../server/topology/TopologyManagerTest.java   | 105 
 6 files changed, 351 insertions(+), 26 deletions(-)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/MpackRequest.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/MpackRequest.java
index 49d0caa..efabc51 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/MpackRequest.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/MpackRequest.java
@@ -81,8 +81,7 @@ public class MpackRequest {
 
   @Override
   public int hashCode() {
-int result = 1;
-result = 31 + getId().hashCode();
+int result = 31 + (null != getId() ? getId().hashCode() : 0);
 return result;
   }
 
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 1bca924..3b3700e 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
@@ -54,6 +54,7 @@ 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.ImmutableSet;
 
 /**
  * Request for provisioning a cluster.
@@ -501,6 +502,16 @@ public class ProvisionClusterRequest extends 
BaseClusterRequest implements Provi
 return mpackInstances;
   }
 
+  /**
+   * @return a set containing the mpacks in the provision request and the 
blueprint combined.
+   */
+  public Set getAllMpacks() {
+return ImmutableSet.builder().
+  addAll(mpackInstances).
+  addAll(blueprint.getMpacks()).
+  build();
+  }
+
   @Override
   public TopologyRequestEntity toEntity() {
 TopologyRequestEntity entity = super.toEntity();
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/DownloadMpacksTask.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/DownloadMpacksTask.java
new file mode 100644
index 000..2216936
--- /dev/null
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/DownloadMpacksTask.java
@@ -0,0 +1,111 @@
+/*
+ * 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.topology;
+
+import static java.util.stream.Collectors.toList;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.ambari.server.StackAccessException;
+import org.apache.ambari.server.api.servic

[ambari] branch branch-feature-AMBARI-14714 updated: AMBARI-23032 export cluster as blueprint for 3.0 update (#1367)

2018-05-25 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch branch-feature-AMBARI-14714
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-feature-AMBARI-14714 by 
this push:
 new 7bbf158  AMBARI-23032 export cluster as blueprint for 3.0 update 
(#1367)
7bbf158 is described below

commit 7bbf1586fcadcf368aa80b85f94ead553d9d444c
Author: benyoka <beny...@users.noreply.github.com>
AuthorDate: Fri May 25 18:39:26 2018 +0200

AMBARI-23032 export cluster as blueprint for 3.0 update (#1367)

* AMBARI-23032 fix execptions, export cluster settings and single mpacks 
(benyoka)

* AMBARI-23032 fix review comments (benyoka)

* AMBARI-23032 better method naming (benyoka)

* AMBARI-23032 fix review comments #2 (benyoka)

* AMBARI-23032 fix review comments #3 (benyoka)

* AMBARI-23032 fix swallowed exceptions during mpack installation

* AMBARI-23032 prepare for mpack info in component

* AMBARI-23032 fix exceptions during installation and blueprint export 
(benyoka)

* AMBARI-23032 revert accidental changes (benyoka)

* AMBARI-23032 revert accidental changes #2 (benyoka)

* AMBARI-23032 fixed a number of unit tests (benyoka)

* AMBARI-23032 make sure Blueprints tag is exported (benyoka)

* Merge branch-feature-AMBARI-14714

* AMBARI-23032 fix import error (benyoka)

* AMBARI-23032 fix equals() in Component (benyoka)
---
 .../server/api/query/render/ClusterBlueprintRenderer.java  | 10 +-
 .../server/controller/internal/ExportBlueprintRequest.java |  2 +-
 .../main/java/org/apache/ambari/server/topology/Component.java |  3 ++-
 .../server/api/query/render/ClusterBlueprintRendererTest.java  |  4 
 4 files changed, 12 insertions(+), 7 deletions(-)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/ClusterBlueprintRenderer.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/ClusterBlueprintRenderer.java
index e2c9bfd..c7ad7e3 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/ClusterBlueprintRenderer.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/ClusterBlueprintRenderer.java
@@ -244,13 +244,13 @@ public class ClusterBlueprintRenderer extends 
BaseRenderer implements Renderer {
* Adds mpack instances to the exported blueprint resource.
*/
   private void addMpackInstances(Resource blueprintResource, 
TreeNode clusterNode) {
-List<Map<String, Object>> mpackInstances = 
clusterNode.getChild("stack_versions").getChildren().stream().map(
+// TODO: find a way to add mpack uri
+List<Map<String, Object>> mpackInstances = 
clusterNode.getChild("servicegroups").getChildren().stream().map(
   child -> {
-Map<String, Object> stackVersionProps = 
child.getObject().getPropertiesMap().get("ClusterStackVersions");
+Map<String, Object> serviceGroupProps = 
child.getObject().getPropertiesMap().get("ServiceGroupInfo");
 return ImmutableMap.of(
-  "name", stackVersionProps.get("stack"),
-  "version", stackVersionProps.get("version"),
-  "url", stackVersionProps.get("mpack_uri"));
+  "name", serviceGroupProps.get("mpack_name"),
+  "version", serviceGroupProps.get("mpack_version"));
   }).
   collect(toList());
 
blueprintResource.setProperty(BlueprintResourceProvider.MPACK_INSTANCES_PROPERTY_ID,
 mpackInstances);
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ExportBlueprintRequest.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ExportBlueprintRequest.java
index 14179f4..dc3f2d5 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ExportBlueprintRequest.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ExportBlueprintRequest.java
@@ -82,7 +82,7 @@ public class ExportBlueprintRequest implements 
TopologyRequest {
 // create service group to mpack map
 serviceGroupToMpack = 
clusterNode.getChild("servicegroups").getChildren().stream().
   map(tn -> 
tn.getObject().getPropertiesMap().get(ServiceGroupResourceProvider.RESPONSE_KEY)).
-  collect(toMap(m -> m.get("service_group_name").toString(), m -> new 
StackId(m.get("version").toString(;
+  collect(toMap(m -> m.get("service_group_name").toString(), m -> new 
StackId(m.get("stack").toString(;
 
 createConfiguration(clusterNode);
 //todo: should be parsing Configuration from the beginning
diff --git

[ambari] branch branch-feature-AMBARI-14714 updated: [AMBARI 24101] detailed error reporting for blueprint mpack download (benyoka) (#1543)

2018-06-15 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch branch-feature-AMBARI-14714
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-feature-AMBARI-14714 by 
this push:
 new c9a804d  [AMBARI 24101] detailed error reporting for blueprint mpack 
download (benyoka) (#1543)
c9a804d is described below

commit c9a804d9617cc5f8f0e0308c19b348ec32486d78
Author: benyoka 
AuthorDate: Fri Jun 15 22:39:33 2018 +0200

[AMBARI 24101] detailed error reporting for blueprint mpack download 
(benyoka) (#1543)

* AMBARI-24101 more detailed error reporting in DownloadMpacksTask (benyoka)

* AMBARI-24101 add mpack uri to the error message (benyoka)

* AMBARI-24101 fix review comment (benyoka)
---
 .../ambari/server/topology/DownloadMpacksTask.java | 10 ++---
 .../server/topology/DownloadMpacksTaskTest.java| 26 ++
 2 files changed, 33 insertions(+), 3 deletions(-)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/DownloadMpacksTask.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/DownloadMpacksTask.java
index 2216936..e267174 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/DownloadMpacksTask.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/DownloadMpacksTask.java
@@ -29,6 +29,7 @@ import 
org.apache.ambari.server.controller.internal.MpackResourceProvider;
 import org.apache.ambari.server.controller.spi.Request;
 import org.apache.ambari.server.controller.spi.RequestStatus;
 import org.apache.ambari.server.controller.utilities.PropertyHelper;
+import org.apache.commons.lang3.exception.ExceptionUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -72,9 +73,12 @@ public class DownloadMpacksTask {
 }
   }
   catch (Exception ex) {
-throw ex instanceof RuntimeException ?
-  (RuntimeException)ex :
-  new RuntimeException("Error occured while registering mpack: " + 
mpack.getStackId(), ex);
+List causes = ExceptionUtils.getThrowableList(ex);
+Throwable rootCause = causes.get(causes.size() - 1);
+throw new RuntimeException(
+  String.format("Error occured while registering mpack: %s (uri: %s). 
Caused by %s: %s", mpack.getStackId(),
+mpack.getUrl(), rootCause.getClass().getName(), 
rootCause.getMessage(),
+  rootCause));
   }
 }
   }
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/DownloadMpacksTaskTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/DownloadMpacksTaskTest.java
index bce2a1e..66c6e0f 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/topology/DownloadMpacksTaskTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/topology/DownloadMpacksTaskTest.java
@@ -28,10 +28,12 @@ import static org.easymock.EasyMock.expect;
 import static org.easymock.EasyMock.mock;
 import static org.easymock.EasyMock.newCapture;
 import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.reset;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
+import java.net.UnknownHostException;
 import java.util.List;
 import java.util.Set;
 
@@ -40,16 +42,22 @@ import org.apache.ambari.server.api.services.AmbariMetaInfo;
 import org.apache.ambari.server.controller.internal.MpackResourceProvider;
 import org.apache.ambari.server.controller.internal.RequestStatusImpl;
 import org.apache.ambari.server.controller.spi.Request;
+import org.apache.ambari.server.controller.spi.SystemException;
 import org.apache.ambari.server.state.StackId;
 import org.easymock.Capture;
 import org.easymock.CaptureType;
 import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.ExpectedException;
 
 import com.google.common.collect.ImmutableList;
 
 public class DownloadMpacksTaskTest {
 
+  @Rule
+  public ExpectedException expectedException = ExpectedException.none();
+
   private static final List INSTALLED_MPACKS = ImmutableList.of(
 mpack("HDPCORE", "1.0.0.0"),
 mpack("HDF", "3.1.1.0"));
@@ -118,6 +126,24 @@ public class DownloadMpacksTaskTest {
 downloadMpacksTask.downloadMissingMpacks(ImmutableList.of(brokenMpack));
   }
 
+  @Test
+  public void testDownloadMissingMpacks_errorReporting() throws Exception {
+// then
+expectedException.expect(RuntimeException.class);
+expectedException.expectMessage(
+  "Error occured while registering mpack: EDW-1.0.0 (uri: 
http://mpacks.org/EDW.1.0.0). " +
+"Caused by java.net.UnknownHostException: mpacks.org");
+
+// given
+reset(resourceProvider);
+expect(resourceProvider.createResources(

[ambari] branch branch-feature-AMBARI-14714 updated: [Ambari 23959] Save service Id with cluster configuration during blueprint cluster creation (benyoka) (#1519)

2018-06-19 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch branch-feature-AMBARI-14714
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-feature-AMBARI-14714 by 
this push:
 new 0a7a6f7  [Ambari 23959] Save service Id with cluster configuration 
during blueprint cluster creation (benyoka) (#1519)
0a7a6f7 is described below

commit 0a7a6f77be3c9475519ebe00d1257fa224a3aea6
Author: benyoka 
AuthorDate: Tue Jun 19 17:24:45 2018 +0200

[Ambari 23959] Save service Id with cluster configuration during blueprint 
cluster creation (benyoka) (#1519)

* AMBARI-23959 service level configs with bp install, initial version 
(benyoka)

* AMBARI-23959 fix ClusterImpl config issue (benyoka)

* AMBARI-23959 fixed unit tests (benyoka)

* AMBARI-23959 write new unit tests (benyoka)

* AMBARI-23959 fix review comments (benyoka)
---
 .../controller/AmbariManagementControllerImpl.java | 238 +++
 .../ambari/server/controller/ServiceResponse.java  |  23 ++
 .../internal/BlueprintConfigurationProcessor.java  |   2 +-
 .../server/controller/internal/CompositeStack.java |   2 +-
 .../internal/ProvisionClusterRequest.java  |   2 +-
 .../internal/ServiceGroupResourceProvider.java |   2 +-
 .../internal/ServiceResourceProvider.java  |   2 +-
 .../ambari/server/controller/internal/Stack.java   |   2 +-
 .../controller/internal/StackDefinition.java   |   4 +-
 .../ambari/server/state/cluster/ClusterImpl.java   |  12 +-
 .../ambari/server/topology/AmbariContext.java  |  18 +-
 .../server/topology/AsyncCallableService.java  |   2 +-
 .../BlueprintBasedClusterProvisionRequest.java |   4 +
 .../topology/ClusterConfigurationRequest.java  | 257 +++--
 .../ambari/server/topology/ClusterTopology.java|   8 +
 .../server/topology/ClusterTopologyImpl.java   |  22 +-
 .../topology/ConfigRecommendationStrategy.java |  24 +-
 .../ambari/server/topology/HostGroupInfo.java  |   5 +-
 .../ambari/server/topology/TopologyManager.java|  18 +-
 .../topology/tasks/ConfigureClusterTask.java   |  10 +-
 .../BlueprintConfigurationProcessorTest.java   |   1 +
 .../server/state/cluster/ClusterImplTest.java  |  46 
 .../ambari/server/topology/AmbariContextTest.java  |   5 +-
 .../topology/ClusterConfigurationRequestTest.java  | 138 +--
 .../topology/ClusterDeployWithStartOnlyTest.java   |   4 +-
 ...terInstallWithoutStartOnComponentLevelTest.java |   4 +-
 .../topology/ClusterInstallWithoutStartTest.java   |   5 +-
 .../server/topology/ConfigureClusterTaskTest.java  |   7 +
 .../server/topology/TopologyManagerTest.java   |  18 +-
 29 files changed, 502 insertions(+), 383 deletions(-)

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 127d8b3..aa92bac 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
@@ -1842,82 +1842,7 @@ public class AmbariManagementControllerImpl implements 
AmbariManagementControlle
 }
 
 //check if desired configs are available in request and they were changed
-boolean isConfigurationCreationNeeded = false;
-if (desiredConfigs != null) {
-  for (ConfigurationRequest desiredConfig : desiredConfigs) {
-Map requestConfigProperties = 
desiredConfig.getProperties();
-Map> requestConfigAttributes = 
desiredConfig.getPropertiesAttributes();
-
-// processing password properties
-if(requestConfigProperties != null && 
!requestConfigProperties.isEmpty()) {
-  Map> propertiesTypes = 
cluster.getConfigPropertiesTypes(
-  desiredConfig.getType()
-  );
-  for (Entry property : 
requestConfigProperties.entrySet()) {
-String propertyName = property.getKey();
-String propertyValue = property.getValue();
-if ((propertiesTypes.containsKey(PropertyType.PASSWORD) &&
-
propertiesTypes.get(PropertyType.PASSWORD).contains(propertyName)) ||
-(requestConfigAttributes != null && 
requestConfigAttributes.containsKey(PASSWORD) &&
-
requestConfigAttributes.get(PASSWORD).containsKey(propertyName) &&
-
requestConfigAttributes.get(PASSWORD).get(propertyName).equals("true"))) {
-  if (SecretReference.isSecret(propertyValue)) {
-SecretReference ref = new SecretReference(propertyValue, 
cluster);
-requestConfigProperties.put(propertyName, ref.getValue());
-  }

[2/2] ambari git commit: AMBARI-22297 BlueprintV2ResourceProvider, fixes in object model, startup logging fix (benyoka)

2017-10-27 Thread benyoka
AMBARI-22297 BlueprintV2ResourceProvider,fixes in object model, startup logging 
fix (benyoka)


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

Branch: refs/heads/branch-feature-AMBARI-14714
Commit: 36013fe43c297b4e170b9eac23f7f0c8c7131f33
Parents: d8406d0
Author: Balazs Bence Sari <beny...@apache.org>
Authored: Fri Oct 27 11:05:14 2017 +0200
Committer: Balazs Bence Sari <beny...@apache.org>
Committed: Fri Oct 27 14:45:44 2017 +0200

--
 .../ambari/server/controller/AmbariServer.java  |   2 +-
 .../internal/BlueprintV2ResourceProvider.java   | 391 +++
 .../server/orm/entities/BlueprintV2Entity.java  |  29 --
 .../ambari/server/topology/BlueprintImplV2.java |  10 +
 .../ambari/server/topology/BlueprintV2.java |   3 +
 .../server/topology/BlueprintV2Factory.java |  51 ++-
 .../internal/BlueprintResourceProviderTest.java |   5 +-
 .../validators/BlueprintImplV2Test.java |   7 +-
 8 files changed, 447 insertions(+), 51 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/36013fe4/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 f900452..afe5647 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
@@ -1065,10 +1065,10 @@ public class AmbariServer {
 
   public static void main(String[] args) throws Exception {
 logStartup();
-Injector injector = Guice.createInjector(new ControllerModule(), new 
AuditLoggerModule());
 
 AmbariServer server = null;
 try {
+  Injector injector = Guice.createInjector(new ControllerModule(), new 
AuditLoggerModule());
   LOG.info("Getting the controller");
 
   // check if this instance is the active instance

http://git-wip-us.apache.org/repos/asf/ambari/blob/36013fe4/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintV2ResourceProvider.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintV2ResourceProvider.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintV2ResourceProvider.java
new file mode 100644
index 000..ccc9836
--- /dev/null
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintV2ResourceProvider.java
@@ -0,0 +1,391 @@
+/*
+ * 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.controller.internal;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.ambari.server.AmbariException;
+import org.apache.ambari.server.DuplicateResourceException;
+import org.apache.ambari.server.api.services.AmbariMetaInfo;
+import org.apache.ambari.server.controller.AmbariManagementController;
+import org.apache.ambari.server.controller.spi.NoSuchParentResourceException;
+import org.apache.ambari.server.controller.spi.NoSuchResourceException;
+import org.apache.ambari.server.controller.spi.Predicate;
+import org.apache.ambari.server.controller.spi.Request;
+import org.apache.ambari.server.controller.spi.RequestStatus;
+import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.ambari.server.controller.spi.ResourceAlreadyExistsException;
+import org.apache.ambari.serv

[1/2] ambari git commit: AMBARI-22325 Blueprint Service uses Blueprint V2 resource provider (benyoka)

2017-10-27 Thread benyoka
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-14714 d8406d0be -> 93a6dbf94


AMBARI-22325 Blueprint Service uses Blueprint V2 resource provider (benyoka)


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

Branch: refs/heads/branch-feature-AMBARI-14714
Commit: 93a6dbf94f9016a101550df20fc9ec4bab1756b3
Parents: 36013fe
Author: Balazs Bence Sari <beny...@apache.org>
Authored: Fri Oct 27 14:44:37 2017 +0200
Committer: Balazs Bence Sari <beny...@apache.org>
Committed: Fri Oct 27 14:45:44 2017 +0200

--
 .../java/org/apache/ambari/server/controller/AmbariServer.java  | 5 +
 .../controller/internal/AbstractControllerResourceProvider.java | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/93a6dbf9/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 afe5647..e2553cb 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
@@ -64,6 +64,7 @@ import 
org.apache.ambari.server.controller.internal.AbstractControllerResourcePr
 import 
org.apache.ambari.server.controller.internal.AmbariPrivilegeResourceProvider;
 import org.apache.ambari.server.controller.internal.BaseClusterRequest;
 import org.apache.ambari.server.controller.internal.BlueprintResourceProvider;
+import 
org.apache.ambari.server.controller.internal.BlueprintV2ResourceProvider;
 import 
org.apache.ambari.server.controller.internal.ClusterPrivilegeResourceProvider;
 import org.apache.ambari.server.controller.internal.ClusterResourceProvider;
 import org.apache.ambari.server.controller.internal.HostResourceProvider;
@@ -82,6 +83,7 @@ import org.apache.ambari.server.metrics.system.MetricsService;
 import org.apache.ambari.server.orm.GuiceJpaInitializer;
 import org.apache.ambari.server.orm.PersistenceType;
 import org.apache.ambari.server.orm.dao.BlueprintDAO;
+import org.apache.ambari.server.orm.dao.BlueprintV2DAO;
 import org.apache.ambari.server.orm.dao.ClusterDAO;
 import org.apache.ambari.server.orm.dao.GroupDAO;
 import org.apache.ambari.server.orm.dao.MetainfoDAO;
@@ -921,6 +923,9 @@ public class AmbariServer {
 
BlueprintResourceProvider.init(injector.getInstance(BlueprintFactory.class),
 injector.getInstance(BlueprintDAO.class), 
injector.getInstance(SecurityConfigurationFactory.class),
 injector.getInstance(Gson.class), ambariMetaInfo);
+
BlueprintV2ResourceProvider.init(injector.getInstance(BlueprintV2Factory.class),
+  injector.getInstance(BlueprintV2DAO.class), 
injector.getInstance(SecurityConfigurationFactory.class),
+  ambariMetaInfo);
 StackDependencyResourceProvider.init(ambariMetaInfo);
 ClusterResourceProvider.init(injector.getInstance(TopologyManager.class),
 injector.getInstance(TopologyRequestFactoryImpl.class), 
injector.getInstance(SecurityConfigurationFactory

http://git-wip-us.apache.org/repos/asf/ambari/blob/93a6dbf9/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractControllerResourceProvider.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractControllerResourceProvider.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractControllerResourceProvider.java
index afca803..4ffd8d1 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractControllerResourceProvider.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractControllerResourceProvider.java
@@ -233,7 +233,7 @@ public abstract class AbstractControllerResourceProvider 
extends AbstractAuthori
   case HostComponentProcess:
 return new HostComponentProcessResourceProvider(propertyIds, 
keyPropertyIds, managementController);
   case Blueprint:
-return new BlueprintResourceProvider(propertyIds, keyPropertyIds, 
managementController);
+return new BlueprintV2ResourceProvider(propertyIds, keyPropertyIds, 
managementController);
   case KerberosDescriptor:
 return 
resourceProviderFactory.getKerberosDescriptorResourceProvider(managementController,
 propertyIds, keyPropertyId

ambari git commit: AMBARI-22325 Fix compile issue (benyoka)

2017-10-27 Thread benyoka
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-14714 93a6dbf94 -> 259036f9c


AMBARI-22325 Fix compile issue (benyoka)


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

Branch: refs/heads/branch-feature-AMBARI-14714
Commit: 259036f9c2ae5e35566feca16f3f0c0ace4d8ed9
Parents: 93a6dbf
Author: Balazs Bence Sari <beny...@apache.org>
Authored: Fri Oct 27 18:03:24 2017 +0200
Committer: Balazs Bence Sari <beny...@apache.org>
Committed: Fri Oct 27 18:03:24 2017 +0200

--
 .../apache/ambari/server/orm/dao/BlueprintV2DAO.java| 12 
 1 file changed, 12 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/ambari/blob/259036f9/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/BlueprintV2DAO.java
--
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/BlueprintV2DAO.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/BlueprintV2DAO.java
index 8a21dc1..267ae05 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/BlueprintV2DAO.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/BlueprintV2DAO.java
@@ -25,7 +25,6 @@ import javax.persistence.TypedQuery;
 
 import org.apache.ambari.server.orm.RequiresSession;
 import org.apache.ambari.server.orm.entities.BlueprintV2Entity;
-import org.apache.ambari.server.orm.entities.StackEntity;
 
 import com.google.inject.Inject;
 import com.google.inject.Provider;
@@ -79,7 +78,6 @@ public class BlueprintV2DAO {
*/
   @Transactional
   public void refresh(BlueprintV2Entity blueprintEntity) {
-ensureStackIdSet(blueprintEntity);
 entityManagerProvider.get().refresh(blueprintEntity);
   }
 
@@ -90,7 +88,6 @@ public class BlueprintV2DAO {
*/
   @Transactional
   public void create(BlueprintV2Entity blueprintEntity) {
-ensureStackIdSet(blueprintEntity);
 entityManagerProvider.get().persist(blueprintEntity);
   }
 
@@ -102,7 +99,6 @@ public class BlueprintV2DAO {
*/
   @Transactional
   public BlueprintV2Entity merge(BlueprintV2Entity blueprintEntity) {
-ensureStackIdSet(blueprintEntity);
 return entityManagerProvider.get().merge(blueprintEntity);
   }
 
@@ -113,7 +109,6 @@ public class BlueprintV2DAO {
*/
   @Transactional
   public void remove(BlueprintV2Entity blueprintEntity) {
-ensureStackIdSet(blueprintEntity);
 entityManagerProvider.get().remove(merge(blueprintEntity));
   }
 
@@ -126,11 +121,4 @@ public class BlueprintV2DAO {
 entityManagerProvider.get().remove(findByName(blueprint_name));
   }
 
-  private void ensureStackIdSet(BlueprintV2Entity entity) {
-StackEntity stack = entity.getStack();
-if (stack != null && stack.getStackId() == null) {
-  entity.setStack(stackDAO.find(stack.getStackName(), 
stack.getStackVersion()));
-}
-  }
-
 }



[ambari] branch branch-feature-AMBARI-14714 updated: AMBARI-22776 Ambari Blueprint 3.0/3.1 database tables and JPA objects + DDL cleanup (#109) (benyoka)

2018-01-24 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch branch-feature-AMBARI-14714
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-feature-AMBARI-14714 by 
this push:
 new 2d8d32a  AMBARI-22776 Ambari Blueprint 3.0/3.1 database tables and JPA 
objects + DDL cleanup (#109) (benyoka)
2d8d32a is described below

commit 2d8d32a2455851b44e6cd597825371286bcdc459
Author: benyoka <beny...@users.noreply.github.com>
AuthorDate: Wed Jan 24 20:54:50 2018 +0100

AMBARI-22776 Ambari Blueprint 3.0/3.1 database tables and JPA objects + DDL 
cleanup (#109) (benyoka)

* AMBARI-22776 Blueprint 3.0 Database schemas and JPA objects, DDL fixes 
(benyoka)

* AMBARI-22776 Revert accidental commit (benyoka)

* AMBARI-22776 Revert accidental change #2 (benyoka)

* AMBARI-22776 Fix review findings (benyoka)

* AMBARI-22776 Fix review findings #2 (benyoka)

* AMBARI-22776 remove blueprint -> stack reference, docs (benyoka)

* AMBARI-22776 fix build issues (benyoka)

* AMBARI-22776 Add MpackInstanceEntity -> MpackEntity reference (benyoka)
---
 .../internal/BlueprintResourceProvider.java|  12 +-
 .../apache/ambari/server/orm/dao/BlueprintDAO.java |  14 --
 .../server/orm/entities/BlueprintEntity.java   |  46 ++---
 .../orm/entities/BlueprintMpackConfigEntity.java   | 149 
 .../orm/entities/BlueprintMpackConfigEntityPk.java |  51 ++
 .../orm/entities/BlueprintMpackInstanceEntity.java | 190 +
 .../orm/entities/BlueprintServiceConfigEntity.java | 147 
 .../entities/BlueprintServiceConfigEntityPk.java   |  52 ++
 .../orm/entities/BlueprintServiceEntity.java   | 129 ++
 .../orm/entities/HostGroupComponentEntity.java |  87 +-
 .../orm/entities/HostGroupComponentEntityPK.java   | 116 -
 .../server/orm/entities/HostGroupEntity.java   |   7 +-
 .../ambari/server/topology/BlueprintImpl.java  |   9 -
 .../src/main/resources/Ambari-DDL-Derby-CREATE.sql |  72 +---
 .../src/main/resources/Ambari-DDL-MySQL-CREATE.sql |  80 +
 .../main/resources/Ambari-DDL-Oracle-CREATE.sql|  81 +
 .../main/resources/Ambari-DDL-Postgres-CREATE.sql  |  50 +-
 .../resources/Ambari-DDL-SQLAnywhere-CREATE.sql|  69 +---
 .../main/resources/Ambari-DDL-SQLServer-CREATE.sql |  76 ++---
 .../src/main/resources/META-INF/persistence.xml|   4 +
 .../internal/BlueprintResourceProviderTest.java|  42 ++---
 .../org/apache/ambari/server/orm/db/DDLTests.java  |  43 +++--
 .../server/orm/entities/BlueprintEntityTest.java   |   7 -
 .../server/orm/entities/BlueprintEntityTest2.java  | 183 
 24 files changed, 1341 insertions(+), 375 deletions(-)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintResourceProvider.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintResourceProvider.java
index c665aec..b9899bd 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintResourceProvider.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintResourceProvider.java
@@ -46,10 +46,10 @@ import org.apache.ambari.server.orm.dao.BlueprintDAO;
 import org.apache.ambari.server.orm.entities.BlueprintConfigEntity;
 import org.apache.ambari.server.orm.entities.BlueprintConfiguration;
 import org.apache.ambari.server.orm.entities.BlueprintEntity;
+import org.apache.ambari.server.orm.entities.BlueprintMpackInstanceEntity;
 import org.apache.ambari.server.orm.entities.BlueprintSettingEntity;
 import org.apache.ambari.server.orm.entities.HostGroupComponentEntity;
 import org.apache.ambari.server.orm.entities.HostGroupEntity;
-import org.apache.ambari.server.orm.entities.StackEntity;
 import org.apache.ambari.server.stack.NoSuchStackException;
 import org.apache.ambari.server.state.SecurityType;
 import org.apache.ambari.server.state.StackInfo;
@@ -309,11 +309,8 @@ public class BlueprintResourceProvider extends 
AbstractControllerResourceProvide
* @return a new resource instance for the given blueprint entity
*/
   protected Resource toResource(BlueprintEntity entity, Set 
requestedIds) throws NoSuchResourceException {
-StackEntity stackEntity = entity.getStack();
 Resource resource = new ResourceImpl(Resource.Type.Blueprint);
 setResourceProperty(resource, BLUEPRINT_NAME_PROPERTY_ID, 
entity.getBlueprintName(), requestedIds);
-setResourceProperty(resource, STACK_NAME_PROPERTY_ID, 
stackEntity.getStackName(), requestedIds);
-setResourceProperty(resource, STACK_VERSION_PROPERTY_ID, 
stackEntity.getStackVersion(), requestedIds);
 
 List<Map<String, Object>> listGroupProps = new ArrayList<>();
 Collection hos

[ambari] branch branch-2.6 updated: AMBARI-22413 fix tar_archive.archive_directory_dereference (benyoka) (#196)

2018-01-26 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch branch-2.6
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-2.6 by this push:
 new e08d056  AMBARI-22413 fix tar_archive.archive_directory_dereference 
(benyoka) (#196)
e08d056 is described below

commit e08d056521cdd1a53bb31e4fff9d93ec64af3f23
Author: benyoka <beny...@users.noreply.github.com>
AuthorDate: Fri Jan 26 18:52:17 2018 +0100

AMBARI-22413 fix tar_archive.archive_directory_dereference (benyoka) (#196)
---
 .../libraries/functions/tar_archive.py |  4 +--
 .../python/stacks/2.1/FALCON/test_falcon_server.py |  6 +++--
 .../python/stacks/2.2/KNOX/test_knox_gateway.py| 29 ++
 3 files changed, 25 insertions(+), 14 deletions(-)

diff --git 
a/ambari-common/src/main/python/resource_management/libraries/functions/tar_archive.py
 
b/ambari-common/src/main/python/resource_management/libraries/functions/tar_archive.py
index 194520f..5e369cf 100644
--- 
a/ambari-common/src/main/python/resource_management/libraries/functions/tar_archive.py
+++ 
b/ambari-common/src/main/python/resource_management/libraries/functions/tar_archive.py
@@ -25,7 +25,7 @@ from contextlib import closing
 from resource_management.core.resources.system import Execute
 
 def archive_dir(output_filename, input_dir):
-  Execute(('tar', '-zcvf', output_filename, input_dir),
+  Execute(('tar', '-zcf', output_filename, '-C', input_dir, '.'),
 sudo = True,
 tries = 3,
 try_sleep = 1,
@@ -40,7 +40,7 @@ def archive_directory_dereference(archive, directory):
   :return:  None
   """
 
-  Execute(('tar', '-zcvhf', archive, directory),
+  Execute(('tar', '-zchf', archive, '-C', directory, '.'),
 sudo = True,
 tries = 3,
 try_sleep = 1,
diff --git 
a/ambari-server/src/test/python/stacks/2.1/FALCON/test_falcon_server.py 
b/ambari-server/src/test/python/stacks/2.1/FALCON/test_falcon_server.py
index e15cfdb..0c9380d 100644
--- a/ambari-server/src/test/python/stacks/2.1/FALCON/test_falcon_server.py
+++ b/ambari-server/src/test/python/stacks/2.1/FALCON/test_falcon_server.py
@@ -239,9 +239,11 @@ class TestFalconServer(RMFTestCase):
   action = ['delete'])
 
 self.assertResourceCalled('Execute', ('tar',
- '-zcvhf',
+ '-zchf',
  '/tmp/falcon-upgrade-backup/falcon-local-backup.tar',
- u'/hadoop/falcon'),
+ '-C',
+ u'/hadoop/falcon',
+ '.'),
 sudo = True, tries = 3, try_sleep = 1,
 )
 self.assertResourceCalled('Execute', ('ambari-python-wrap', 
'/usr/bin/hdp-select', 'set', 'falcon-server', u'2.2.1.0-2135'),
diff --git a/ambari-server/src/test/python/stacks/2.2/KNOX/test_knox_gateway.py 
b/ambari-server/src/test/python/stacks/2.2/KNOX/test_knox_gateway.py
index 3114fa8..bcba192 100644
--- a/ambari-server/src/test/python/stacks/2.2/KNOX/test_knox_gateway.py
+++ b/ambari-server/src/test/python/stacks/2.2/KNOX/test_knox_gateway.py
@@ -145,9 +145,11 @@ class TestKnoxGateway(RMFTestCase):
target = RMFTestCase.TARGET_COMMON_SERVICES)
 
 self.assertResourceCalled('Execute', ('tar',
- '-zcvhf',
+ '-zchf',
  '/tmp/knox-upgrade-backup/knox-data-backup.tar',
- '/usr/hdp/current/knox-server/data'),
+ '-C',
+ '/usr/hdp/current/knox-server/data',
+ '.'),
 sudo = True, tries = 3, try_sleep = 1,
 )
 self.assertResourceCalled('Execute', ('ambari-python-wrap', 
'/usr/bin/hdp-select', 'set', 'knox-server', '2.2.1.0-3242'),
@@ -182,9 +184,11 @@ class TestKnoxGateway(RMFTestCase):
mocks_dict = mocks_dict)
 
 self.assertResourceCalled('Execute', ('tar',
- '-zcvhf',
+ '-zchf',
  '/tmp/knox-upgrade-backup/knox-data-backup.tar',
- '/usr/hdp/current/knox-server/data'),
+ '-C',
+ '/usr/hdp/current/knox-server/data',
+ '.'),
 sudo = True,  tries = 3, try_sleep = 1,
 )
 self.assertResourceCalledIgnoreEarlier('Execute', ('ambari-python-wrap', 
'/usr/bin/hdp-select', 'set', 'knox-server', version),sudo = True)
@@ -238,9 +242,11 @@ class TestKnoxGateway(RMFTestCase):
mocks_dict = mocks_dict)
 
 self.assertResourceCalled('Execute', ('tar',
- '-zcvhf',
+ '-zchf',
  '/tmp/knox-upgrade-backup/knox-data-backup.tar',
- '/usr/hdp/current/knox-server/data'),
+ '-C',
+ '/usr/hdp/current/knox-server/data',
+ '.'),
 sudo = True, tries = 3, try_sleep = 1,
 )
 self.assertResourceCalledIgnoreEarlier('Execute', ('ambari-python-wrap', 
'/usr/bin/hdp-select', 'set', 'knox-server', version),sudo = True)
@@ -298,9 +304,11 @@ class TestKnoxGateway(RMFTestCase):
mocks_dict = mocks_dict)
 
 self.assertResourceCalled('Execute', ('tar',
- '-zcvhf',
+ '-zchf',
  '/tmp/knox-upgrade-backup/knox-data-backup.tar',
- "/usr/hdp/current/kno

[ambari] branch trunk updated: AMBARI-22413 fix tar_archive.archive_directory_dereference (benyoka) (#195)

2018-01-25 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
 new e836608  AMBARI-22413 fix tar_archive.archive_directory_dereference 
(benyoka) (#195)
e836608 is described below

commit e8366084456b652adb83a33bf56a56d17681bf98
Author: benyoka <beny...@users.noreply.github.com>
AuthorDate: Thu Jan 25 15:12:56 2018 +0100

AMBARI-22413 fix tar_archive.archive_directory_dereference (benyoka) (#195)
---
 .../libraries/functions/tar_archive.py |  4 +--
 .../python/stacks/2.1/FALCON/test_falcon_server.py |  6 +++--
 .../python/stacks/2.2/KNOX/test_knox_gateway.py| 29 ++
 3 files changed, 25 insertions(+), 14 deletions(-)

diff --git 
a/ambari-common/src/main/python/resource_management/libraries/functions/tar_archive.py
 
b/ambari-common/src/main/python/resource_management/libraries/functions/tar_archive.py
index 7976587..372a894 100644
--- 
a/ambari-common/src/main/python/resource_management/libraries/functions/tar_archive.py
+++ 
b/ambari-common/src/main/python/resource_management/libraries/functions/tar_archive.py
@@ -25,7 +25,7 @@ from contextlib import closing
 from resource_management.core.resources.system import Execute
 
 def archive_dir(output_filename, input_dir):
-  Execute(('tar', '-zcvf', output_filename, input_dir),
+  Execute(('tar', '-zcf', output_filename, '-C', input_dir, '.'),
 sudo = True,
 tries = 3,
 try_sleep = 1,
@@ -40,7 +40,7 @@ def archive_directory_dereference(archive, directory):
   :return:  None
   """
 
-  Execute(('tar', '-zcvhf', archive, directory),
+  Execute(('tar', '-zchf', archive, '-C', directory, '.'),
 sudo = True,
 tries = 3,
 try_sleep = 1,
diff --git 
a/ambari-server/src/test/python/stacks/2.1/FALCON/test_falcon_server.py 
b/ambari-server/src/test/python/stacks/2.1/FALCON/test_falcon_server.py
index e15cfdb..0c9380d 100644
--- a/ambari-server/src/test/python/stacks/2.1/FALCON/test_falcon_server.py
+++ b/ambari-server/src/test/python/stacks/2.1/FALCON/test_falcon_server.py
@@ -239,9 +239,11 @@ class TestFalconServer(RMFTestCase):
   action = ['delete'])
 
 self.assertResourceCalled('Execute', ('tar',
- '-zcvhf',
+ '-zchf',
  '/tmp/falcon-upgrade-backup/falcon-local-backup.tar',
- u'/hadoop/falcon'),
+ '-C',
+ u'/hadoop/falcon',
+ '.'),
 sudo = True, tries = 3, try_sleep = 1,
 )
 self.assertResourceCalled('Execute', ('ambari-python-wrap', 
'/usr/bin/hdp-select', 'set', 'falcon-server', u'2.2.1.0-2135'),
diff --git a/ambari-server/src/test/python/stacks/2.2/KNOX/test_knox_gateway.py 
b/ambari-server/src/test/python/stacks/2.2/KNOX/test_knox_gateway.py
index 3114fa8..bcba192 100644
--- a/ambari-server/src/test/python/stacks/2.2/KNOX/test_knox_gateway.py
+++ b/ambari-server/src/test/python/stacks/2.2/KNOX/test_knox_gateway.py
@@ -145,9 +145,11 @@ class TestKnoxGateway(RMFTestCase):
target = RMFTestCase.TARGET_COMMON_SERVICES)
 
 self.assertResourceCalled('Execute', ('tar',
- '-zcvhf',
+ '-zchf',
  '/tmp/knox-upgrade-backup/knox-data-backup.tar',
- '/usr/hdp/current/knox-server/data'),
+ '-C',
+ '/usr/hdp/current/knox-server/data',
+ '.'),
 sudo = True, tries = 3, try_sleep = 1,
 )
 self.assertResourceCalled('Execute', ('ambari-python-wrap', 
'/usr/bin/hdp-select', 'set', 'knox-server', '2.2.1.0-3242'),
@@ -182,9 +184,11 @@ class TestKnoxGateway(RMFTestCase):
mocks_dict = mocks_dict)
 
 self.assertResourceCalled('Execute', ('tar',
- '-zcvhf',
+ '-zchf',
  '/tmp/knox-upgrade-backup/knox-data-backup.tar',
- '/usr/hdp/current/knox-server/data'),
+ '-C',
+ '/usr/hdp/current/knox-server/data',
+ '.'),
 sudo = True,  tries = 3, try_sleep = 1,
 )
 self.assertResourceCalledIgnoreEarlier('Execute', ('ambari-python-wrap', 
'/usr/bin/hdp-select', 'set', 'knox-server', version),sudo = True)
@@ -238,9 +242,11 @@ class TestKnoxGateway(RMFTestCase):
mocks_dict = mocks_dict)
 
 self.assertResourceCalled('Execute', ('tar',
- '-zcvhf',
+ '-zchf',
  '/tmp/knox-upgrade-backup/knox-data-backup.tar',
- '/usr/hdp/current/knox-server/data'),
+ '-C',
+ '/usr/hdp/current/knox-server/data',
+ '.'),
 sudo = True, tries = 3, try_sleep = 1,
 )
 self.assertResourceCalledIgnoreEarlier('Execute', ('ambari-python-wrap', 
'/usr/bin/hdp-select', 'set', 'knox-server', version),sudo = True)
@@ -298,9 +304,11 @@ class TestKnoxGateway(RMFTestCase):
mocks_dict = mocks_dict)
 
 self.assertResourceCalled('Execute', ('tar',
- '-zcvhf',
+ '-zchf',
  '/tmp/knox-upgrade-backup/knox-data-backup.tar',
- "/usr/hdp/current/knox-server/data"

[ambari] branch branch-feature-AMBARI-14714 updated: AMBARI-22776 Fix DDL issues resulting from incomplete table rename (benyoka) (#189)

2018-01-25 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch branch-feature-AMBARI-14714
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-feature-AMBARI-14714 by 
this push:
 new 34f6fa3  AMBARI-22776 Fix DDL issues resulting from incomplete table 
rename (benyoka) (#189)
34f6fa3 is described below

commit 34f6fa35f88936da3ab66c140304abd708d685cb
Author: benyoka <beny...@users.noreply.github.com>
AuthorDate: Thu Jan 25 14:18:07 2018 +0100

AMBARI-22776 Fix DDL issues resulting from incomplete table rename 
(benyoka) (#189)

* AMBARI-22776 Fix DDL issues resulting from incomplete table rename 
(benyoka)

* AMBARI-22776 More DDL fixes and renamings in the code (benyoka)
---
 .../internal/BlueprintResourceProvider.java|  2 +-
 .../server/orm/entities/BlueprintEntity.java   | 10 +++---
 .../orm/entities/BlueprintMpackConfigEntity.java   | 34 +-
 .../orm/entities/BlueprintMpackConfigEntityPk.java |  8 ++---
 .../orm/entities/BlueprintMpackInstanceEntity.java |  6 ++--
 .../orm/entities/BlueprintServiceConfigEntity.java |  2 +-
 .../orm/entities/BlueprintServiceEntity.java   | 16 -
 .../src/main/resources/Ambari-DDL-Derby-CREATE.sql | 35 +++---
 .../src/main/resources/Ambari-DDL-MySQL-CREATE.sql | 35 +++---
 .../main/resources/Ambari-DDL-Oracle-CREATE.sql| 35 +++---
 .../main/resources/Ambari-DDL-Postgres-CREATE.sql  | 24 ++---
 .../resources/Ambari-DDL-SQLAnywhere-CREATE.sql| 35 +++---
 .../main/resources/Ambari-DDL-SQLServer-CREATE.sql | 41 --
 .../internal/BlueprintResourceProviderTest.java| 12 +++
 .../server/orm/entities/BlueprintEntityTest2.java  | 38 ++--
 15 files changed, 139 insertions(+), 194 deletions(-)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintResourceProvider.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintResourceProvider.java
index b9899bd..7eef2df 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintResourceProvider.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintResourceProvider.java
@@ -377,7 +377,7 @@ public class BlueprintResourceProvider extends 
AbstractControllerResourceProvide
 
 // TODO: use multiple mpacks
 BlueprintMpackInstanceEntity mpack =
-  
((BlueprintConfigEntity)config).getBlueprintEntity().getMpackReferences().iterator().next();
+  
((BlueprintConfigEntity)config).getBlueprintEntity().getMpackInstances().iterator().next();
 StackInfo metaInfoStack;
 
 try {
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/BlueprintEntity.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/BlueprintEntity.java
index 31cbf86..ea92a7b 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/BlueprintEntity.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/BlueprintEntity.java
@@ -68,7 +68,7 @@ public class BlueprintEntity {
   private Collection settings = new ArrayList<>();
 
   @OneToMany(cascade = CascadeType.ALL, mappedBy = "blueprint")
-  private Collection mpackReferences = new 
ArrayList<>();
+  private Collection mpackInstances = new 
ArrayList<>();
 
 
   /**
@@ -159,11 +159,11 @@ public class BlueprintEntity {
 this.securityDescriptorReference = securityDescriptorReference;
   }
 
-  public Collection getMpackReferences() {
-return mpackReferences;
+  public Collection getMpackInstances() {
+return mpackInstances;
   }
 
-  public void setMpackReferences(Collection 
mpackReferences) {
-this.mpackReferences = mpackReferences;
+  public void setMpackInstances(Collection 
mpackInstances) {
+this.mpackInstances = mpackInstances;
   }
 }
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/BlueprintMpackConfigEntity.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/BlueprintMpackConfigEntity.java
index 50cb0d2..abc76a7 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/BlueprintMpackConfigEntity.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/BlueprintMpackConfigEntity.java
@@ -38,8 +38,8 @@ import javax.persistence.Table;
 public class BlueprintMpackConfigEntity implements BlueprintConfiguration {
 
   @Id
-  @Column(name = "mpack_ref_id", nullable = false, insertable = false, 
updatable = false)
-  private Long mpackRefId;
+  @Column(name = "mpack_instance_id", nullable = false, insertable = false, 
updatable = false)
+  private Long mpackInstanceId;
 
   @Id
   @Column(name = "type_nam

[ambari] branch branch-feature-AMBARI-14714 updated: AMBARI-22614 fix some unit tests (benyoka) (#461)

2018-02-24 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch branch-feature-AMBARI-14714
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-feature-AMBARI-14714 by 
this push:
 new d341c7a  AMBARI-22614 fix some unit tests (benyoka) (#461)
d341c7a is described below

commit d341c7a61761a2997027ae0441c2175562b76f63
Author: benyoka <beny...@users.noreply.github.com>
AuthorDate: Sat Feb 24 21:00:04 2018 +0100

AMBARI-22614 fix some unit tests (benyoka) (#461)

* AMBARI-22614 fix some unit tests (benyoka)

* AMBARI-22614 fix some unit tests / remove unused import (benyoka)
---
 .../server/state/configgroup/ConfigGroupImpl.java  |  3 ++-
 .../main/resources/Ambari-DDL-SQLServer-CREATE.sql |  1 -
 .../internal/ConfigGroupResourceProviderTest.java  | 11 +++--
 .../ambari/server/state/ConfigGroupTest.java   | 28 +-
 4 files changed, 38 insertions(+), 5 deletions(-)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java
index 2536d8b..b1cf381 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java
@@ -101,7 +101,8 @@ public class ConfigGroupImpl implements ConfigGroup {
   @AssistedInject
   public ConfigGroupImpl(@Assisted("cluster") Cluster cluster,
  @Assisted("serviceGroupId") @Nullable Long 
serviceGroupId,
- @Assisted("serviceId") @Nullable Long serviceId, 
@Assisted("name") String name,
+ @Assisted("serviceId") @Nullable Long serviceId,
+ @Assisted("name") String name,
  @Assisted("tag") String tag, @Assisted("description") 
String description,
  @Assisted("configs") Map<String, Config> 
configurations,
  @Assisted("hosts") Map<Long, Host> hosts, Clusters 
clusters, ConfigFactory configFactory,
diff --git a/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql 
b/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
index 036ebc8..94f00f0 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
@@ -137,7 +137,6 @@ CREATE TABLE servicegroups (
   id BIGINT NOT NULL,
   service_group_name VARCHAR(255) NOT NULL,
   cluster_id BIGINT NOT NULL,
-  stack_id BIGINT NOT NULL,
   CONSTRAINT PK_servicegroups PRIMARY KEY (id, cluster_id),
   CONSTRAINT FK_servicegroups_cluster_id FOREIGN KEY (cluster_id) REFERENCES 
clusters (cluster_id),
   CONSTRAINT FK_servicegroups_stack_id FOREIGN KEY (stack_id) REFERENCES stack 
(stack_id));
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProviderTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProviderTest.java
index 0485396..158ab7d 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProviderTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProviderTest.java
@@ -64,6 +64,7 @@ import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.Config;
 import org.apache.ambari.server.state.ConfigHelper;
 import org.apache.ambari.server.state.Host;
+import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.configgroup.ConfigGroup;
 import org.apache.ambari.server.state.configgroup.ConfigGroupFactory;
 import org.easymock.Capture;
@@ -82,6 +83,8 @@ import com.google.inject.util.Modules;
 
 public class ConfigGroupResourceProviderTest {
 
+  public static final String SERVICE_GROUP_NAME = "default";
+  public static final String SERVICE_NAME = "ZOOKEEPER";
   private HostDAO hostDAO = null;
 
   @Before
@@ -154,6 +157,7 @@ public class ConfigGroupResourceProviderTest {
 HostEntity hostEntity2 = createMock(HostEntity.class);
 ConfigGroupFactory configGroupFactory = 
createNiceMock(ConfigGroupFactory.class);
 ConfigGroup configGroup = createNiceMock(ConfigGroup.class);
+Service service = createNiceMock(Service.class);
 
 expect(managementController.getClusters()).andReturn(clusters).anyTimes();
 expect(clusters.getCluster("Cluster100")).andReturn(cluster).anyTimes();
@@ -161,6 +165,8 @@ public class ConfigGroupResourceProviderTest {
 expect(clusters.getHost("h2")).andReturn(h2);
 exp

[ambari] branch branch-2.7 updated: AMBARI-24199 Atlas HA blueprint support (benyoka) (#1977)

2018-08-08 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-2.7 by this push:
 new 2955926  AMBARI-24199 Atlas HA blueprint support (benyoka) (#1977)
2955926 is described below

commit 2955926dfbd9b3a1b493ef378b006195e673042f
Author: benyoka 
AuthorDate: Wed Aug 8 14:04:23 2018 +0200

AMBARI-24199 Atlas HA blueprint support (benyoka) (#1977)

* AMBARI-24199 Atlas HA with blueprint w.i.p. (benyoka)

* AMBARI-24199 Atlas HA with blueprint (benyoka)
---
 .../internal/BlueprintConfigurationProcessor.java  |  5 +-
 .../BlueprintConfigurationProcessorTest.java   | 69 ++
 2 files changed, 72 insertions(+), 2 deletions(-)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
index 4d67235..985d2f0 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
@@ -2851,7 +2851,6 @@ public class BlueprintConfigurationProcessor {
 singleHostTopologyUpdaters.put("hive-env", hiveEnvMap);
 singleHostTopologyUpdaters.put("oozie-env", oozieEnvMap);
 singleHostTopologyUpdaters.put("kafka-broker", kafkaBrokerMap);
-singleHostTopologyUpdaters.put("application-properties", atlasPropsMap);
 singleHostTopologyUpdaters.put("admin-properties", rangerAdminPropsMap);
 singleHostTopologyUpdaters.put("ranger-env", rangerEnvPropsMap);
 singleHostTopologyUpdaters.put("ranger-yarn-audit", 
rangerYarnAuditPropsMap);
@@ -2886,6 +2885,7 @@ public class BlueprintConfigurationProcessor {
 multiHostTopologyUpdaters.put("oozie-site", multiOozieSiteMap);
 multiHostTopologyUpdaters.put("accumulo-site", multiAccumuloSiteMap);
 multiHostTopologyUpdaters.put("kms-site", multiRangerKmsSiteMap);
+multiHostTopologyUpdaters.put("application-properties", atlasPropsMap);
 
 dbHostTopologyUpdaters.put("hive-site", dbHiveSiteMap);
 
@@ -3157,7 +3157,8 @@ public class BlueprintConfigurationProcessor {
 
multiOozieSiteMap.put("oozie.service.ProxyUserService.proxyuser.knox.hosts", 
new MultipleHostTopologyUpdater("KNOX_GATEWAY"));
 
 // ATLAS
-atlasPropsMap.put("atlas.server.bind.address", new 
SingleHostTopologyUpdater("ATLAS_SERVER"));
+atlasPropsMap.put("atlas.server.bind.address", new 
MultipleHostTopologyUpdater("ATLAS_SERVER"));
+atlasPropsMap.put("atlas.rest.address", new 
MultipleHostTopologyUpdater("ATLAS_SERVER", ',', true, true, true));
 atlasPropsMap.put("atlas.kafka.bootstrap.servers", new 
MultipleHostTopologyUpdater("KAFKA_BROKER"));
 atlasPropsMap.put("atlas.kafka.zookeeper.connect", new 
MultipleHostTopologyUpdater("ZOOKEEPER_SERVER"));
 atlasPropsMap.put("atlas.graph.index.search.solr.zookeeper-url", new 
MultipleHostTopologyUpdater("ZOOKEEPER_SERVER", ',', false, true, true));
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
index afef4c3..c37e659 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
@@ -22,6 +22,7 @@ import static 
com.google.common.collect.Iterators.peekingIterator;
 import static java.util.Collections.emptyList;
 import static java.util.Collections.emptyMap;
 import static java.util.stream.Collectors.toList;
+import static java.util.stream.Collectors.toSet;
 import static org.easymock.EasyMock.anyObject;
 import static org.easymock.EasyMock.expect;
 import static org.easymock.EasyMock.replay;
@@ -647,6 +648,37 @@ public class BlueprintConfigurationProcessorTest extends 
EasyMockSupport {
   }
 
   @Test
+  public void 
testDoUpdateForBlueprintExport_MultiHostProperty__WithPrefixAndPorts() throws 
Exception {
+Map> properties = new HashMap<>();
+Map typeProps = new HashMap<>();
+typeProps.put("atlas.server.bind.address",
+  
"http://testhost:21000,http://testhost2:21000,http://testhost2a:21000,http://testhost2b:21000;);
+properties.put("application-properties",

[ambari] branch trunk updated: AMBARI-24199 Atlas HA blueprint support (benyoka) (#1976)

2018-08-08 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
 new 4d929b2  AMBARI-24199 Atlas HA blueprint support (benyoka) (#1976)
4d929b2 is described below

commit 4d929b23bb243eeff57349d2e2ff10d200eb771d
Author: benyoka 
AuthorDate: Wed Aug 8 14:03:47 2018 +0200

AMBARI-24199 Atlas HA blueprint support (benyoka) (#1976)
---
 .../internal/BlueprintConfigurationProcessor.java  |  5 +-
 .../BlueprintConfigurationProcessorTest.java   | 69 ++
 2 files changed, 72 insertions(+), 2 deletions(-)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
index 4d67235..985d2f0 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
@@ -2851,7 +2851,6 @@ public class BlueprintConfigurationProcessor {
 singleHostTopologyUpdaters.put("hive-env", hiveEnvMap);
 singleHostTopologyUpdaters.put("oozie-env", oozieEnvMap);
 singleHostTopologyUpdaters.put("kafka-broker", kafkaBrokerMap);
-singleHostTopologyUpdaters.put("application-properties", atlasPropsMap);
 singleHostTopologyUpdaters.put("admin-properties", rangerAdminPropsMap);
 singleHostTopologyUpdaters.put("ranger-env", rangerEnvPropsMap);
 singleHostTopologyUpdaters.put("ranger-yarn-audit", 
rangerYarnAuditPropsMap);
@@ -2886,6 +2885,7 @@ public class BlueprintConfigurationProcessor {
 multiHostTopologyUpdaters.put("oozie-site", multiOozieSiteMap);
 multiHostTopologyUpdaters.put("accumulo-site", multiAccumuloSiteMap);
 multiHostTopologyUpdaters.put("kms-site", multiRangerKmsSiteMap);
+multiHostTopologyUpdaters.put("application-properties", atlasPropsMap);
 
 dbHostTopologyUpdaters.put("hive-site", dbHiveSiteMap);
 
@@ -3157,7 +3157,8 @@ public class BlueprintConfigurationProcessor {
 
multiOozieSiteMap.put("oozie.service.ProxyUserService.proxyuser.knox.hosts", 
new MultipleHostTopologyUpdater("KNOX_GATEWAY"));
 
 // ATLAS
-atlasPropsMap.put("atlas.server.bind.address", new 
SingleHostTopologyUpdater("ATLAS_SERVER"));
+atlasPropsMap.put("atlas.server.bind.address", new 
MultipleHostTopologyUpdater("ATLAS_SERVER"));
+atlasPropsMap.put("atlas.rest.address", new 
MultipleHostTopologyUpdater("ATLAS_SERVER", ',', true, true, true));
 atlasPropsMap.put("atlas.kafka.bootstrap.servers", new 
MultipleHostTopologyUpdater("KAFKA_BROKER"));
 atlasPropsMap.put("atlas.kafka.zookeeper.connect", new 
MultipleHostTopologyUpdater("ZOOKEEPER_SERVER"));
 atlasPropsMap.put("atlas.graph.index.search.solr.zookeeper-url", new 
MultipleHostTopologyUpdater("ZOOKEEPER_SERVER", ',', false, true, true));
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
index afef4c3..c37e659 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
@@ -22,6 +22,7 @@ import static 
com.google.common.collect.Iterators.peekingIterator;
 import static java.util.Collections.emptyList;
 import static java.util.Collections.emptyMap;
 import static java.util.stream.Collectors.toList;
+import static java.util.stream.Collectors.toSet;
 import static org.easymock.EasyMock.anyObject;
 import static org.easymock.EasyMock.expect;
 import static org.easymock.EasyMock.replay;
@@ -647,6 +648,37 @@ public class BlueprintConfigurationProcessorTest extends 
EasyMockSupport {
   }
 
   @Test
+  public void 
testDoUpdateForBlueprintExport_MultiHostProperty__WithPrefixAndPorts() throws 
Exception {
+Map> properties = new HashMap<>();
+Map typeProps = new HashMap<>();
+typeProps.put("atlas.server.bind.address",
+  
"http://testhost:21000,http://testhost2:21000,http://testhost2a:21000,http://testhost2b:21000;);
+properties.put("application-properties", typeProps);
+
+Configuration clusterConfig = new Configuration(properties, emptyMap());
+
+Collection hgComponents = Sets.newHas

[ambari] branch branch-2.7 updated: AMBARI-24592 fix handling of stack defaults in blueprints (benyoka) (#2242)

2018-09-04 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-2.7 by this push:
 new 9cecd2a  AMBARI-24592 fix handling of stack defaults in blueprints 
(benyoka) (#2242)
9cecd2a is described below

commit 9cecd2a04db2103d057e09eab42b90a5218f9478
Author: benyoka 
AuthorDate: Tue Sep 4 20:27:01 2018 +0200

AMBARI-24592 fix handling of stack defaults in blueprints (benyoka) (#2242)
---
 .../internal/BlueprintConfigurationProcessor.java  | 38 --
 .../BlueprintConfigurationProcessorTest.java   | 86 +-
 2 files changed, 115 insertions(+), 9 deletions(-)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
index e109559..19c8e9f 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
@@ -40,6 +40,9 @@ import java.util.Set;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import javax.annotation.Nullable;
+import javax.validation.constraints.NotNull;
+
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.ConfigHelper;
@@ -3377,7 +3380,7 @@ public class BlueprintConfigurationProcessor {
*  to this).
* @throws ConfigurationTopologyException
*/
-  private void setStackToolsAndFeatures(Configuration configuration, 
Set configTypesUpdated)
+  protected void setStackToolsAndFeatures(Configuration configuration, 
Set configTypesUpdated)
 throws ConfigurationTopologyException {
 ConfigHelper configHelper = 
clusterTopology.getAmbariContext().getConfigHelper();
 Stack stack = clusterTopology.getBlueprint().getStack();
@@ -3386,8 +3389,10 @@ public class BlueprintConfigurationProcessor {
 
 StackId stackId = new StackId(stackName, stackVersion);
 
-Set properties = 
Sets.newHashSet(ConfigHelper.CLUSTER_ENV_STACK_NAME_PROPERTY,
-  ConfigHelper.CLUSTER_ENV_STACK_ROOT_PROPERTY, 
ConfigHelper.CLUSTER_ENV_STACK_TOOLS_PROPERTY,
+Set properties = Sets.newHashSet(
+  ConfigHelper.CLUSTER_ENV_STACK_NAME_PROPERTY,
+  ConfigHelper.CLUSTER_ENV_STACK_ROOT_PROPERTY,
+  ConfigHelper.CLUSTER_ENV_STACK_TOOLS_PROPERTY,
   ConfigHelper.CLUSTER_ENV_STACK_FEATURES_PROPERTY,
   ConfigHelper.CLUSTER_ENV_STACK_PACKAGES_PROPERTY);
 
@@ -3397,11 +3402,14 @@ public class BlueprintConfigurationProcessor {
 
   for( String property : properties ){
 if (clusterEnvDefaultProperties.containsKey(property)) {
-  configuration.setProperty(CLUSTER_ENV_CONFIG_TYPE_NAME, property,
-clusterEnvDefaultProperties.get(property));
-
-  // make sure to include the configuration type as being updated
-  configTypesUpdated.add(CLUSTER_ENV_CONFIG_TYPE_NAME);
+  String newValue = clusterEnvDefaultProperties.get(property);
+  String previous = 
configuration.setProperty(CLUSTER_ENV_CONFIG_TYPE_NAME, property, newValue);
+  if (!Objects.equals(
+trimValue(previous, stack, CLUSTER_ENV_CONFIG_TYPE_NAME, property),
+trimValue(newValue, stack, CLUSTER_ENV_CONFIG_TYPE_NAME, 
property))) {
+// in case a property is updated make sure to include cluster-env 
as being updated
+configTypesUpdated.add(CLUSTER_ENV_CONFIG_TYPE_NAME);
+  }
 }
   }
 } catch( AmbariException ambariException ){
@@ -3410,6 +3418,20 @@ public class BlueprintConfigurationProcessor {
 }
   }
 
+  private @Nullable String trimValue(@Nullable String value,
+ @NotNull Stack stack,
+ @NotNull String configType,
+ @NotNull String propertyName) {
+if (null == value) {
+  return null;
+}
+else {
+  TrimmingStrategy trimmingStrategy =
+PropertyValueTrimmingStrategyDefiner.defineTrimmingStrategy(stack, 
propertyName, configType);
+  return trimmingStrategy.trim(value);
+}
+  }
+
   /**
* Ensure that the specified property exists.
* If not, set a default value.
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
index c37e659..996c09d 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
+++ 
b/ambari-server/src/test/java

[ambari] branch trunk updated: AMBARI-24592 fix handling of stack defaults in blueprints (benyoka) (#2243)

2018-09-04 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
 new b84ad9f  AMBARI-24592 fix handling of stack defaults in blueprints 
(benyoka) (#2243)
b84ad9f is described below

commit b84ad9f03af89b7adabb22e14b429728246bf544
Author: benyoka 
AuthorDate: Tue Sep 4 20:28:00 2018 +0200

AMBARI-24592 fix handling of stack defaults in blueprints (benyoka) (#2243)
---
 .../internal/BlueprintConfigurationProcessor.java  | 38 --
 .../BlueprintConfigurationProcessorTest.java   | 86 +-
 2 files changed, 115 insertions(+), 9 deletions(-)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
index e109559..19c8e9f 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
@@ -40,6 +40,9 @@ import java.util.Set;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import javax.annotation.Nullable;
+import javax.validation.constraints.NotNull;
+
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.ConfigHelper;
@@ -3377,7 +3380,7 @@ public class BlueprintConfigurationProcessor {
*  to this).
* @throws ConfigurationTopologyException
*/
-  private void setStackToolsAndFeatures(Configuration configuration, 
Set configTypesUpdated)
+  protected void setStackToolsAndFeatures(Configuration configuration, 
Set configTypesUpdated)
 throws ConfigurationTopologyException {
 ConfigHelper configHelper = 
clusterTopology.getAmbariContext().getConfigHelper();
 Stack stack = clusterTopology.getBlueprint().getStack();
@@ -3386,8 +3389,10 @@ public class BlueprintConfigurationProcessor {
 
 StackId stackId = new StackId(stackName, stackVersion);
 
-Set properties = 
Sets.newHashSet(ConfigHelper.CLUSTER_ENV_STACK_NAME_PROPERTY,
-  ConfigHelper.CLUSTER_ENV_STACK_ROOT_PROPERTY, 
ConfigHelper.CLUSTER_ENV_STACK_TOOLS_PROPERTY,
+Set properties = Sets.newHashSet(
+  ConfigHelper.CLUSTER_ENV_STACK_NAME_PROPERTY,
+  ConfigHelper.CLUSTER_ENV_STACK_ROOT_PROPERTY,
+  ConfigHelper.CLUSTER_ENV_STACK_TOOLS_PROPERTY,
   ConfigHelper.CLUSTER_ENV_STACK_FEATURES_PROPERTY,
   ConfigHelper.CLUSTER_ENV_STACK_PACKAGES_PROPERTY);
 
@@ -3397,11 +3402,14 @@ public class BlueprintConfigurationProcessor {
 
   for( String property : properties ){
 if (clusterEnvDefaultProperties.containsKey(property)) {
-  configuration.setProperty(CLUSTER_ENV_CONFIG_TYPE_NAME, property,
-clusterEnvDefaultProperties.get(property));
-
-  // make sure to include the configuration type as being updated
-  configTypesUpdated.add(CLUSTER_ENV_CONFIG_TYPE_NAME);
+  String newValue = clusterEnvDefaultProperties.get(property);
+  String previous = 
configuration.setProperty(CLUSTER_ENV_CONFIG_TYPE_NAME, property, newValue);
+  if (!Objects.equals(
+trimValue(previous, stack, CLUSTER_ENV_CONFIG_TYPE_NAME, property),
+trimValue(newValue, stack, CLUSTER_ENV_CONFIG_TYPE_NAME, 
property))) {
+// in case a property is updated make sure to include cluster-env 
as being updated
+configTypesUpdated.add(CLUSTER_ENV_CONFIG_TYPE_NAME);
+  }
 }
   }
 } catch( AmbariException ambariException ){
@@ -3410,6 +3418,20 @@ public class BlueprintConfigurationProcessor {
 }
   }
 
+  private @Nullable String trimValue(@Nullable String value,
+ @NotNull Stack stack,
+ @NotNull String configType,
+ @NotNull String propertyName) {
+if (null == value) {
+  return null;
+}
+else {
+  TrimmingStrategy trimmingStrategy =
+PropertyValueTrimmingStrategyDefiner.defineTrimmingStrategy(stack, 
propertyName, configType);
+  return trimmingStrategy.trim(value);
+}
+  }
+
   /**
* Ensure that the specified property exists.
* If not, set a default value.
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
index c37e659..996c09d 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
+++ 
b/ambari-server/src/test/java/org/apache

[ambari] branch branch-feature-AMBARI-14714 updated: [AMBARI-23032] fix exceptions, export cluster settings and single mpack (#431)

2018-03-01 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch branch-feature-AMBARI-14714
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-feature-AMBARI-14714 by 
this push:
 new e809633  [AMBARI-23032] fix exceptions, export cluster settings and 
single mpack (#431)
e809633 is described below

commit e809633131b739d10afd5d3b616db34b6915b26b
Author: benyoka <beny...@users.noreply.github.com>
AuthorDate: Thu Mar 1 11:34:36 2018 +0100

[AMBARI-23032] fix exceptions, export cluster settings and single mpack 
(#431)

* AMBARI-23032 fix execptions, export cluster settings and single mpacks 
(benyoka)

* AMBARI-23032 fix review comments (benyoka)

* AMBARI-23032 better method naming (benyoka)

* AMBARI-23032 fix review comments #2 (benyoka)

* AMBARI-23032 fix review comments #3 (benyoka)

* AMBARI-23032 fix swallowed exceptions during mpack installation
---
 .../api/query/render/ClusterBlueprintRenderer.java | 144 +++--
 .../internal/ClusterSettingResourceProvider.java   |   7 +-
 .../controller/internal/MpackResourceProvider.java |  15 ++-
 .../query/render/ClusterBlueprintRendererTest.java |  59 ++---
 4 files changed, 133 insertions(+), 92 deletions(-)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/ClusterBlueprintRenderer.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/ClusterBlueprintRenderer.java
index e518de7..e34fcb1 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/ClusterBlueprintRenderer.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/ClusterBlueprintRenderer.java
@@ -18,6 +18,8 @@
 
 package org.apache.ambari.server.api.query.render;
 
+import static java.util.stream.Collectors.toList;
+
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -26,10 +28,12 @@ import java.util.HashSet;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Set;
 
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.api.query.QueryInfo;
+import org.apache.ambari.server.api.services.AmbariMetaInfo;
 import org.apache.ambari.server.api.services.Request;
 import org.apache.ambari.server.api.services.Result;
 import org.apache.ambari.server.api.services.ResultImpl;
@@ -42,6 +46,7 @@ import org.apache.ambari.server.controller.AmbariServer;
 import org.apache.ambari.server.controller.internal.ArtifactResourceProvider;
 import 
org.apache.ambari.server.controller.internal.BlueprintConfigurationProcessor;
 import org.apache.ambari.server.controller.internal.BlueprintResourceProvider;
+import 
org.apache.ambari.server.controller.internal.ClusterSettingResourceProvider;
 import org.apache.ambari.server.controller.internal.ExportBlueprintRequest;
 import org.apache.ambari.server.controller.internal.RequestImpl;
 import org.apache.ambari.server.controller.internal.ResourceImpl;
@@ -68,7 +73,7 @@ import 
org.apache.ambari.server.topology.SecurityConfigurationFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.collect.Iterables;
+import com.google.common.collect.ImmutableMap;
 
 /**
  * Renderer which renders a cluster resource as a blueprint.
@@ -80,6 +85,12 @@ public class ClusterBlueprintRenderer extends BaseRenderer 
implements Renderer {
*/
   private AmbariManagementController controller = AmbariServer.getController();
 
+
+  /**
+   * MetaInfo used to get stack and mpack information.
+   */
+  private AmbariMetaInfo metaInfo = controller.getAmbariMetaInfo();
+
 //  /**
 //   * Map of configuration type to configuration properties which are 
required that a user
 //   * input.  These properties will be stripped from the exported blueprint.
@@ -101,48 +112,38 @@ public class ClusterBlueprintRenderer extends 
BaseRenderer implements Renderer {
 
 copyPropertiesToResult(queryProperties, resultTree);
 
-String configType = Resource.Type.Configuration.name();
-if (resultTree.getChild(configType) == null) {
-  resultTree.addChild(new HashSet<>(), configType);
-}
+ensureChild(resultTree, Resource.Type.Configuration, "properties");
 
-String serviceType = Resource.Type.Service.name();
-if (resultTree.getChild(serviceType) == null) {
-  resultTree.addChild(new HashSet<>(), serviceType);
-}
-TreeNode<Set> serviceNode = resultTree.getChild(serviceType);
-if (serviceNode == null) {
-  serviceNode = resultTree.addChild(new HashSet<>(), serviceType);
-}
-String serviceComponentType = Resource.Type.Component.name();
-TreeNode<Set> serviceComponentNode = resultTree.getChild(
-  serviceType + "/" + serv

[ambari] branch branch-feature-AMBARI-14714 updated: [AMBARI-23130] Persist cluster creation request (#559)

2018-03-07 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch branch-feature-AMBARI-14714
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-feature-AMBARI-14714 by 
this push:
 new f4cdbe8  [AMBARI-23130] Persist cluster creation request (#559)
f4cdbe8 is described below

commit f4cdbe83ac21d6433db94d292ba4c4035087ec7d
Author: benyoka <beny...@users.noreply.github.com>
AuthorDate: Wed Mar 7 10:19:58 2018 +0100

[AMBARI-23130] Persist cluster creation request (#559)

* AMBARI-23130 persist raw cluster provision request and extract stack ids 
on server restart (benyoka)

* AMBARI-23130 add columnt to other DDLs + fix DDLs (benyoka)

* AMBARI-23130 fix review findings (benyoka)
---
 .../controller/internal/BaseClusterRequest.java|  21 
 .../internal/ClusterResourceProvider.java  |   3 +-
 .../controller/internal/HostResourceProvider.java  |   4 +-
 .../internal/ProvisionClusterRequest.java  |   4 +-
 .../controller/internal/ScaleClusterRequest.java   |   3 +-
 .../server/orm/entities/TopologyRequestEntity.java |  18 +++
 .../BlueprintBasedClusterProvisionRequest.java |  16 ++-
 .../server/topology/ClusterTopologyImpl.java   |  10 +-
 .../ambari/server/topology/PersistedStateImpl.java |  19 +++-
 .../ambari/server/topology/TopologyRequest.java|  12 ++
 .../server/topology/TopologyRequestFactory.java|   2 +-
 .../topology/TopologyRequestFactoryImpl.java   |   5 +-
 .../server/topology/TopologyRequestUtil.java   |  76 +
 .../src/main/resources/Ambari-DDL-Derby-CREATE.sql |   1 +
 .../src/main/resources/Ambari-DDL-MySQL-CREATE.sql |   1 +
 .../main/resources/Ambari-DDL-Oracle-CREATE.sql|   7 +-
 .../main/resources/Ambari-DDL-Postgres-CREATE.sql  |   1 +
 .../resources/Ambari-DDL-SQLAnywhere-CREATE.sql|   1 +
 .../main/resources/Ambari-DDL-SQLServer-CREATE.sql |   1 +
 .../internal/ClusterResourceProviderTest.java  |  11 +-
 .../internal/ProvisionClusterRequestTest.java  |  34 +++---
 .../internal/ScaleClusterRequestTest.java  |  20 ++--
 .../server/topology/PersistedStateImplTest.java| 123 +
 .../server/topology/TopologyManagerTest.java   |   2 +-
 .../server/topology/TopologyRequestUtilTest.java   |  60 ++
 25 files changed, 394 insertions(+), 61 deletions(-)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BaseClusterRequest.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BaseClusterRequest.java
index 77eafeb..0d243a2 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BaseClusterRequest.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BaseClusterRequest.java
@@ -29,6 +29,7 @@ import org.apache.ambari.server.api.predicate.Token;
 import org.apache.ambari.server.controller.spi.Resource;
 import org.apache.ambari.server.controller.spi.ResourceProvider;
 import org.apache.ambari.server.controller.utilities.ClusterControllerHelper;
+import org.apache.ambari.server.state.StackId;
 import org.apache.ambari.server.topology.Blueprint;
 import org.apache.ambari.server.topology.BlueprintFactory;
 import org.apache.ambari.server.topology.Configuration;
@@ -36,6 +37,7 @@ import org.apache.ambari.server.topology.HostGroupInfo;
 import org.apache.ambari.server.topology.InvalidTopologyTemplateException;
 import org.apache.ambari.server.topology.SecurityConfiguration;
 import org.apache.ambari.server.topology.TopologyRequest;
+import org.apache.ambari.server.topology.TopologyRequestUtil;
 
 /**
  * Provides common cluster request functionality.
@@ -54,6 +56,11 @@ public abstract class BaseClusterRequest implements 
TopologyRequest {
   protected ProvisionAction provisionAction;
 
   /**
+   * The raw request body. We would like to persist it.
+   */
+  protected String rawRequestBody;
+
+  /**
* cluster id
*/
   protected Long clusterId;
@@ -119,6 +126,19 @@ public abstract class BaseClusterRequest implements 
TopologyRequest {
   }
 
   /**
+   * @return the raw request body in JSON string
+   */
+  public String getRawRequestBody() {
+return rawRequestBody;
+  }
+
+  @Override
+  public Set getStackIds() {
+return TopologyRequestUtil.getStackIdsFromRequest(
+  TopologyRequestUtil.getPropertyMap(rawRequestBody));
+  }
+
+  /**
* Validate that all properties specified in the predicate are valid for the 
Host resource.
*
* @param predicate  predicate to validate
@@ -180,6 +200,7 @@ public abstract class BaseClusterRequest implements 
TopologyRequest {
 return securityConfiguration;
   }
 
+
   /**
* Get the host resource provider instance.
*
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java
 
b/ambari-server/sr

[ambari] branch branch-feature-AMBARI-14714 updated: AMBARI-22614 fix OrmTestHelper to support mpacks in unit tests (benyoka) (#569)

2018-03-07 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch branch-feature-AMBARI-14714
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-feature-AMBARI-14714 by 
this push:
 new f471285  AMBARI-22614 fix OrmTestHelper to support mpacks in unit 
tests (benyoka) (#569)
f471285 is described below

commit f47128513300add98bba9478cf92ce5accd55213
Author: benyoka <beny...@users.noreply.github.com>
AuthorDate: Wed Mar 7 10:40:11 2018 +0100

AMBARI-22614 fix OrmTestHelper to support mpacks in unit tests (benyoka) 
(#569)
---
 .../apache/ambari/server/orm/OrmTestHelper.java| 29 --
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/orm/OrmTestHelper.java 
b/ambari-server/src/test/java/org/apache/ambari/server/orm/OrmTestHelper.java
index 9756bda..fbc041d 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/orm/OrmTestHelper.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/orm/OrmTestHelper.java
@@ -49,6 +49,7 @@ import org.apache.ambari.server.orm.dao.ClusterDAO;
 import org.apache.ambari.server.orm.dao.HostDAO;
 import org.apache.ambari.server.orm.dao.HostRoleCommandDAO;
 import org.apache.ambari.server.orm.dao.HostVersionDAO;
+import org.apache.ambari.server.orm.dao.MpackDAO;
 import org.apache.ambari.server.orm.dao.RepositoryVersionDAO;
 import org.apache.ambari.server.orm.dao.RequestDAO;
 import org.apache.ambari.server.orm.dao.ResourceTypeDAO;
@@ -65,6 +66,7 @@ import org.apache.ambari.server.orm.entities.HostEntity;
 import org.apache.ambari.server.orm.entities.HostRoleCommandEntity;
 import org.apache.ambari.server.orm.entities.HostStateEntity;
 import org.apache.ambari.server.orm.entities.HostVersionEntity;
+import org.apache.ambari.server.orm.entities.MpackEntity;
 import org.apache.ambari.server.orm.entities.PrincipalEntity;
 import org.apache.ambari.server.orm.entities.PrincipalTypeEntity;
 import org.apache.ambari.server.orm.entities.RepoDefinitionEntity;
@@ -144,6 +146,9 @@ public class OrmTestHelper {
   @Inject
   private StackDAO stackDAO;
 
+  @Inject
+  MpackDAO mpackDAO;
+
   private static final StackId HDP_206 = new StackId("HDP", "2.0.6");
   public static final StackId STACK_ID = new StackId("HDP", "2.2.0");
   public static final String CLUSTER_NAME = "test_cluster1";
@@ -327,13 +332,32 @@ public class OrmTestHelper {
   }
 
   @Transactional
+  public MpackEntity createMpack(StackId stackId) throws AmbariException {
+List mpackEntities =
+  mpackDAO.findByNameVersion(stackId.getStackName(), 
stackId.getStackVersion());
+MpackEntity mpackEntity = !mpackEntities.isEmpty() ? mpackEntities.get(0) 
: null;
+if (mpackEntities.isEmpty()) {
+  mpackEntity = new MpackEntity();
+  mpackEntity.setMpackName(stackId.getStackName());
+  mpackEntity.setMpackVersion(stackId.getStackVersion());
+  mpackEntity.setMpackUri("http://mpacks.org/; + stackId.toString() + 
".json");
+  mpackDAO.create(mpackEntity);
+}
+return mpackEntity;
+  }
+
+  @Transactional
   public StackEntity createStack(StackId stackId) throws AmbariException {
 StackEntity stackEntity = stackDAO.find(stackId.getStackName(), 
stackId.getStackVersion());
-
 if (null == stackEntity) {
   stackEntity = new StackEntity();
   stackEntity.setStackName(stackId.getStackName());
   stackEntity.setStackVersion(stackId.getStackVersion());
+  List mpackEntities =
+mpackDAO.findByNameVersion(stackId.getStackName(), 
stackId.getStackVersion());
+  if (!mpackEntities.isEmpty()) {
+stackEntity.setMpackId(mpackEntities.get(0).getId());
+  }
   stackDAO.create(stackEntity);
 }
 
@@ -669,6 +693,7 @@ public class OrmTestHelper {
   String version) {
 StackEntity stackEntity = null;
 try {
+  createMpack(stackId); // creating mpack before stack makes sure stack 
will be linked to mpack
   stackEntity = createStack(stackId);
 } catch (Exception e) {
   LOG.error("Expected successful repository", e);
@@ -695,9 +720,9 @@ public class OrmTestHelper {
 repoOsEntity.setAmbariManaged(true);
 repoOsEntity.addRepoDefinition(repoDefinitionEntity1);
 repoOsEntity.addRepoDefinition(repoDefinitionEntity2);
+repoOsEntity.setMpackEntity(createMpack(stackId));
 operatingSystems.add(repoOsEntity);
 
-
 repositoryVersion = repositoryVersionDAO.create(stackEntity, version,
 String.valueOf(System.currentTimeMillis()) + 
uniqueCounter.incrementAndGet(), operatingSystems);
 

-- 
To stop receiving notification emails like this one, please contact
beny...@apache.org.


[ambari] branch branch-feature-AMBARI-14714 updated: [AMBARI-23130] Retrieve cluster template as artifact with passwords filtered out. (#931)

2018-04-11 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch branch-feature-AMBARI-14714
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-feature-AMBARI-14714 by 
this push:
 new 0e70cf2  [AMBARI-23130] Retrieve cluster template as artifact with 
passwords filtered out. (#931)
0e70cf2 is described below

commit 0e70cf2ab030e5eaebad9fb0d0f184c988e1bed3
Author: benyoka <beny...@users.noreply.github.com>
AuthorDate: Wed Apr 11 13:44:07 2018 +0200

[AMBARI-23130] Retrieve cluster template as artifact with passwords 
filtered out. (#931)

* AMBARI-23130 persist raw cluster provision request and extract stack ids 
on server restart (benyoka)

* AMBARI-23130 add columnt to other DDLs + fix DDLs (benyoka)

* AMBARI-23130 fix review findings (benyoka)

* AMBARI-23130 persist only mpack instances instead of the full request

* AMBARI-23130 address review findings (benyoka)

* AMBARI-23130 topology request mpack information normalized (benyoka)

* AMBARI-23130 fix broken unit test (benyoka)

* AMBARI-23130 fix import and review comments

* AMBARI-23130 persist cluster template as artifact WIP (benyoka)

* AMBARI-23130 cluster template passwords replaced - almost complete 
(benyoka)

* AMBARI-23130 save/retrieve cluster template as artifact review candidate 
(benyoka)

* AMBARI-23130 fix review comments (benyoka)

* AMBARI-23130 fix review comments #2 (benyoka)

* AMBARI-23130 fix import (benyoka)
---
 .../internal/ArtifactResourceProvider.java |  11 +-
 .../internal/ClusterResourceProvider.java  |   2 +-
 .../ClusterTemplateArtifactPasswordReplacer.java   | 160 +++
 .../apache/ambari/server/state/ServiceInfo.java|   2 +-
 .../ambari/server/topology/Configurable.java   |  42 -
 .../ambari/server/topology/TopologyManager.java|  44 --
 .../ambari/server/utils/SecretReference.java   | 142 -
 .../internal/ArtifactResourceProviderTest.java |  96 +++-
 .../internal/ClusterResourceProviderTest.java  |   8 +-
 ...lusterTemplateArtifactPasswordReplacerTest.java | 170 +
 .../topology/ClusterDeployWithStartOnlyTest.java   |   2 +-
 ...terInstallWithoutStartOnComponentLevelTest.java |   2 +-
 .../topology/ClusterInstallWithoutStartTest.java   |   2 +-
 .../server/topology/TopologyManagerTest.java   |  16 +-
 .../ambari/server/utils/SecretReferenceTest.java   | 131 
 15 files changed, 792 insertions(+), 38 deletions(-)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ArtifactResourceProvider.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ArtifactResourceProvider.java
index 567cfa9..4fda556 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ArtifactResourceProvider.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ArtifactResourceProvider.java
@@ -18,6 +18,7 @@
 
 package org.apache.ambari.server.controller.internal;
 
+
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
@@ -75,6 +76,8 @@ public class ArtifactResourceProvider extends 
AbstractResourceProvider {
   public static final String CLUSTER_NAME_PROPERTY = RESPONSE_KEY + 
PropertyHelper.EXTERNAL_PATH_SEP + CLUSTER_NAME;
   public static final String SERVICE_NAME_PROPERTY = RESPONSE_KEY + 
PropertyHelper.EXTERNAL_PATH_SEP + SERVICE_NAME;
 
+  public static final String PROVISION_REQUEST_ARTIFACT_NAME = 
"provision_cluster_request";
+
   /**
* primary key fields
*/
@@ -525,7 +528,13 @@ public class ArtifactResourceProvider extends 
AbstractResourceProvider {
   private Resource toResource(ArtifactEntity entity, Set requestedIds) 
throws AmbariException {
 Resource resource = new ResourceImpl(Resource.Type.Artifact);
 setResourceProperty(resource, ARTIFACT_NAME_PROPERTY, 
entity.getArtifactName(), requestedIds);
-setResourceProperty(resource, ARTIFACT_DATA_PROPERTY, 
entity.getArtifactData(), requestedIds);
+Map<String, Object> artifactData =
+  PROVISION_REQUEST_ARTIFACT_NAME.equals(entity.getArtifactName()) ?
+// replace passwords for cluster template artifacts
+new 
ClusterTemplateArtifactPasswordReplacer().replacePasswords(entity.getArtifactData())
 :
+// return data as is for other artifacts
+entity.getArtifactData();
+setResourceProperty(resource, ARTIFACT_DATA_PROPERTY, artifactData, 
requestedIds);
 
 for (Map.Entry<String, String> entry : entity.getForeignKeys().entrySet()) 
{
   TypeRegistration typeRegistration = 
typeRegistrationsByShortFK.get(entry.getKey());
diff --git 
a/ambari-server/src/main/java/org/apache/ambar

[ambari] branch trunk updated: AMBARI-23338 blueprints with installed cluster should bw read-only (benyoka) (#764)

2018-03-27 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
 new 2efd134  AMBARI-23338 blueprints with installed cluster should bw 
read-only (benyoka) (#764)
2efd134 is described below

commit 2efd134576df4865a8badd1aeb9b99aaeb4e33d3
Author: benyoka <beny...@users.noreply.github.com>
AuthorDate: Tue Mar 27 14:44:58 2018 +0200

AMBARI-23338 blueprints with installed cluster should bw read-only 
(benyoka) (#764)

Checked CI logs, Java unit test completed without issues:

2133881 [INFO] Results:
2133881 [INFO]
2133881 [WARNING] Tests run: 5070, Failures: 0, Errors: 0, Skipped: 67

CI test failed due to failing python test in ambari-server (also failing on 
trunk) and cleanup issue after building ambari-agent. Both issues are unrelated.
---
 .../ambari/server/controller/AmbariServer.java |   5 +-
 .../internal/BlueprintResourceProvider.java|  36 --
 .../ambari/server/orm/dao/TopologyRequestDAO.java  |   6 +
 .../server/orm/entities/TopologyRequestEntity.java |   3 +-
 .../internal/BlueprintResourceProviderTest.java| 127 +
 5 files changed, 114 insertions(+), 63 deletions(-)

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 f8e4d21..f7f7f31 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
@@ -91,6 +91,7 @@ import org.apache.ambari.server.orm.dao.PermissionDAO;
 import org.apache.ambari.server.orm.dao.PrincipalDAO;
 import org.apache.ambari.server.orm.dao.PrivilegeDAO;
 import org.apache.ambari.server.orm.dao.ResourceDAO;
+import org.apache.ambari.server.orm.dao.TopologyRequestDAO;
 import org.apache.ambari.server.orm.dao.UserDAO;
 import org.apache.ambari.server.orm.dao.ViewInstanceDAO;
 import org.apache.ambari.server.orm.entities.MetainfoEntity;
@@ -916,8 +917,8 @@ public class AmbariServer {
 StackDefinedPropertyProvider.init(injector);
 
AbstractControllerResourceProvider.init(injector.getInstance(ResourceProviderFactory.class));
 
BlueprintResourceProvider.init(injector.getInstance(BlueprintFactory.class),
-injector.getInstance(BlueprintDAO.class), 
injector.getInstance(SecurityConfigurationFactory.class),
-injector.getInstance(Gson.class), ambariMetaInfo);
+injector.getInstance(BlueprintDAO.class), 
injector.getInstance(TopologyRequestDAO.class),
+injector.getInstance(SecurityConfigurationFactory.class), 
injector.getInstance(Gson.class), ambariMetaInfo);
 StackDependencyResourceProvider.init(ambariMetaInfo);
 ClusterResourceProvider.init(injector.getInstance(TopologyManager.class),
 injector.getInstance(TopologyRequestFactoryImpl.class), 
injector.getInstance(SecurityConfigurationFactory
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintResourceProvider.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintResourceProvider.java
index c665aec..020dbb9 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintResourceProvider.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintResourceProvider.java
@@ -18,6 +18,8 @@
 
 package org.apache.ambari.server.controller.internal;
 
+import static java.util.stream.Collectors.toSet;
+
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -43,6 +45,7 @@ import 
org.apache.ambari.server.controller.spi.SystemException;
 import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
 import org.apache.ambari.server.controller.utilities.PropertyHelper;
 import org.apache.ambari.server.orm.dao.BlueprintDAO;
+import org.apache.ambari.server.orm.dao.TopologyRequestDAO;
 import org.apache.ambari.server.orm.entities.BlueprintConfigEntity;
 import org.apache.ambari.server.orm.entities.BlueprintConfiguration;
 import org.apache.ambari.server.orm.entities.BlueprintEntity;
@@ -50,6 +53,7 @@ import 
org.apache.ambari.server.orm.entities.BlueprintSettingEntity;
 import org.apache.ambari.server.orm.entities.HostGroupComponentEntity;
 import org.apache.ambari.server.orm.entities.HostGroupEntity;
 import org.apache.ambari.server.orm.entities.StackEntity;
+import org.apache.ambari.server.orm.entities.TopologyRequestEntity;
 import org.apache.ambari.server.stack.NoSuchStackException;
 import org.apache.ambari.server.state.SecurityType;
 import org.apache.ambari.server.state.StackInfo;
@@ -156,6 +160,11 @@ public class BlueprintResourceProvider extends 
AbstractControllerResourceP

[ambari] branch branch-feature-AMBARI-14714 updated: [AMBARI-23032] Support for Blueprint exports for MPack-based clusters (#716)

2018-03-26 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch branch-feature-AMBARI-14714
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-feature-AMBARI-14714 by 
this push:
 new 17e3a1d  [AMBARI-23032] Support for Blueprint exports for MPack-based 
clusters (#716)
17e3a1d is described below

commit 17e3a1dbb284d0c70b3375bc3239da72e84723a1
Author: benyoka <beny...@users.noreply.github.com>
AuthorDate: Mon Mar 26 22:19:16 2018 +0200

[AMBARI-23032] Support for Blueprint exports for MPack-based clusters (#716)

* AMBARI-23032 fix execptions, export cluster settings and single mpacks 
(benyoka)

* AMBARI-23032 fix review comments (benyoka)

* AMBARI-23032 better method naming (benyoka)

* AMBARI-23032 fix review comments #2 (benyoka)

* AMBARI-23032 fix review comments #3 (benyoka)

* AMBARI-23032 fix swallowed exceptions during mpack installation

* AMBARI-23032 prepare for mpack info in component

* AMBARI-23032 fix exceptions during installation and blueprint export 
(benyoka)

* AMBARI-23032 revert accidental changes (benyoka)

* AMBARI-23032 revert accidental changes #2 (benyoka)

* AMBARI-23032 fixed a number of unit tests (benyoka)

* AMBARI-23032 make sure Blueprints tag is exported (benyoka)

* Merge branch-feature-AMBARI-14714

* AMBARI-23032 fix import error (benyoka)
---
 .../api/query/render/ClusterBlueprintRenderer.java | 55 +++-
 .../controller/AmbariManagementController.java |  8 +++
 .../controller/AmbariManagementControllerImpl.java |  8 +++
 .../ClusterStackVersionResourceProvider.java   | 17 +--
 .../internal/ComponentResourceProvider.java| 10 ++--
 .../internal/ExportBlueprintRequest.java   | 58 +-
 .../ambari/server/topology/BlueprintFactory.java   |  2 +-
 .../ambari/server/topology/BlueprintImpl.java  | 15 ++
 .../apache/ambari/server/topology/Component.java   | 31 
 .../ambari/server/topology/HostGroupImpl.java  |  9 +++-
 .../ambari/server/topology/ResolvedComponent.java  |  2 +-
 .../server/topology/StackComponentResolver.java| 11 ++--
 .../query/render/ClusterBlueprintRendererTest.java | 31 +---
 .../ActiveWidgetLayoutResourceProviderTest.java|  3 ++
 .../internal/ExportBlueprintRequestTest.java   |  4 ++
 .../UserAuthorizationResourceProviderTest.java |  4 ++
 .../ambari/server/topology/AmbariContextTest.java  |  6 +--
 17 files changed, 177 insertions(+), 97 deletions(-)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/ClusterBlueprintRenderer.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/ClusterBlueprintRenderer.java
index 493ea0e..a9144f4 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/ClusterBlueprintRenderer.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/ClusterBlueprintRenderer.java
@@ -46,7 +46,10 @@ import 
org.apache.ambari.server.controller.internal.ArtifactResourceProvider;
 import 
org.apache.ambari.server.controller.internal.BlueprintConfigurationProcessor;
 import org.apache.ambari.server.controller.internal.BlueprintResourceProvider;
 import 
org.apache.ambari.server.controller.internal.ClusterSettingResourceProvider;
+import 
org.apache.ambari.server.controller.internal.ClusterStackVersionResourceProvider;
+import org.apache.ambari.server.controller.internal.ComponentResourceProvider;
 import org.apache.ambari.server.controller.internal.ExportBlueprintRequest;
+import 
org.apache.ambari.server.controller.internal.HostComponentResourceProvider;
 import org.apache.ambari.server.controller.internal.RequestImpl;
 import org.apache.ambari.server.controller.internal.ResourceImpl;
 import org.apache.ambari.server.controller.spi.ClusterController;
@@ -59,7 +62,6 @@ import 
org.apache.ambari.server.controller.spi.SystemException;
 import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
 import org.apache.ambari.server.controller.utilities.PredicateBuilder;
 import org.apache.ambari.server.state.SecurityType;
-import org.apache.ambari.server.state.StackId;
 import org.apache.ambari.server.topology.AmbariContext;
 import org.apache.ambari.server.topology.ClusterTopology;
 import org.apache.ambari.server.topology.ClusterTopologyImpl;
@@ -112,13 +114,23 @@ public class ClusterBlueprintRenderer extends 
BaseRenderer implements Renderer {
 TreeNode<Set> serviceGroupNode = ensureChild(resultTree, 
Resource.Type.ServiceGroup);
 TreeNode<Set> serviceNode = ensureChild(serviceGroupNode, 
Resource.Type.Service);
 ensureChild(serviceNode, Resource.Type.Component,
-  "ServiceComponentInfo/cluster_name",
-  "ServiceComponentInfo/service_na

[ambari] branch branch-feature-AMBARI-14714 updated: AMBARI-23130 Persist mpack information instead of the full provision request (#603)

2018-03-19 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch branch-feature-AMBARI-14714
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-feature-AMBARI-14714 by 
this push:
 new 0252c08  AMBARI-23130 Persist mpack information instead of the full 
provision request (#603)
0252c08 is described below

commit 0252c08d86f31f49f1445cc3abac023fa54664e9
Author: benyoka <beny...@users.noreply.github.com>
AuthorDate: Mon Mar 19 11:46:03 2018 +0100

AMBARI-23130 Persist mpack information instead of the full provision 
request (#603)

* AMBARI-23130 persist raw cluster provision request and extract stack ids 
on server restart (benyoka)

* AMBARI-23130 add columnt to other DDLs + fix DDLs (benyoka)

* AMBARI-23130 fix review findings (benyoka)

* AMBARI-23130 persist only mpack instances instead of the full request

* AMBARI-23130 address review findings (benyoka)

* AMBARI-23130 topology request mpack information normalized (benyoka)

* AMBARI-23130 fix broken unit test (benyoka)

* AMBARI-23130 fix import and review comments
---
 .../api/query/render/ClusterBlueprintRenderer.java |   7 -
 .../controller/internal/BaseClusterRequest.java|  99 +++---
 .../internal/ClusterResourceProvider.java  |   2 +-
 .../controller/internal/HostResourceProvider.java  |   4 +-
 .../internal/ProvisionClusterRequest.java  |  19 ++-
 .../controller/internal/ScaleClusterRequest.java   |   3 +-
 .../orm/entities/BlueprintMpackInstanceEntity.java | 151 ++---
 ...gEntity.java => MpackInstanceConfigEntity.java} |  16 +--
 ...ityPk.java => MpackInstanceConfigEntityPk.java} |   6 +-
 ...nstanceEntity.java => MpackInstanceEntity.java} |  52 +++
 ...Entity.java => MpackInstanceServiceEntity.java} |  26 ++--
 ...igEntity.java => MpackServiceConfigEntity.java} |  16 +--
 ...tityPk.java => MpackServiceConfigEntityPk.java} |   6 +-
 .../server/orm/entities/TopologyRequestEntity.java |  20 +--
 ...ava => TopologyRequestMpackInstanceEntity.java} |  52 +++
 .../ambari/server/topology/BlueprintFactory.java   |   5 +-
 .../ambari/server/topology/BlueprintImpl.java  |   7 +-
 .../ambari/server/topology/MpackInstance.java  |  74 +++---
 .../ambari/server/topology/PersistedStateImpl.java |  87 ++--
 .../server/topology/TopologyRequestFactory.java|   2 +-
 .../topology/TopologyRequestFactoryImpl.java   |   4 +-
 .../server/topology/TopologyRequestUtil.java   |  76 ---
 .../org/apache/ambari/server/utils/JsonUtils.java  |  42 +-
 .../src/main/resources/Ambari-DDL-Derby-CREATE.sql |  58 
 .../src/main/resources/Ambari-DDL-MySQL-CREATE.sql |  30 ++--
 .../main/resources/Ambari-DDL-Oracle-CREATE.sql|  30 ++--
 .../main/resources/Ambari-DDL-Postgres-CREATE.sql  |  30 ++--
 .../resources/Ambari-DDL-SQLAnywhere-CREATE.sql|  32 +++--
 .../main/resources/Ambari-DDL-SQLServer-CREATE.sql |  30 ++--
 .../src/main/resources/META-INF/persistence.xml|   8 +-
 .../apache/ambari/server/H2DatabaseCleaner.java|   2 +
 .../internal/ClusterResourceProviderTest.java  |  12 +-
 .../internal/ProvisionClusterRequestTest.java  |  62 ++---
 .../internal/ScaleClusterRequestTest.java  |  20 +--
 .../server/orm/entities/BlueprintEntityTest2.java  |  10 +-
 .../server/topology/ClusterTopologyImplTest.java   |   4 +
 .../server/topology/PersistedStateImplTest.java| 103 --
 .../server/topology/TopologyManagerTest.java   |   2 +-
 .../server/topology/TopologyRequestUtilTest.java   |  60 
 39 files changed, 524 insertions(+), 745 deletions(-)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/ClusterBlueprintRenderer.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/ClusterBlueprintRenderer.java
index e34fcb1..493ea0e 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/ClusterBlueprintRenderer.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/ClusterBlueprintRenderer.java
@@ -33,7 +33,6 @@ import java.util.Set;
 
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.api.query.QueryInfo;
-import org.apache.ambari.server.api.services.AmbariMetaInfo;
 import org.apache.ambari.server.api.services.Request;
 import org.apache.ambari.server.api.services.Result;
 import org.apache.ambari.server.api.services.ResultImpl;
@@ -85,12 +84,6 @@ public class ClusterBlueprintRenderer extends BaseRenderer 
implements Renderer {
*/
   private AmbariManagementController controller = AmbariServer.getController();
 
-
-  /**
-   * MetaInfo used to get stack and mpack information.
-   */
-  private AmbariMetaInfo metaInfo = controller.getAmbariMetaInfo();
-
 //  /**
 //   

[ambari] branch branch-feature-AMBARI-14714 updated: AMBARI-23265 fix imports (benyoka) (#704)

2018-03-19 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch branch-feature-AMBARI-14714
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-feature-AMBARI-14714 by 
this push:
 new b52c947  AMBARI-23265 fix imports (benyoka) (#704)
b52c947 is described below

commit b52c947654948b1619845e25964788d010ba87b0
Author: benyoka <beny...@users.noreply.github.com>
AuthorDate: Mon Mar 19 17:09:15 2018 +0100

AMBARI-23265 fix imports (benyoka) (#704)
---
 .../controller/internal/DefaultOperatingSystemResourceProvider.java  | 1 -
 .../server/controller/internal/OperatingSystemResourceProvider.java  | 1 -
 2 files changed, 2 deletions(-)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/DefaultOperatingSystemResourceProvider.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/DefaultOperatingSystemResourceProvider.java
index 76e059e..faf0e2b 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/DefaultOperatingSystemResourceProvider.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/DefaultOperatingSystemResourceProvider.java
@@ -17,7 +17,6 @@
  */
 package org.apache.ambari.server.controller.internal;
 
-import java.util.HashMap;
 import java.util.LinkedHashSet;
 import java.util.Map;
 import java.util.Set;
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/OperatingSystemResourceProvider.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/OperatingSystemResourceProvider.java
index bfe33ea..6fb610c 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/OperatingSystemResourceProvider.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/OperatingSystemResourceProvider.java
@@ -18,7 +18,6 @@
 package org.apache.ambari.server.controller.internal;
 
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.List;

-- 
To stop receiving notification emails like this one, please contact
beny...@apache.org.


[ambari] branch AMBARI-23032-branch-feature-AMBARI-14714 deleted (was d550a58)

2018-02-26 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a change to branch AMBARI-23032-branch-feature-AMBARI-14714
in repository https://gitbox.apache.org/repos/asf/ambari.git.


 was d550a58  AMBARI-23032 fix review comments #3 (benyoka)

This change permanently discards the following revisions:

 discard d550a58  AMBARI-23032 fix review comments #3 (benyoka)
 discard 56ac618  AMBARI-23032 fix review comments #2 (benyoka)
 discard c965af7  AMBARI-23032 better method naming (benyoka)
 discard 98ce2af  AMBARI-23032 fix review comments (benyoka)
 discard cc027c6  AMBARI-23032 fix execptions, export cluster settings and 
single mpacks (benyoka)

-- 
To stop receiving notification emails like this one, please contact
beny...@apache.org.


[ambari] branch branch-feature-AMBARI-14714 updated: [AMBARI-24162] Support for cluster-settings (remove cluster-env) (benyoka) (#1627)

2018-06-29 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch branch-feature-AMBARI-14714
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-feature-AMBARI-14714 by 
this push:
 new 48ddb09  [AMBARI-24162] Support for cluster-settings (remove 
cluster-env) (benyoka) (#1627)
48ddb09 is described below

commit 48ddb0901e2b12ee881698acf8a7b3de5c02799c
Author: benyoka 
AuthorDate: Fri Jun 29 10:23:08 2018 +0200

[AMBARI-24162] Support for cluster-settings (remove cluster-env) (benyoka) 
(#1627)

* AMBARI-24162 copy cluster settings from cluster-env + setting fixes 
(benyoka)

* AMBARI-24162 fixint tests WIP (benyoka)

* AMBARI-24162 fix unit tests #2 (benyoka)

* AMBARI-24162 write new unit tests (benyoka)

* AMBARI-24162 review commits and unit test fixes (benyoka)

* AMBARI-24162 fix blueprint export and blueprint unit tests (benyoka)
---
 .../controller/AmbariManagementControllerImpl.java |  10 +-
 .../internal/BlueprintConfigurationProcessor.java  |  48 
 .../internal/BlueprintResourceProvider.java|  32 +++---
 .../apache/ambari/server/state/ConfigHelper.java   |   7 +-
 .../ambari/server/topology/AmbariContext.java  |  44 ---
 .../ambari/server/topology/BlueprintFactory.java   |   8 +-
 .../ambari/server/topology/BlueprintImpl.java  |   2 +-
 .../server/topology/ClusterTopologyImpl.java   |  52 +
 .../org/apache/ambari/server/topology/Setting.java |  20 
 .../ambari/server/topology/SettingFactory.java |   7 +-
 .../topology/tasks/ConfigureClusterTask.java   |   1 +
 .../validators/StackConfigTypeValidator.java   |   7 ++
 .../src/main/resources/cluster-settings.xml|  21 
 .../BlueprintConfigurationProcessorTest.java   | 101 +++-
 .../ambari/server/topology/AmbariContextTest.java  | 128 ++---
 .../topology/ClusterConfigurationRequestTest.java  |  18 ++-
 .../topology/ClusterDeployWithStartOnlyTest.java   |  55 +
 .../topology/ClusterDeploymentTestCommon.java  |  38 ++
 ...terInstallWithoutStartOnComponentLevelTest.java |  48 +---
 .../topology/ClusterInstallWithoutStartTest.java   |  51 +---
 .../server/topology/ClusterTopologyImplTest.java   |  50 +++-
 .../ambari/server/topology/SettingFactoryTest.java |  27 +
 .../apache/ambari/server/topology/SettingTest.java |  35 ++
 .../server/topology/TopologyManagerTest.java   |   9 +-
 24 files changed, 524 insertions(+), 295 deletions(-)

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 aa92bac..31dea50 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
@@ -2588,15 +2588,11 @@ public class AmbariManagementControllerImpl implements 
AmbariManagementControlle
 
(commandParams.get(CLUSTER_PHASE_PROPERTY).equals(CLUSTER_PHASE_INITIAL_INSTALL)
 ||
 
commandParams.get(CLUSTER_PHASE_PROPERTY).equals(CLUSTER_PHASE_INITIAL_START))) 
{
   String retryEnabledStr =
-  configHelper.getValueFromDesiredConfigurations(cluster, 
ConfigHelper.CLUSTER_ENV,
- 
ConfigHelper.CLUSTER_ENV_RETRY_ENABLED);
+
cluster.getClusterSetting(ConfigHelper.COMMAND_RETRY_ENABLED).getClusterSettingValue();
   String commandsStr =
-  configHelper.getValueFromDesiredConfigurations(cluster, 
ConfigHelper.CLUSTER_ENV,
- 
ConfigHelper.CLUSTER_ENV_RETRY_COMMANDS);
+
cluster.getClusterSetting(ConfigHelper.COMMANDS_TO_RETRY).getClusterSettingValue();
   String retryMaxTimeStr =
-  configHelper.getValueFromDesiredConfigurations(cluster,
- 
ConfigHelper.CLUSTER_ENV,
- 
ConfigHelper.CLUSTER_ENV_RETRY_MAX_TIME_IN_SEC);
+
cluster.getClusterSetting(ConfigHelper.COMMAND_RETRY_MAX_TIME_IN_SEC).getClusterSettingValue();
   if (StringUtils.isNotEmpty(retryEnabledStr)) {
 retryEnabled = Boolean.TRUE.toString().equals(retryEnabledStr);
   }
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
index 8275cfc..5c45712 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal

[ambari] branch trunk updated: AMBARI-24829 blueprint install for HDFS_CLIENT and YARN timeline service components without the rest of HDFS/YARN (benyoka) (#2516)

2018-10-26 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
 new e6c7522  AMBARI-24829 blueprint install for HDFS_CLIENT and YARN 
timeline service components without the rest of HDFS/YARN (benyoka) (#2516)
e6c7522 is described below

commit e6c7522ef7528ae3fa97a4a9c1d97da54bfdaab5
Author: benyoka 
AuthorDate: Fri Oct 26 22:57:56 2018 +0200

AMBARI-24829 blueprint install for HDFS_CLIENT and YARN timeline service 
components without the rest of HDFS/YARN (benyoka) (#2516)

* AMBARI-24829 blueprint install for HDFS_CLIENT and YARN timeline service 
components without the rest of HDFS/YARN (benyoka)

* AMBARI-24829 OptionalSingleTopologyUpdater logs unsuccesful update attempt
---
 .../internal/BlueprintConfigurationProcessor.java  | 34 --
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
index c15ca70..22ab053 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
@@ -2152,6 +2152,8 @@ public class BlueprintConfigurationProcessor {
   try {
 return super.updateForClusterCreate(propertyName, origValue, 
properties, topology);
   } catch (IllegalArgumentException illegalArgumentException) {
+LOG.warn("Error while updating property [{}] with original value [{}]. 
Exception message: {}",
+  propertyName, origValue, illegalArgumentException.getMessage());
 // return the original value, since the optional component is not 
available in this cluster
 return origValue;
   }
@@ -2922,13 +2924,13 @@ public class BlueprintConfigurationProcessor {
 
 
 // NAMENODE
-hdfsSiteMap.put("dfs.http.address", new 
SingleHostTopologyUpdater("NAMENODE"));
-hdfsSiteMap.put("dfs.https.address", new 
SingleHostTopologyUpdater("NAMENODE"));
-coreSiteMap.put("fs.default.name", new 
SingleHostTopologyUpdater("NAMENODE"));
-hdfsSiteMap.put("dfs.namenode.http-address", new 
SingleHostTopologyUpdater("NAMENODE"));
-hdfsSiteMap.put("dfs.namenode.https-address", new 
SingleHostTopologyUpdater("NAMENODE"));
-hdfsSiteMap.put("dfs.namenode.rpc-address", new 
SingleHostTopologyUpdater("NAMENODE"));
-coreSiteMap.put("fs.defaultFS", new SingleHostTopologyUpdater("NAMENODE"));
+hdfsSiteMap.put("dfs.http.address", new 
OptionalSingleHostTopologyUpdater("NAMENODE"));
+hdfsSiteMap.put("dfs.https.address", new 
OptionalSingleHostTopologyUpdater("NAMENODE"));
+coreSiteMap.put("fs.default.name", new 
OptionalSingleHostTopologyUpdater("NAMENODE"));
+hdfsSiteMap.put("dfs.namenode.http-address", new 
OptionalSingleHostTopologyUpdater("NAMENODE"));
+hdfsSiteMap.put("dfs.namenode.https-address", new 
OptionalSingleHostTopologyUpdater("NAMENODE"));
+hdfsSiteMap.put("dfs.namenode.rpc-address", new 
OptionalSingleHostTopologyUpdater("NAMENODE"));
+coreSiteMap.put("fs.defaultFS", new 
OptionalSingleHostTopologyUpdater("NAMENODE"));
 hbaseSiteMap.put("hbase.rootdir", new 
OptionalSingleHostTopologyUpdater("NAMENODE"));
 accumuloSiteMap.put("instance.volumes", new 
SingleHostTopologyUpdater("NAMENODE"));
 // HDFS shared.edits JournalNode Quorum URL uses semi-colons as separators
@@ -2939,8 +2941,8 @@ public class BlueprintConfigurationProcessor {
 clusterEnvMap.put(HDFS_STANDBY_NAMENODE_PROPERTY_NAME, new 
SingleHostTopologyUpdater("NAMENODE"));
 
 // SECONDARY_NAMENODE
-hdfsSiteMap.put("dfs.secondary.http.address", new 
SingleHostTopologyUpdater("SECONDARY_NAMENODE"));
-hdfsSiteMap.put("dfs.namenode.secondary.http-address", new 
SingleHostTopologyUpdater("SECONDARY_NAMENODE"));
+hdfsSiteMap.put("dfs.secondary.http.address", new 
OptionalSingleHostTopologyUpdater("SECONDARY_NAMENODE"));
+hdfsSiteMap.put("dfs.namenode.secondary.http-address", new 
OptionalSingleHostTopologyUpdater("SECONDARY_NAMENODE"));
 
 // JOBTRACKER
 mapredSiteMap.put("mapred.job.tracker", new 
SingleHostTopologyUpdater("JOBTRACKER"));
@@ -2955,1

[ambari] branch trunk updated: AMBARI-24881 Add Service Request JSON (benyoka) (#2594)

2018-11-13 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
 new 664d14d  AMBARI-24881 Add Service Request JSON (benyoka) (#2594)
664d14d is described below

commit 664d14dae54655a092a304400944bae7e24d1275
Author: benyoka 
AuthorDate: Tue Nov 13 13:45:28 2018 +0100

AMBARI-24881 Add Service Request JSON (benyoka) (#2594)

* AMBARI-24881 Add Service Request JSON (benyoka)

* AMBARI-24881 review comments (benyoka)
---
 .../server/controller/AddServiceRequest.java   | 250 
 .../ambari/server/topology/Configurable.java   | 147 
 .../server/controller/AddServiceRequestTest.java   | 263 +
 .../ambari/server/topology/ConfigurableTest.java   | 104 
 .../resources/add_service_api/configurable.json|  16 ++
 .../resources/add_service_api/configurable2.json   |   8 +
 .../test/resources/add_service_api/request1.json   |  39 +++
 .../test/resources/add_service_api/request2.json   |  18 ++
 .../test/resources/add_service_api/request3.json   |   6 +
 .../test/resources/add_service_api/request4.json   |  13 +
 .../add_service_api/request_invalid_1.json |  23 ++
 .../add_service_api/request_invalid_2.json |  40 
 12 files changed, 927 insertions(+)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AddServiceRequest.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AddServiceRequest.java
new file mode 100644
index 000..83a66d8
--- /dev/null
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AddServiceRequest.java
@@ -0,0 +1,250 @@
+/*
+ * 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.controller;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static java.util.Collections.emptySet;
+import static 
org.apache.ambari.server.controller.internal.BaseClusterRequest.PROVISION_ACTION_PROPERTY;
+import static 
org.apache.ambari.server.controller.internal.ProvisionClusterRequest.CONFIG_RECOMMENDATION_STRATEGY;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+
+import org.apache.ambari.annotations.ApiIgnore;
+import org.apache.ambari.server.controller.internal.ProvisionAction;
+import org.apache.ambari.server.topology.ConfigRecommendationStrategy;
+import org.apache.ambari.server.topology.Configurable;
+import org.apache.ambari.server.topology.Configuration;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * Data object representing an add service request.
+ */
+@ApiModel
+@JsonInclude(JsonInclude.Include.NON_EMPTY)
+public final class AddServiceRequest {
+
+  static final String OPERATION_TYPE = "operation_type";
+  static final String STACK_NAME = "stack_name";
+  static final String STACK_VERSION = "stack_version";
+  static final String SERVICES = "services";
+  static final String COMPONENTS = "components";
+
+  private final OperationType operationType;
+  private final ConfigRecommendationStrategy recommendationStrategy;
+  private final ProvisionAction provisionAction;
+  private final String stackName;
+  private final String stackVersion;
+  private final Set services;
+  private final Set components;
+  private final Configuration configuration;
+
+  @JsonCreator
+  public AddServiceRequest(@JsonProperty(OPERATION_TYPE) OperationType 
operationType,
+   @JsonProperty(CONFIG_RECOMMENDATION_STRATEGY) 
ConfigRecommendationStrategy recommendationStrategy,
+   
@JsonProperty(PROVISION_ACTION_PROPERTY)ProvisionAction provisionAction,
+   @JsonProperty(S

[ambari] branch trunk updated: AMBARI-24871 fix checkstyle violation (benyoka) (#2620)

2018-11-15 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
 new 09f3766  AMBARI-24871 fix checkstyle violation (benyoka) (#2620)
09f3766 is described below

commit 09f376681cd8043ce63aee0bc40cfb919bdfe991
Author: benyoka 
AuthorDate: Thu Nov 15 21:35:57 2018 +0100

AMBARI-24871 fix checkstyle violation (benyoka) (#2620)
---
 .../org/apache/ambari/server/security/encryption/CredentialProvider.java | 1 -
 1 file changed, 1 deletion(-)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/CredentialProvider.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/CredentialProvider.java
index 7d7bb68..6ebccbf 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/CredentialProvider.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/CredentialProvider.java
@@ -17,7 +17,6 @@
  */
 package org.apache.ambari.server.security.encryption;
 
-import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.util.Random;



[ambari] branch trunk updated: [Ambari-24906] JSON validation for AddServiceRequest (#2617)

2018-11-15 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
 new 6f7b0a9  [Ambari-24906] JSON validation for AddServiceRequest (#2617)
6f7b0a9 is described below

commit 6f7b0a9542a3f4c013faa90a4303a31238cc5c78
Author: benyoka 
AuthorDate: Thu Nov 15 22:15:12 2018 +0100

[Ambari-24906] JSON validation for AddServiceRequest (#2617)

* AMBARI-24906 validate configs in JSON files (benyoka)

* AMBARI-2490 fix test and licence issue (benyoka)

* AMBARI-2490 fix missing files (benyoka)

* AMBARI-24906 review comments (benyoka)
---
 .../server/controller/AddServiceRequest.java   |   5 +-
 .../ambari/server/topology/Configurable.java   |  93 +-
 .../{Configurable.java => ConfigurableHelper.java} | 105 +++
 .../server/topology/ConfigurationFactory.java  |  36 +++-
 .../server/controller/AddServiceRequestTest.java   |   8 +-
 .../ambari/server/topology/ConfigurableTest.java   |  66 +--
 .../add_service_api/invalid_configurables.txt  | 193 +
 .../add_service_api/request_invalid_3.json |  42 +
 8 files changed, 398 insertions(+), 150 deletions(-)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AddServiceRequest.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AddServiceRequest.java
index 22a32ce..ccf2ecf 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/AddServiceRequest.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AddServiceRequest.java
@@ -37,6 +37,7 @@ import org.apache.ambari.annotations.ApiIgnore;
 import org.apache.ambari.server.controller.internal.ProvisionAction;
 import org.apache.ambari.server.topology.ConfigRecommendationStrategy;
 import org.apache.ambari.server.topology.Configurable;
+import org.apache.ambari.server.topology.ConfigurableHelper;
 import org.apache.ambari.server.topology.Configuration;
 
 import com.fasterxml.jackson.annotation.JsonCreator;
@@ -85,7 +86,7 @@ public final class AddServiceRequest {
@JsonProperty(COMPONENTS)Set components,
@JsonProperty(CONFIGURATIONS) Collection> configs) {
 this(operationType, recommendationStrategy, provisionAction, stackName, 
stackVersion, services, components,
-  Configurable.parseConfigs(configs));
+  ConfigurableHelper.parseConfigs(configs));
   }
 
 
@@ -169,7 +170,7 @@ public final class AddServiceRequest {
   @JsonProperty(CONFIGURATIONS)
   @ApiModelProperty(name = CONFIGURATIONS)
   public Collection>> getConfigurationContents() {
-return Configurable.convertConfigToMap(configuration);
+return ConfigurableHelper.convertConfigToMap(configuration);
   }
 
 // --- inner classes ---
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/Configurable.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/Configurable.java
index e8f780d..eb356a1 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/Configurable.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/Configurable.java
@@ -18,23 +18,13 @@
 
 package org.apache.ambari.server.topology;
 
-import static 
org.apache.ambari.server.controller.internal.BlueprintResourceProvider.PROPERTIES_ATTRIBUTES_PROPERTY_ID;
-import static 
org.apache.ambari.server.controller.internal.BlueprintResourceProvider.PROPERTIES_PROPERTY_ID;
-
-import java.util.ArrayList;
 import java.util.Collection;
-import java.util.HashMap;
 import java.util.Map;
-import java.util.Set;
-
-import javax.annotation.Nullable;
 
 import org.apache.ambari.annotations.ApiIgnore;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.fasterxml.jackson.annotation.JsonProperty;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Sets;
 
 import io.swagger.annotations.ApiModelProperty;
 
@@ -45,7 +35,7 @@ import io.swagger.annotations.ApiModelProperty;
  */
 public interface Configurable {
 
-  public static final String CONFIGURATIONS = "configurations";
+  String CONFIGURATIONS = "configurations";
 
   @JsonIgnore
   @ApiIgnore
@@ -58,90 +48,13 @@ public interface Configurable {
   @JsonProperty(CONFIGURATIONS)
   @ApiModelProperty(name = CONFIGURATIONS)
   default void setConfigs(Collection> configs) {
-setConfiguration(parseConfigs(configs));
+setConfiguration(ConfigurableHelper.parseConfigs(configs));
   }
 
   @JsonProperty(CONFIGURATIONS)
   @ApiModelProperty(name = CONFIGURATIONS)
   default Collection>> getConfigs() {
-return convertConfigToMap(getConfiguration());
-  }
-
-  /**
-   * Parses configuration maps The configs can be in fully structured JSON, 
e.g.
-   *

[ambari] branch trunk updated: AMBARI-24888 fix SingleHostTopologyUpdater (benyoka) (#2603)

2018-11-14 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
 new 6395167  AMBARI-24888 fix SingleHostTopologyUpdater (benyoka) (#2603)
6395167 is described below

commit 6395167a5a74d44b9d86dabeb2c0860df450ec67
Author: benyoka 
AuthorDate: Wed Nov 14 12:10:15 2018 +0100

AMBARI-24888 fix SingleHostTopologyUpdater (benyoka) (#2603)

* AMBARI-24888 fix SingleHostTopologyUpdater (benyoka)

* AMBARI-24888 review comment (benyoka)
---
 .../internal/BlueprintConfigurationProcessor.java  | 80 ++
 .../BlueprintConfigurationProcessorTest.java   | 36 ++
 2 files changed, 56 insertions(+), 60 deletions(-)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
index 7803e90..1daf1f5 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
@@ -122,6 +122,7 @@ public class BlueprintConfigurationProcessor {
 
   private final static String HADOOP_ENV_CONFIG_TYPE_NAME = "hadoop-env";
   private final static String RANGER_TAGSYNC_SITE_CONFIG_TYPE_NAME = 
"ranger-tagsync-site";
+  private static final String LOCALHOST = "localhost";
 
 
   /**
@@ -1887,14 +1888,20 @@ public class BlueprintConfigurationProcessor {
  ClusterTopology topology) {
 
   String replacedValue = super.updateForClusterCreate(propertyName, 
origValue, properties, topology);
+  // %HOSTGROUP% token replacement happened
   if (!Objects.equals(origValue, replacedValue)) {
 return replacedValue;
-  } else {
+  }
+  // localhost typically means stack default values. If property is set to 
a concrete value such as an FQDN skip
+  // validation and update
+  else if (null != origValue && !origValue.contains(LOCALHOST)) {
+return origValue;
+  }
+  else {
 int matchingGroupCount = 
topology.getHostGroupsForComponent(component).size();
 if (matchingGroupCount == 1) {
   //todo: warn if > 1 hosts
-  return replacePropertyValue(origValue,
-
topology.getHostAssignmentsForComponent(component).iterator().next(), 
properties);
+  return origValue.replace(LOCALHOST, 
topology.getHostAssignmentsForComponent(component).iterator().next() );
 } else {
   //todo: extract all hard coded HA logic
   Cardinality cardinality = 
topology.getBlueprint().getStack().getCardinality(component);
@@ -1924,12 +1931,6 @@ public class BlueprintConfigurationProcessor {
 // reference must point to the logical nameservice, rather 
than an individual namenode
 return origValue;
   }
-
-  if (!origValue.contains("localhost")) {
-// if this NameNode HA property is a FDQN, then simply return 
it
-return origValue;
-  }
-
 }
 
 if (topology.isNameNodeHAEnabled() && 
isComponentSecondaryNameNode() && (matchingGroupCount == 0)) {
@@ -1938,48 +1939,6 @@ public class BlueprintConfigurationProcessor {
   return origValue;
 }
 
-if (topology.isYarnResourceManagerHAEnabled() && 
isComponentResourceManager() && (matchingGroupCount == 2)) {
-  if (!origValue.contains("localhost")) {
-// if this Yarn property is a FQDN, then simply return it
-return origValue;
-  }
-}
-
-if ((isOozieServerHAEnabled(properties)) && 
isComponentOozieServer() && (matchingGroupCount > 1)) {
-  if (!origValue.contains("localhost")) {
-// if this Oozie property is a FQDN, then simply return it
-return origValue;
-  }
-}
-
-if ((isHiveServerHAEnabled(properties)) && isComponentHiveServer() 
&& (matchingGroupCount > 1)) {
-  if (!origValue.contains("localhost")) {
-// if this Hive property is a FQDN, then simply return it
-return origValue;
-  }
-}
-
-if ((isComponentHiveMetaStoreServer()) && matchingGroupCount > 1) {
-  if (!origValue.contains("localhost")) {
-// if this Hive MetaStore property is a FQDN, then simply 
return it
-return origV

[ambari] branch trunk updated: [AMBARI-24870] Allow blueprint install without HISTORYMANAGER, APP_TIMELINE_SERVER (benyoka) (#2590)

2018-11-09 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
 new e440c50  [AMBARI-24870] Allow blueprint install without 
HISTORYMANAGER, APP_TIMELINE_SERVER (benyoka) (#2590)
e440c50 is described below

commit e440c50d73c96c9772f2594a23de061f9786d586
Author: benyoka 
AuthorDate: Fri Nov 9 19:10:23 2018 +0100

[AMBARI-24870] Allow blueprint install without HISTORYMANAGER, 
APP_TIMELINE_SERVER (benyoka) (#2590)

* AMBARI-24870 Allow blueprint install without HISTORYMANAGER, 
APP_TIMELINE_SERVER (benyoka)

* AMBARI-24870 fix unit test (benyoka)
---
 .../internal/BlueprintConfigurationProcessor.java  | 16 +++
 .../BlueprintConfigurationProcessorTest.java   | 23 +++---
 2 files changed, 15 insertions(+), 24 deletions(-)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
index 1b62c29..7803e90 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
@@ -2961,10 +2961,10 @@ public class BlueprintConfigurationProcessor {
 mapredSiteMap.put("mapreduce.job.hdfs-servers", new 
SingleHostTopologyUpdater("NAMENODE"));
 
 
-// HISTORY_SERVER
-yarnSiteMap.put("yarn.log.server.url", new 
SingleHostTopologyUpdater("HISTORYSERVER"));
-mapredSiteMap.put("mapreduce.jobhistory.webapp.address", new 
SingleHostTopologyUpdater("HISTORYSERVER"));
-mapredSiteMap.put("mapreduce.jobhistory.address", new 
SingleHostTopologyUpdater("HISTORYSERVER"));
+// HISTORYSERVER
+yarnSiteMap.put("yarn.log.server.url", new 
OptionalSingleHostTopologyUpdater("HISTORYSERVER"));
+mapredSiteMap.put("mapreduce.jobhistory.webapp.address", new 
OptionalSingleHostTopologyUpdater("HISTORYSERVER"));
+mapredSiteMap.put("mapreduce.jobhistory.address", new 
OptionalSingleHostTopologyUpdater("HISTORYSERVER"));
 
 // RESOURCEMANAGER
 yarnSiteMap.put("yarn.resourcemanager.hostname", new 
OptionalSingleHostTopologyUpdater("RESOURCEMANAGER"));
@@ -2976,10 +2976,10 @@ public class BlueprintConfigurationProcessor {
 yarnSiteMap.put("yarn.resourcemanager.webapp.https.address", new 
OptionalSingleHostTopologyUpdater("RESOURCEMANAGER"));
 
 // APP_TIMELINE_SERVER
-yarnSiteMap.put("yarn.timeline-service.address", new 
SingleHostTopologyUpdater("APP_TIMELINE_SERVER"));
-yarnSiteMap.put("yarn.timeline-service.webapp.address", new 
SingleHostTopologyUpdater("APP_TIMELINE_SERVER"));
-yarnSiteMap.put("yarn.timeline-service.webapp.https.address", new 
SingleHostTopologyUpdater("APP_TIMELINE_SERVER"));
-yarnSiteMap.put("yarn.log.server.web-service.url", new 
SingleHostTopologyUpdater("APP_TIMELINE_SERVER"));
+yarnSiteMap.put("yarn.timeline-service.address", new 
OptionalSingleHostTopologyUpdater("APP_TIMELINE_SERVER"));
+yarnSiteMap.put("yarn.timeline-service.webapp.address", new 
OptionalSingleHostTopologyUpdater("APP_TIMELINE_SERVER"));
+yarnSiteMap.put("yarn.timeline-service.webapp.https.address", new 
OptionalSingleHostTopologyUpdater("APP_TIMELINE_SERVER"));
+yarnSiteMap.put("yarn.log.server.web-service.url", new 
OptionalSingleHostTopologyUpdater("APP_TIMELINE_SERVER"));
 
 // TIMELINE_READER
 yarnSiteMap.put("yarn.timeline-service.reader.webapp.address", new 
MultipleHostTopologyUpdater("TIMELINE_READER"));
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
index f718862..de70e36 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java
@@ -2565,15 +2565,11 @@ public class BlueprintConfigurationProcessorTest 
extends EasyMockSupport {
   @Test
   public void 
testDoUpdateForClusterCreate_SingleHostProperty__MissingComponent() throws 
Exception {
 Map> properties = new HashMap<>();
-Map typeProps = new HashMap<>

[ambari] branch branch-feature-AMBARI-14714 updated: [AMBARI-24657] Fix exception in blueprint deployment with host group configs (#2355)

2018-09-24 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch branch-feature-AMBARI-14714
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-feature-AMBARI-14714 by 
this push:
 new deac5ab  [AMBARI-24657] Fix exception in blueprint deployment with 
host group configs (#2355)
deac5ab is described below

commit deac5ab3030109681f5fe80401de45363e40a7c0
Author: benyoka 
AuthorDate: Mon Sep 24 22:09:15 2018 +0200

[AMBARI-24657] Fix exception in blueprint deployment with host group 
configs (#2355)

* AMBARI-24657 WIP (benyoka)

* AMBARI-24657 Blueprint install with host group configs (benyoka)

* AMBARI-24657 fixe review comment (benyoka)

* AMBARI-24657 fixed unit tests (benyoka)
---
 .../controller/AmbariManagementControllerImpl.java | 10 ++-
 .../server/controller/internal/CompositeStack.java | 18 ++
 .../ambari/server/controller/internal/Stack.java   |  9 +++
 .../controller/internal/StackDefinition.java   |  6 ++
 .../org/apache/ambari/server/state/Cluster.java| 17 --
 .../ambari/server/state/cluster/ClusterImpl.java   | 43 -
 .../server/state/configgroup/ConfigGroupImpl.java  | 18 --
 .../ambari/server/topology/AmbariContext.java  | 48 ++-
 .../ambari/server/utils/CollectionUtils.java   | 71 ++
 .../controller/internal/CompositeStackTest.java| 19 ++
 .../server/controller/internal/StackTest.java  | 54 +++-
 .../ambari/server/state/ConfigGroupTest.java   | 11 +++-
 .../ambari/server/topology/AmbariContextTest.java  |  4 +-
 13 files changed, 242 insertions(+), 86 deletions(-)

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 2b3bff2..ba6f902 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
@@ -69,6 +69,7 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
+import java.util.Optional;
 import java.util.Set;
 import java.util.SortedMap;
 import java.util.TreeMap;
@@ -1160,7 +1161,10 @@ public class AmbariManagementControllerImpl implements 
AmbariManagementControlle
 
 Config config = configFactory.createNew(stackId, cluster, type, 
versionTag, properties,
 propertiesAttributes, serviceId);
-
+// TODO: the constructor of ConfigImpl adds itself to the cluster so 
calling this method
+// should not be necessary. It causes some confusion with service instance 
level configs
+// (where a serviceId is present). The result of the extra addConfig() 
call adds these configs
+// to the cluster level configs too adding confusion.
 cluster.addConfig(config);
 return config;
   }
@@ -1626,7 +1630,7 @@ public class AmbariManagementControllerImpl implements 
AmbariManagementControlle
   Config config = null;
   //TODO : Remove after getting rid of cluster configurations
   if (request.getServiceId() != null) {
-config = cluster.getConfigByServiceId(request.getType(), 
request.getVersionTag(), request.getServiceId());
+config = cluster.getConfig(request.getType(), request.getVersionTag(), 
Optional.of(request.getServiceId()));
 if (null != config) {
   response = new ConfigurationResponse(
   cluster.getClusterName(), config, request.getServiceId(), 
request.getServiceGroupId());
@@ -1911,7 +1915,7 @@ public class AmbariManagementControllerImpl implements 
AmbariManagementControlle
 }
   }
   note = cr.getServiceConfigVersionNote();
-  Config config = cluster.getConfig(configType, cr.getVersionTag());
+  Config config = cluster.getConfig(configType, cr.getVersionTag(), 
Optional.ofNullable(cr.getServiceId()));
   if (null != config) {
 configs.add(config);
   }
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CompositeStack.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CompositeStack.java
index 6c5e6ec..fa3d14c 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CompositeStack.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/CompositeStack.java
@@ -243,18 +243,12 @@ public class CompositeStack implements StackDefinition {
 
   @Override
   public Stream getServicesForConfigType(String config) {
-if (ConfigHelper.CLUSTER_ENV.equals(config)) { // for backwards 
compatibility
-  return Stream.empty();
-}
-return stacks.stream()
-  .map(m -> {
-

[ambari] branch branch-feature-AMBARI-14714 updated: [AMBARI 24678] Config group mapping should allow multiple service instances (benyoka)

2018-09-26 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch branch-feature-AMBARI-14714
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-feature-AMBARI-14714 by 
this push:
 new 2e6ddbb  [AMBARI 24678]  Config group mapping should allow multiple 
service instances (benyoka)
2e6ddbb is described below

commit 2e6ddbbc8a9114dd955725ec634c8aec2f8faea4
Author: benyoka 
AuthorDate: Wed Sep 26 19:59:15 2018 +0200

[AMBARI 24678]  Config group mapping should allow multiple service 
instances (benyoka)

* AMBARI-24678 wip (benyoka)

* AMBARI-24678 fix remaining DDLs (benyoka)

* AMBARI-24678 add javadoc (benyoka)

* AMBARI-24678 review comments (benyoka)

* AMBARI-24678 review comments #2 (benyoka)
---
 .../orm/dao/ConfigGroupConfigMappingDAO.java   | 21 +++---
 .../server/orm/entities/ClusterConfigEntity.java   |  6 +-
 .../ambari/server/orm/entities/ClusterEntity.java  |  1 -
 .../entities/ConfigGroupConfigMappingEntity.java   | 61 ++--
 .../entities/ConfigGroupConfigMappingEntityPK.java | 81 --
 .../server/state/configgroup/ConfigGroupImpl.java  |  1 +
 .../src/main/resources/Ambari-DDL-Derby-CREATE.sql | 17 +++--
 .../src/main/resources/Ambari-DDL-MySQL-CREATE.sql | 15 ++--
 .../main/resources/Ambari-DDL-Oracle-CREATE.sql| 13 ++--
 .../main/resources/Ambari-DDL-Postgres-CREATE.sql  | 15 ++--
 .../resources/Ambari-DDL-SQLAnywhere-CREATE.sql| 13 ++--
 .../main/resources/Ambari-DDL-SQLServer-CREATE.sql | 15 ++--
 12 files changed, 132 insertions(+), 127 deletions(-)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ConfigGroupConfigMappingDAO.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ConfigGroupConfigMappingDAO.java
index bfaf82d..1c17ab4 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ConfigGroupConfigMappingDAO.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ConfigGroupConfigMappingDAO.java
@@ -24,7 +24,6 @@ import javax.persistence.TypedQuery;
 
 import org.apache.ambari.server.orm.RequiresSession;
 import org.apache.ambari.server.orm.entities.ConfigGroupConfigMappingEntity;
-import org.apache.ambari.server.orm.entities.ConfigGroupConfigMappingEntityPK;
 
 import com.google.inject.Inject;
 import com.google.inject.Provider;
@@ -38,11 +37,13 @@ public class ConfigGroupConfigMappingDAO {
   @Inject
   DaoUtils daoUtils;
 
+  /**
+   * @param pk the primary key
+   * @return the config group for the given pk
+   */
   @RequiresSession
-  public ConfigGroupConfigMappingEntity findByPK
-(ConfigGroupConfigMappingEntityPK configGroupConfigMappingEntityPK) {
-return 
entityManagerProvider.get().find(ConfigGroupConfigMappingEntity.class,
-  configGroupConfigMappingEntityPK);
+  public ConfigGroupConfigMappingEntity findByPK(Long pk) {
+return 
entityManagerProvider.get().find(ConfigGroupConfigMappingEntity.class, pk);
   }
 
   @RequiresSession
@@ -83,11 +84,13 @@ public class ConfigGroupConfigMappingDAO {
 entityManagerProvider.get().remove(merge(configGroupConfigMappingEntity));
   }
 
+  /**
+   * Removes an entity by its primary key
+   * @param pk the primary key
+   */
   @Transactional
-  public void removeByPK(ConfigGroupConfigMappingEntityPK
-   configGroupConfigMappingEntityPK) {
-entityManagerProvider.get().remove(findByPK
-  (configGroupConfigMappingEntityPK));
+  public void removeByPK(Long pk) {
+entityManagerProvider.get().remove(findByPK(pk));
   }
 
   @Transactional
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterConfigEntity.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterConfigEntity.java
index 13837b7..d3ecf9a 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterConfigEntity.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterConfigEntity.java
@@ -44,8 +44,10 @@ import org.apache.commons.lang.builder.EqualsBuilder;
 
 @Entity
 @Table(name = "clusterconfig",
-  uniqueConstraints = {@UniqueConstraint(name = "UQ_config_type_tag", 
columnNames = {"cluster_id", "type_name", "version_tag"}),
-@UniqueConstraint(name = "UQ_config_type_version", columnNames = 
{"cluster_id", "type_name", "version"})})
+  uniqueConstraints = {
+@UniqueConstraint(name = "UQ_config_type_tag", columnNames = 
{"cluster_id", "service_id", "type_name", "version_tag"}),
+@UniqueConstraint(name = "UQ_config_type_version", columnNames = 
{"cluster_id", "service_id", "type_name", "version"})
+  })
 @TableGenerator(name = "config_i

[ambari] branch trunk updated: AMBARI-25024 Config recommendation for add service request (benyoka) (#2704)

2018-12-13 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
 new f3aa02f  AMBARI-25024 Config recommendation for add service request 
(benyoka) (#2704)
f3aa02f is described below

commit f3aa02f7bb4c765885af9d740c7661dd1cdbca80
Author: benyoka 
AuthorDate: Fri Dec 14 00:59:39 2018 +0100

AMBARI-25024 Config recommendation for add service request (benyoka) (#2704)

* AMBARI-25024 Config recommendation for add service request (benyoka)

* AMBARI-25024 review comments (benyoka)

* AMBARI-25024 fix unit test (benyoka)

* AMBARI-25024 fix unit tests, work without layout recommendation

* AMBARI-25024 fix merge compile issue (benyoka)

* AMBARI-25024 fix NPE (benyoka)
---
 ambari-server/pom.xml  |   2 +-
 .../services/stackadvisor/StackAdvisorRequest.java |  30 ++
 .../recommendations/RecommendationResponse.java|  32 ++
 .../server/controller/AddServiceRequest.java   |   2 +-
 .../internal/BlueprintConfigurationProcessor.java  |   2 +
 .../ambari/server/controller/internal/Stack.java   |  18 +-
 .../server/controller/internal/UnitUpdater.java|  35 +-
 .../ambari/server/state/ValueAttributesInfo.java   |  17 +
 .../topology/ConfigRecommendationStrategy.java |  30 +-
 .../ambari/server/topology/ConfigurableHelper.java |  17 +
 .../ambari/server/topology/Configuration.java  |  16 +-
 .../server/topology/addservice/AddServiceInfo.java |  20 +-
 .../addservice/AddServiceOrchestrator.java |   3 +-
 .../addservice/LayoutRecommendationInfo.java   |  53 +++
 .../topology/addservice/RequestValidator.java  |   6 +-
 .../topology/addservice/StackAdvisorAdapter.java   | 197 --
 .../server/controller/AddServiceRequestTest.java   |   8 +-
 .../controller/internal/UnitUpdaterTest.java   |  61 ++-
 .../server/testutils/TestCollectionUtils.java  |  50 +++
 .../ambari/server/topology/ConfigurableTest.java   |  16 +
 .../ambari/server/topology/ConfigurationTest.java  |  49 +++
 .../topology/addservice/RequestValidatorTest.java  |   4 +-
 .../addservice/StackAdvisorAdapterTest.java| 434 +++--
 23 files changed, 998 insertions(+), 104 deletions(-)

diff --git a/ambari-server/pom.xml b/ambari-server/pom.xml
index 535f6b5..fd8db02 100644
--- a/ambari-server/pom.xml
+++ b/ambari-server/pom.xml
@@ -1323,7 +1323,7 @@
 
   org.apache.commons
   commons-lang3
-  3.1
+  3.8.1
 
 
   commons-net
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 10baa33..5fb137c 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
@@ -18,6 +18,8 @@
 
 package org.apache.ambari.server.api.services.stackadvisor;
 
+import static java.util.stream.Collectors.toMap;
+
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -30,9 +32,12 @@ import java.util.Set;
 import 
org.apache.ambari.server.api.services.stackadvisor.recommendations.RecommendationResponse;
 import org.apache.ambari.server.state.ChangedConfigInfo;
 import org.apache.ambari.server.state.StackId;
+import org.apache.ambari.server.topology.Configuration;
 import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.tuple.Pair;
 
 import com.google.common.base.Preconditions;
+import com.google.common.collect.ImmutableMap;
 
 /**
  * Stack advisor request.
@@ -151,6 +156,22 @@ public class StackAdvisorRequest {
 this.stackVersion = stackVersion;
   }
 
+  public StackAdvisorRequestBuilder builder() {
+return StackAdvisorRequestBuilder.forStack(stackName, stackVersion)
+  .ofType(requestType)
+  .forHosts(hosts)
+  .forServices(services)
+  .forHostComponents(hostComponents)
+  .forHostsGroupBindings(hostGroupBindings)
+  .withComponentHostsMap(componentHostsMap)
+  .withConfigurations(configurations)
+  .withChangedConfigurations(changedConfigurations)
+  .withConfigGroups(configGroups)
+  .withUserContext(userContext)
+  .withGPLLicenseAccepted(gplLicenseAccepted)
+  .withLdapConfig(ldapConfig);
+  }
+
   public static class StackAdvisorRequestBuilder {
 StackAdvisorRequest instance;
 
@@ -204,6 +225,15 @@ public class StackAdvisorRequest {
   return this;
 }
 
+public StackAdvisorRequestBuilder withConfigurations(Configuration 
configuration) {
+  Map> properties = 
configuration.getFullProperties();
+  this.instance.configurations = properties.entry

[ambari] branch trunk updated: AMBARI-24964 stack advisor layout recommendation for add service request (benyoka) (#2662)

2018-11-29 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
 new 799e487  AMBARI-24964 stack advisor layout recommendation for add 
service request (benyoka) (#2662)
799e487 is described below

commit 799e487c960a567bd541322f5d544e3548eab0c9
Author: benyoka 
AuthorDate: Thu Nov 29 13:18:41 2018 +0100

AMBARI-24964 stack advisor layout recommendation for add service request 
(benyoka) (#2662)

* AMBARI-24964 stack advisor layout recommendation for add service request 
(benyoka)

* AMBARI-24964 fix review comments (benyoka)

* AMBARI-24964 fix checkstyle (benyoka)
---
 .../services/stackadvisor/StackAdvisorRequest.java |   5 +
 .../recommendations/RecommendationResponse.java|  61 +
 .../validations/ValidationResponse.java|  15 ++
 .../ambari/server/configuration/Configuration.java |  19 ++
 .../server/controller/AddServiceRequest.java   |   8 +
 .../ambari/server/controller/internal/Stack.java   |   7 +-
 .../server/topology/addservice/AddServiceInfo.java |   4 +
 .../addservice/AddServiceOrchestrator.java |  35 ++-
 .../topology/addservice/AutoHostgroupStrategy.java |  49 
 .../addservice/GroupByComponentsStrategy.java  |  50 
 .../addservice/HostGroupForEachHostStrategy.java   |  34 +++
 .../topology/addservice/HostGroupStrategy.java |  29 +++
 .../topology/addservice/StackAdvisorAdapter.java   | 213 
 .../RecommendationResponseTest.java| 103 
 .../BlueprintConfigurationProcessorTest.java   |   4 +-
 .../topology/addservice/HostGroupStrategyTest.java |  79 ++
 .../addservice/StackAdvisorAdapterTest.java| 275 +
 17 files changed, 974 insertions(+), 16 deletions(-)

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 98c75f4..10baa33 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
@@ -29,6 +29,7 @@ import java.util.Set;
 
 import 
org.apache.ambari.server.api.services.stackadvisor.recommendations.RecommendationResponse;
 import org.apache.ambari.server.state.ChangedConfigInfo;
+import org.apache.ambari.server.state.StackId;
 import org.apache.commons.lang.StringUtils;
 
 import com.google.common.base.Preconditions;
@@ -157,6 +158,10 @@ public class StackAdvisorRequest {
   this.instance = new StackAdvisorRequest(stackName, stackVersion);
 }
 
+public static StackAdvisorRequestBuilder forStack(StackId stackId) {
+  return forStack(stackId.getStackName(), stackId.getStackVersion());
+}
+
 public static StackAdvisorRequestBuilder forStack(String stackName, String 
stackVersion) {
   return new StackAdvisorRequestBuilder(stackName, stackVersion);
 }
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/recommendations/RecommendationResponse.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/recommendations/RecommendationResponse.java
index d0d8601..99e9ab2 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/recommendations/RecommendationResponse.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/recommendations/RecommendationResponse.java
@@ -18,6 +18,11 @@
 
 package org.apache.ambari.server.api.services.stackadvisor.recommendations;
 
+import static java.util.stream.Collectors.groupingBy;
+import static java.util.stream.Collectors.mapping;
+import static java.util.stream.Collectors.toMap;
+import static java.util.stream.Collectors.toSet;
+
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -26,9 +31,13 @@ import java.util.Set;
 
 import org.apache.ambari.server.api.services.stackadvisor.StackAdvisorResponse;
 import org.apache.ambari.server.state.ValueAttributesInfo;
+import org.apache.commons.lang3.tuple.Pair;
+import org.codehaus.jackson.annotate.JsonIgnore;
 import org.codehaus.jackson.annotate.JsonProperty;
 import org.codehaus.jackson.map.annotate.JsonSerialize;
 
+import com.google.common.collect.ImmutableMap;
+
 /**
  * Recommendation response POJO.
  */
@@ -125,6 +134,12 @@ public class RecommendationResponse extends 
StackAdvisorResponse {
 public void setHostGroups(Set hostGroups) {
   this.hostGroups = hostGroups;
 }
+
+public Map> getHostgroupComponentMap() {
+  return hostGroups.stream()
+.flatMap(hg -> hg.getComponentNames().stream().map(comp -> 
Pair.of(hg.getNam

[ambari] branch trunk updated: [AMBARI-24938] quick link profiles can override link url (benyoka) (#2646)

2018-11-22 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
 new 8079522  [AMBARI-24938] quick link profiles can override link url 
(benyoka) (#2646)
8079522 is described below

commit 8079522317ed9e1f37b913946b97f239ae965ab7
Author: benyoka 
AuthorDate: Thu Nov 22 12:21:01 2018 +0100

[AMBARI-24938] quick link profiles can override link url (benyoka) (#2646)

* AMBARI-24938 quick link profiles can override link url (benyoka)

* AMBARI-24938 new unit test in QuickLinkArtifactResourceProviderTest 
(benyoka)

* AMBARI-24938 review findings + check style issue + unit test fix (benyoka)
---
 .../QuickLinkArtifactResourceProvider.java |   5 +-
 .../state/quicklinksprofile/AcceptAllFilter.java   |   1 +
 .../server/state/quicklinksprofile/Component.java  |  13 +-
 .../DefaultQuickLinkVisibilityController.java  | 181 -
 .../server/state/quicklinksprofile/Filter.java |  11 +-
 ...ibilityController.java => FilterEvaluator.java} | 115 +
 .../quicklinksprofile/LinkAttributeFilter.java |  11 +-
 .../state/quicklinksprofile/LinkNameFilter.java|  49 +-
 .../QuickLinkVisibilityController.java |   9 +
 .../state/quicklinksprofile/QuickLinksProfile.java |  14 +-
 .../QuickLinksProfileBuilder.java  |  10 +-
 .../quicklinksprofile/QuickLinksProfileParser.java |  39 ++---
 .../server/state/quicklinksprofile/Service.java|  15 +-
 .../ShowAllLinksVisibilityController.java  |   6 +
 .../StreamUtils.java}  |  26 +--
 .../internal/ProvisionClusterRequestTest.java  |   6 +-
 .../QuickLinkArtifactResourceProviderTest.java |  35 ++--
 .../quicklinksprofile/FilterEvaluatorTest.java |  10 +-
 .../QuickLinkVisibilityControllerTest.java |  83 +-
 .../QuickLinksProfileBuilderTest.java  |  28 +++-
 .../QuickLinksProfileParserTest.java   |  17 +-
 .../test/resources/example_quicklinks_profile.json |   2 +
 .../inconsistent_quicklinks_profile_4.json |  10 ++
 23 files changed, 375 insertions(+), 321 deletions(-)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/QuickLinkArtifactResourceProvider.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/QuickLinkArtifactResourceProvider.java
index 2d9a256..b381023 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/QuickLinkArtifactResourceProvider.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/QuickLinkArtifactResourceProvider.java
@@ -179,7 +179,7 @@ public class QuickLinkArtifactResourceProvider extends 
AbstractControllerResourc
   }
 }
 
-setVisibility(serviceInfo.getName(), serviceQuickLinks);
+setVisibilityAndOverrides(serviceInfo.getName(), serviceQuickLinks);
 
 List serviceResources = new ArrayList<>();
 for (QuickLinksConfigurationInfo quickLinksConfigurationInfo : 
serviceQuickLinks) {
@@ -206,13 +206,14 @@ public class QuickLinkArtifactResourceProvider extends 
AbstractControllerResourc
* @param serviceName the name of the service
* @param serviceQuickLinks the links
*/
-  private void setVisibility(String serviceName, 
List serviceQuickLinks) {
+  private void setVisibilityAndOverrides(String serviceName, 
List serviceQuickLinks) {
 QuickLinkVisibilityController visibilityController = 
getManagementController().getQuicklinkVisibilityController();
 
 for(QuickLinksConfigurationInfo configurationInfo: serviceQuickLinks) {
   for (QuickLinks links: 
configurationInfo.getQuickLinksConfigurationMap().values()) {
 for(Link link: links.getQuickLinksConfiguration().getLinks()) {
   link.setVisible(visibilityController.isVisible(serviceName, link));
+  visibilityController.getUrlOverride(serviceName, 
link).ifPresent(link::setUrl);
 }
   }
 }
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/AcceptAllFilter.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/AcceptAllFilter.java
index 069ae3f..01500bf 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/AcceptAllFilter.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/AcceptAllFilter.java
@@ -48,4 +48,5 @@ public class AcceptAllFilter extends Filter {
   public String toString() {
 return getClass().getSimpleName() + " (visible=" + isVisible() + ")";
   }
+
 }
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/Component.java
 
b/ambari-server/src/main/java/org/apache/ambari/s

[ambari] branch trunk updated: AMBARI-24919 external Namenode HA (benyoka) (#2625)

2018-11-19 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
 new 93576b7  AMBARI-24919 external Namenode HA (benyoka) (#2625)
93576b7 is described below

commit 93576b7c9bc25361ba1e43c9dfb08fc136667520
Author: benyoka 
AuthorDate: Mon Nov 19 16:50:28 2018 +0100

AMBARI-24919 external Namenode HA (benyoka) (#2625)
---
 .../internal/BlueprintConfigurationProcessor.java  |  26 ++-
 .../ambari/server/topology/ClusterTopology.java|   5 +
 .../server/topology/ClusterTopologyImpl.java   |  27 +--
 .../topology/validators/NameNodeHaValidator.java   | 128 ++
 .../validators/TopologyValidatorFactory.java   |   9 +-
 .../BlueprintConfigurationProcessorTest.java   | 257 +
 .../server/topology/ClusterTopologyImplTest.java   |  55 +
 .../validators/NameNodeHaValidatorTest.java| 219 ++
 8 files changed, 649 insertions(+), 77 deletions(-)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
index 1daf1f5..46d7e9b 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
@@ -57,6 +57,8 @@ import 
org.apache.ambari.server.topology.ConfigRecommendationStrategy;
 import org.apache.ambari.server.topology.Configuration;
 import org.apache.ambari.server.topology.HostGroup;
 import org.apache.ambari.server.topology.HostGroupInfo;
+import org.apache.ambari.server.topology.InvalidTopologyException;
+import org.apache.ambari.server.topology.validators.NameNodeHaValidator;
 import org.apache.ambari.server.topology.validators.UnitValidatedProperty;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang3.tuple.Pair;
@@ -480,6 +482,23 @@ public class BlueprintConfigurationProcessor {
   private void doNameNodeHAUpdateOnClusterCreation(Configuration clusterConfig,
Map> clusterProps,
Set 
configTypesUpdated) throws ConfigurationTopologyException {
+
+final Collection nnHosts = 
clusterTopology.getHostAssignmentsForComponent("NAMENODE");
+
+// external namenodes
+if (nnHosts.isEmpty()) {
+  LOG.info("NAMENODE HA is enabled but there are no NAMENODE components in 
the cluster. Assuming external name nodes.");
+  // need to redo validation here as required information (explicit 
hostnames for some host groups) may have been
+  // missing by the time the ClusterTopology object was validated
+  try {
+new NameNodeHaValidator().validateExternalNamenodeHa(clusterTopology);
+  }
+  catch (InvalidTopologyException ex) {
+throw new ConfigurationTopologyException(ex.getMessage(), ex);
+  }
+  return;
+}
+
 // add "dfs.internal.nameservices" if it's not specified
 Map hdfsSiteConfig = 
clusterConfig.getFullProperties().get("hdfs-site");
 String nameservices = hdfsSiteConfig.get("dfs.nameservices");
@@ -496,10 +515,9 @@ public class BlueprintConfigurationProcessor {
   LOG.info("Processing a single HDFS NameService, which indicates a 
default HDFS NameNode HA deployment");
   // if the active/standby namenodes are not specified, assign them 
automatically
   if (! isNameNodeHAInitialActiveNodeSet(clusterProps) && ! 
isNameNodeHAInitialStandbyNodeSet(clusterProps)) {
-Collection nnHosts = 
clusterTopology.getHostAssignmentsForComponent("NAMENODE");
-if (nnHosts.size() < 2) {
-  throw new ConfigurationTopologyException("NAMENODE HA requires at 
least 2 hosts running NAMENODE but there are: " +
-nnHosts.size() + " Hosts: " + nnHosts);
+if (nnHosts.size() == 1) { // can't be 0 as in that case was handled 
above
+  throw new ConfigurationTopologyException("NAMENODE HA requires at 
least two hosts running NAMENODE but there is " +
+"only one: " + nnHosts.iterator().next());
 }
 
 // set the properties that configure which namenode is active,
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterTopology.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterTopology.java
index e1cab2b..4d8bba3 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterTopology.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/ClusterTopology.java

[ambari] branch branch-feature-AMBARI-14714 updated: [AMBARI-24464] Integrate Blueprints with the new MPackAdvisor API for Configuration Recommendations (#2259)

2018-09-14 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch branch-feature-AMBARI-14714
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-feature-AMBARI-14714 by 
this push:
 new 1edb62b  [AMBARI-24464] Integrate Blueprints with the new MPackAdvisor 
API for Configuration Recommendations (#2259)
1edb62b is described below

commit 1edb62ba06373f13895d7ba7db0a0d953daa0979
Author: benyoka 
AuthorDate: Fri Sep 14 13:01:35 2018 +0200

[AMBARI-24464] Integrate Blueprints with the new MPackAdvisor API for 
Configuration Recommendations (#2259)

* AMBARI-24464 blueprint mpack advisor WIP (benyoka)

* AMBARI-24464 blueprint mpack advisor WIP #2 (benyoka)

* AMBARI-24464 copy config to service instances

* AMBARI-24464 copy config to service instances reverted (benyoka)

* AMBARI-24464 fix review comments + unit test (benyoka)

* AMBARI-24464 fix some more review comments (benyoka)

* AMBARI-24464 fix some more review comments #2 (benyoka)

* AMBARI-24464 fix some more review comments #3 (benyoka)

* AMBARI-24464 fix failing unit tests (benyoka)

* AMBARI-24464 fix failing unit tests #2 (benyoka)
---
 .../api/services/AdvisorBlueprintProcessor.java|  50 +++
 .../MpackAdvisorBlueprintProcessor.java| 298 +
 .../services/mpackadvisor/MpackAdvisorRequest.java |  23 +-
 .../services/mpackadvisor/MpackAdvisorRunner.java  |   2 +-
 .../mpackadvisor/commands/MpackAdvisorCommand.java |  77 ++--
 .../MpackRecommendationResponse.java   |  13 +
 .../StackAdvisorBlueprintProcessor.java|  18 +-
 .../ambari/server/configuration/Configuration.java |  15 +-
 .../ambari/server/controller/AmbariServer.java |   2 +
 .../ambari/server/controller/ControllerModule.java |   6 +
 .../internal/ConfigurationResourceProvider.java|   3 +
 .../internal/MpackAdvisorResourceProvider.java |  36 +-
 .../internal/ProvisionClusterRequest.java  |   2 +
 .../topology/ClusterConfigurationRequest.java  |  14 +-
 .../ambari/server/topology/ClusterTopology.java|   4 +
 .../server/topology/ClusterTopologyImpl.java   |  92 ++--
 .../ambari/server/topology/MpackInstance.java  |  22 +
 .../ambari/server/topology/ServiceInstance.java|   7 +
 .../ambari/server/topology/TopologyManager.java|   8 +-
 .../apache/ambari/server/utils/ExceptionUtils.java |  84 
 .../MpackAdvisorBlueprintProcessorTest.java| 485 +
 .../commands/MpackAdvisorCommandTest.java  |   5 +-
 .../internal/ProvisionClusterRequestTest.java  |  12 +
 23 files changed, 1138 insertions(+), 140 deletions(-)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AdvisorBlueprintProcessor.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AdvisorBlueprintProcessor.java
new file mode 100644
index 000..52f9ecf
--- /dev/null
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AdvisorBlueprintProcessor.java
@@ -0,0 +1,50 @@
+/*
+ * 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.api.services;
+
+import java.util.Map;
+
+import 
org.apache.ambari.server.api.services.mpackadvisor.MpackAdvisorBlueprintProcessor;
+import 
org.apache.ambari.server.controller.internal.ConfigurationTopologyException;
+import org.apache.ambari.server.topology.ClusterTopology;
+
+import com.google.inject.ImplementedBy;
+
+/**
+ * Common interface for topology/configuration recommendation engines. 
Currently there is a legacy implementation for
+ * stack advisor and a new implementation for mpack advisor.
+ * See:
+ * {@link 
org.apache.ambari.server.api.services.stackadvisor.StackAdvisorBlueprintProcessor}
+ * {@link 
org.apache.ambari.server.api.services.mpackadvisor.MpackAdvisorBlueprintProcessor}
+ * 
+ */
+@ImplementedBy(MpackAdvisorBlueprintProcessor.class)
+public interface AdvisorBlueprintProcessor {
+
+  String RECOMMENDATION_FAILED = "Configuration recommendation failed.";
+  String INV

[ambari] branch branch-2.7 updated: [AMBARI-25187] Kerberos operations are shown in service action dropdown when not needed (#2909)

2019-04-04 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-2.7 by this push:
 new 4046ebd  [AMBARI-25187] Kerberos operations are shown in service 
action dropdown when not needed (#2909)
4046ebd is described below

commit 4046ebd93f7a7a1adedfbe5d568769cc38421629
Author: payert <35402259+pay...@users.noreply.github.com>
AuthorDate: Thu Apr 4 17:33:11 2019 +0200

[AMBARI-25187] Kerberos operations are shown in service action dropdown 
when not needed (#2909)

* [AMBARI-25187] Fixed Kerberos page template to disable kerberos related 
buttons when Ambari is not managing Kerberos identities.

Kerberos page template is fixed to properly reach isManualKerberos and 
isKerberosButtonsDisabled variables.

Change-Id: I9084f56a1397a080494a5ba34cddd77d2cf59f3a

* Remove "Regenerate Keytabs" menu items from "ACTIONS" dropdown menu when 
Kerberos is not managed by Ambari

Change-Id: Iff78afbfbe8d49587e4ffa780054887d1e49b2c6

* Fix reaching "isManualKerberos" variable

The "isManualKerberos" variable in "host_components.js" is not reachable
via App.get.

Change-Id: I74ad043fbdf5147ec3000778a7caa68051cd1655
---
 ambari-web/app/models/host_component.js  | 2 +-
 ambari-web/app/templates/main/admin/kerberos.hbs | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/ambari-web/app/models/host_component.js 
b/ambari-web/app/models/host_component.js
index 55122b7..1c5a933 100644
--- a/ambari-web/app/models/host_component.js
+++ b/ambari-web/app/models/host_component.js
@@ -372,7 +372,7 @@ App.HostComponentActionMap = {
 action: 'regenerateKeytabFileOperations',
 label: Em.I18n.t('admin.kerberos.button.regenerateKeytabs'),
 cssClass: 'glyphicon glyphicon-repeat',
-isHidden: !App.get('isKerberosEnabled')
+isHidden: !App.get('isKerberosEnabled') || 
Em.computed.bool('App.router.mainAdminKerberosController.isManualKerberos')
   },
   REFRESHQUEUES: {
 action: 'refreshYarnQueues',
diff --git a/ambari-web/app/templates/main/admin/kerberos.hbs 
b/ambari-web/app/templates/main/admin/kerberos.hbs
index e74a90c..1552c63 100644
--- a/ambari-web/app/templates/main/admin/kerberos.hbs
+++ b/ambari-web/app/templates/main/admin/kerberos.hbs
@@ -21,10 +21,10 @@
   {{t admin.security.enabled}}
   {{#isAuthorized "CLUSTER.TOGGLE_KERBEROS"}}
 {{#if App.supports.enableToggleKerberos}}
-  {{t 
admin.kerberos.button.disable}} 
-  {{#unless isManualKerberos}}
+  {{t 
admin.kerberos.button.disable}} 
+  {{#unless controller.isManualKerberos}}
 
+id="regenerate-keytabs" {{bindAttr 
disabled="controller.isKerberosButtonsDisabled"}} {{action regenerateKeytabs 
target="controller"}}>
{{t 
admin.kerberos.button.regenerateKeytabs}}
 {{#if App.isCredentialStorePersistent}}
   {{t 
admin.kerberos.credentials.store.menu.label}}



[ambari] branch branch-2.7 updated: Ambari 25203 branch 2.7 (#2896)

2019-03-28 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-2.7 by this push:
 new 7d6fff6  Ambari 25203 branch 2.7 (#2896)
7d6fff6 is described below

commit 7d6fff666acab7b6938e5970d98f47cb4c12d790
Author: benyoka 
AuthorDate: Thu Mar 28 13:56:27 2019 +0100

Ambari 25203 branch 2.7 (#2896)

* WIP commit (benyoka)

* AMBARI-25203 finish draft (benyoka)

* AMBARI-25203 bump bouncycastle libs to 1.61 (benyoka)

* AMBARI-25203 reset accidentally added file (benyoka)
---
 ambari-infra/ambari-infra-manager-it/pom.xml   |  8 ++
 ambari-infra/ambari-infra-manager/pom.xml  | 21 ++-
 ambari-infra/ambari-infra-solr-client/pom.xml  | 16 
 ambari-infra/ambari-infra-solr-plugin/pom.xml  | 10 
 ambari-infra/pom.xml   |  6 ++---
 .../pom.xml|  4 +--
 ambari-logsearch/ambari-logsearch-server/pom.xml   |  4 +--
 ambari-logsearch/pom.xml   |  6 ++---
 .../ambari-metrics-timelineservice/pom.xml | 30 ++
 ambari-metrics/pom.xml |  2 +-
 ambari-project/pom.xml |  2 +-
 ambari-server/pom.xml  |  6 +
 12 files changed, 102 insertions(+), 13 deletions(-)

diff --git a/ambari-infra/ambari-infra-manager-it/pom.xml 
b/ambari-infra/ambari-infra-manager-it/pom.xml
index 6a8352f..ef7398d 100644
--- a/ambari-infra/ambari-infra-manager-it/pom.xml
+++ b/ambari-infra/ambari-infra-manager-it/pom.xml
@@ -150,6 +150,10 @@
   org.eclipse.jetty
   jetty-security
 
+
+  com.fasterxml.jackson.core
+  jackson-databind
+
   
 
 
@@ -157,6 +161,10 @@
   hadoop-hdfs-client
   ${hadoop.version}
 
+
+  com.fasterxml.jackson.core
+  jackson-databind
+
   
 
   
diff --git a/ambari-infra/ambari-infra-manager/pom.xml 
b/ambari-infra/ambari-infra-manager/pom.xml
index 163a9c1..31f64bc 100644
--- a/ambari-infra/ambari-infra-manager/pom.xml
+++ b/ambari-infra/ambari-infra-manager/pom.xml
@@ -195,6 +195,12 @@
   org.springframework.boot
   spring-boot-starter-web
   ${spring-boot.version}
+  
+
+  com.fasterxml.jackson.core
+  jackson-databind
+
+  
 
 
   org.springframework.boot
@@ -232,11 +238,15 @@
   ${spring-boot.version}
 
 
+  com.fasterxml.jackson.core
+  jackson-databind
+
+
   org.glassfish.jersey.media
   jersey-media-json-jettison
   ${jersey.version}
 
-
+
 
   org.apache.solr
   solr-solrj
@@ -317,6 +327,10 @@
   org.eclipse.jetty
   jetty-security
 
+
+  org.bouncycastle
+  bcprov-jdk15on
+
   
 
 
@@ -331,6 +345,11 @@
   
 
 
+  org.bouncycastle
+  bcprov-jdk15on
+  1.61
+
+
   commons-io
   commons-io
   2.4
diff --git a/ambari-infra/ambari-infra-solr-client/pom.xml 
b/ambari-infra/ambari-infra-solr-client/pom.xml
index 1bcd6a9..146003d 100644
--- a/ambari-infra/ambari-infra-solr-client/pom.xml
+++ b/ambari-infra/ambari-infra-solr-client/pom.xml
@@ -42,6 +42,12 @@
   org.apache.solr
   solr-solrj
   ${solr.version}
+  
+
+  com.fasterxml.jackson.core
+  jackson-databind
+
+  
 
 
   org.apache.lucene
@@ -116,6 +122,16 @@
   com.amazonaws
   aws-java-sdk-s3
   1.11.5
+  
+
+  com.fasterxml.jackson.core
+  jackson-databind
+
+  
+
+
+  com.fasterxml.jackson.core
+  jackson-databind
 
 
   junit
diff --git a/ambari-infra/ambari-infra-solr-plugin/pom.xml 
b/ambari-infra/ambari-infra-solr-plugin/pom.xml
index 750124c..fbb1fc2 100644
--- a/ambari-infra/ambari-infra-solr-plugin/pom.xml
+++ b/ambari-infra/ambari-infra-solr-plugin/pom.xml
@@ -32,6 +32,16 @@
   org.apache.solr
   solr-core
   ${solr.version}
+  
+
+  com.fasterxml.jackson.core
+  jackson-databind
+
+  
+
+
+  com.fasterxml.jackson.core
+  jackson-databind
 
 
   org.apache.ambari
diff --git a/ambari-infra/pom.xml b/ambari-infra/pom.xml
index 5f3ac03..fa84c18 100644
--- a/ambari-infra/pom.xml
+++ b/ambari-infra/pom.xml
@@ -342,17 +342,17 @@
   
 com.fasterxml.jackson.core
 jackson-databind
-2.9.4
+2.9.8
   
   
 com.fasterxml.jackson.core
 jackson-annotations
-2.9.4
+2.9.8
   
   
 com.fasterxml.jackson.dataformat
 jackson-dataformat-xml
-2.9.4
+2.9.8

[ambari] branch branch-2.7 updated: [AMBARI-24938] quick link profiles can override link url (benyoka) (#2646) (#2829)

2019-02-22 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-2.7 by this push:
 new a86334b  [AMBARI-24938] quick link profiles can override link url 
(benyoka) (#2646) (#2829)
a86334b is described below

commit a86334b7047672ec83582e4738bd352d88822f79
Author: benyoka 
AuthorDate: Fri Feb 22 11:19:53 2019 +0100

[AMBARI-24938] quick link profiles can override link url (benyoka) (#2646) 
(#2829)

* AMBARI-24938 quick link profiles can override link url (benyoka)

* AMBARI-24938 new unit test in QuickLinkArtifactResourceProviderTest 
(benyoka)

* AMBARI-24938 review findings + check style issue + unit test fix (benyoka)
---
 .../QuickLinkArtifactResourceProvider.java |   5 +-
 .../state/quicklinksprofile/AcceptAllFilter.java   |   1 +
 .../server/state/quicklinksprofile/Component.java  |  13 +-
 .../DefaultQuickLinkVisibilityController.java  | 181 -
 .../server/state/quicklinksprofile/Filter.java |  11 +-
 ...ibilityController.java => FilterEvaluator.java} | 115 +
 .../quicklinksprofile/LinkAttributeFilter.java |  11 +-
 .../state/quicklinksprofile/LinkNameFilter.java|  49 +-
 .../QuickLinkVisibilityController.java |   9 +
 .../state/quicklinksprofile/QuickLinksProfile.java |  14 +-
 .../QuickLinksProfileBuilder.java  |  10 +-
 .../quicklinksprofile/QuickLinksProfileParser.java |  39 ++---
 .../server/state/quicklinksprofile/Service.java|  15 +-
 .../ShowAllLinksVisibilityController.java  |   6 +
 .../StreamUtils.java}  |  26 +--
 .../internal/ProvisionClusterRequestTest.java  |   6 +-
 .../QuickLinkArtifactResourceProviderTest.java |  35 ++--
 .../quicklinksprofile/FilterEvaluatorTest.java |  10 +-
 .../QuickLinkVisibilityControllerTest.java |  83 +-
 .../QuickLinksProfileBuilderTest.java  |  28 +++-
 .../QuickLinksProfileParserTest.java   |  17 +-
 .../test/resources/example_quicklinks_profile.json |   2 +
 .../inconsistent_quicklinks_profile_4.json |  10 ++
 23 files changed, 375 insertions(+), 321 deletions(-)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/QuickLinkArtifactResourceProvider.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/QuickLinkArtifactResourceProvider.java
index 534c369..6553db3 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/QuickLinkArtifactResourceProvider.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/QuickLinkArtifactResourceProvider.java
@@ -181,7 +181,7 @@ public class QuickLinkArtifactResourceProvider extends 
AbstractControllerResourc
   }
 }
 
-setVisibility(serviceInfo.getName(), serviceQuickLinks);
+setVisibilityAndOverrides(serviceInfo.getName(), serviceQuickLinks);
 
 List serviceResources = new ArrayList<>();
 for (QuickLinksConfigurationInfo quickLinksConfigurationInfo : 
serviceQuickLinks) {
@@ -208,13 +208,14 @@ public class QuickLinkArtifactResourceProvider extends 
AbstractControllerResourc
* @param serviceName the name of the service
* @param serviceQuickLinks the links
*/
-  private void setVisibility(String serviceName, 
List serviceQuickLinks) {
+  private void setVisibilityAndOverrides(String serviceName, 
List serviceQuickLinks) {
 QuickLinkVisibilityController visibilityController = 
getManagementController().getQuicklinkVisibilityController();
 
 for(QuickLinksConfigurationInfo configurationInfo: serviceQuickLinks) {
   for (QuickLinks links: 
configurationInfo.getQuickLinksConfigurationMap().values()) {
 for(Link link: links.getQuickLinksConfiguration().getLinks()) {
   link.setVisible(visibilityController.isVisible(serviceName, link));
+  visibilityController.getUrlOverride(serviceName, 
link).ifPresent(link::setUrl);
 }
   }
 }
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/AcceptAllFilter.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/AcceptAllFilter.java
index 069ae3f..01500bf 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/AcceptAllFilter.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/AcceptAllFilter.java
@@ -48,4 +48,5 @@ public class AcceptAllFilter extends Filter {
   public String toString() {
 return getClass().getSimpleName() + " (visible=" + isVisible() + ")";
   }
+
 }
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/Component.java
 
b/ambari-server/src/main/

[ambari] branch branch-2.7 updated: [AMBARI-25186] Kerberos Client is unnecessarily installed via Blueprints when kerberos-env/kdc-type is none (payert) (#2866)

2019-03-20 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-2.7 by this push:
 new 97c84a7  [AMBARI-25186] Kerberos Client is unnecessarily installed via 
Blueprints when kerberos-env/kdc-type is none (payert) (#2866)
97c84a7 is described below

commit 97c84a7205c23a5efd17c2f0cab4e223d832b6c3
Author: payert <35402259+pay...@users.noreply.github.com>
AuthorDate: Wed Mar 20 18:18:22 2019 +0100

[AMBARI-25186] Kerberos Client is unnecessarily installed via Blueprints 
when kerberos-env/kdc-type is none (payert) (#2866)

* AMBARI-25186 add Kerberos client only if kdc_type is not none (payert)

Change-Id: I3921f9dabeec26878c3c63a916234a188d37e322

* AMBARI-25186 Refactor to extract isKerberosClientInstallAllowed() common 
method.

Change-Id: Ifebac4341160a24a375e915dc604abff650eccf8

* AMBARI-25186 fix import related checkstyle errors

Change-Id: Id5e1018cf4ea57b61432b91f6d36ce2694cd0375

* AMBARI-25186 fix imports

Change-Id: I05579f5ac8afa4fb1959724fe4d5f4e9c95ab54f

* AMBARI-25186 unit tests added

Change-Id: I07a3bde016e3c0c435ba98fe89185f8593032de0

* AMBARI-25186 constant is used for "none" kdc_type value

Change-Id: I03a2c432b1fa77b421350e9e2ad2b98fd0a0945c
---
 .../ambari/server/topology/TopologyManager.java| 28 ++--
 .../server/topology/TopologyManagerTest.java   | 84 --
 2 files changed, 103 insertions(+), 9 deletions(-)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java
index 7ca1c1d..ca6c902 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java
@@ -43,6 +43,7 @@ import org.apache.ambari.server.actionmanager.HostRoleStatus;
 import 
org.apache.ambari.server.api.services.stackadvisor.StackAdvisorBlueprintProcessor;
 import org.apache.ambari.server.configuration.Configuration;
 import org.apache.ambari.server.controller.AmbariServer;
+import org.apache.ambari.server.controller.KerberosHelper;
 import org.apache.ambari.server.controller.RequestStatusResponse;
 import org.apache.ambari.server.controller.internal.ArtifactResourceProvider;
 import org.apache.ambari.server.controller.internal.BaseClusterRequest;
@@ -71,6 +72,7 @@ import org.apache.ambari.server.orm.dao.SettingDAO;
 import org.apache.ambari.server.orm.entities.SettingEntity;
 import org.apache.ambari.server.orm.entities.StageEntity;
 import org.apache.ambari.server.security.authorization.AuthorizationHelper;
+import org.apache.ambari.server.serveraction.kerberos.KDCType;
 import org.apache.ambari.server.state.Host;
 import org.apache.ambari.server.state.SecurityType;
 import org.apache.ambari.server.state.host.HostImpl;
@@ -205,13 +207,12 @@ public class TopologyManager {
   replayRequests(persistedState.getAllRequests());
   // ensure KERBEROS_CLIENT is present in each hostgroup even if it's 
not in original BP
   for(ClusterTopology clusterTopology : clusterTopologyMap.values()) {
-if (clusterTopology.isClusterKerberosEnabled()) {
-  addKerberosClient(clusterTopology);
+if (clusterTopology.isClusterKerberosEnabled() && 
isKerberosClientInstallAllowed(clusterTopology)) {
+addKerberosClient(clusterTopology);
 }
   }
   isInitialized = true;
 }
-
   }
 }
   }
@@ -292,7 +293,10 @@ public class TopologyManager {
 
 if (securityConfiguration != null && securityConfiguration.getType() == 
SecurityType.KERBEROS) {
   securityType = SecurityType.KERBEROS;
-  addKerberosClient(topology);
+
+  if (isKerberosClientInstallAllowed(topology)) {
+addKerberosClient(topology);
+  }
 
   // refresh default stack config after adding KERBEROS_CLIENT component 
to topology
   
topology.getBlueprint().getConfiguration().setParentConfiguration(stack.getConfiguration(topology.getBlueprint().getServices()));
@@ -356,6 +360,22 @@ public class TopologyManager {
 return getRequestStatus(logicalRequest.getRequestId());
   }
 
+  /**
+   * The Kerberos Client component is unnecessarily installed via Blueprints 
when kerberos-env/kdc-type is "none".
+   * The Blueprint TopologyManager should only force the Kerberos client to be 
installed if Kerberos is enabled
+   * and kerberos_env/kdc_type is not "none" or when 
kerberos_env/manage_identities is true.
+   *
+   * @param topology the Cluster Topology which provides the topology's 
Configuration object.
+   * @return true if kerbe

[ambari] branch branch-2.7 updated: AMBARI-25151 SystemD support for ambari-agent on SLES12 (benyoka) (#2819)

2019-02-20 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-2.7 by this push:
 new f0153c5  AMBARI-25151 SystemD support for ambari-agent on SLES12 
(benyoka) (#2819)
f0153c5 is described below

commit f0153c5c90f47d1df2f816b8f8e195880e931bae
Author: benyoka 
AuthorDate: Wed Feb 20 10:00:04 2019 +0100

AMBARI-25151 SystemD support for ambari-agent on SLES12 (benyoka) (#2819)

* AMBARI-25151 SystemD support for ambari-agent on SLES12 (benyoka)

* AMBARI-25151 fix service unit file (benyoka)

* AMBARI-25151 fix service unit file (benyoka)

* AMBARI-25151 review comment (benyoka)

* AMBARI-25151 remove runlevel 2 and 4 (benyoka)

* AMBARI-25151 add pidfile, disable RemainAfterExit (benyoka)
---
 ambari-agent/conf/unix/ambari-agent.service | 39 +
 ambari-agent/pom.xml| 31 +--
 ambari-agent/src/packages/tarball/all.xml   |  5 
 3 files changed, 73 insertions(+), 2 deletions(-)

diff --git a/ambari-agent/conf/unix/ambari-agent.service 
b/ambari-agent/conf/unix/ambari-agent.service
new file mode 100644
index 000..adc22de
--- /dev/null
+++ b/ambari-agent/conf/unix/ambari-agent.service
@@ -0,0 +1,39 @@
+# 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
+
+# This service unit file is tuned for SLES 12.x. It is not suitable for RHEL 
like distributions due to different
+# paths for ExecStart/ExecStop.
+
+[Unit]
+Description=Ambari Agent Service for SLES
+Before=runlevel3.target
+Before=runlevel5.target
+Before=shutdown.target
+After=remote-fs.target
+After=network-online.target
+Wants=network-online.target
+Conflicts=shutdown.target
+
+[Service]
+Type=forking
+PIDFile=/run/ambari-agent/ambari-agent.pid
+Restart=no
+TimeoutSec=5min
+IgnoreSIGPIPE=no
+KillMode=process
+GuessMainPID=no
+RemainAfterExit=no
+TasksMax=infinity
+ExecStart=/etc/init.d/ambari-agent start
+ExecStop=/etc/init.d/ambari-agent stop
diff --git a/ambari-agent/pom.xml b/ambari-agent/pom.xml
index a2b4cd4..18c77f4 100644
--- a/ambari-agent/pom.xml
+++ b/ambari-agent/pom.xml
@@ -273,7 +273,6 @@
   
 
 
-
   2012, Apache Software Foundation
   Development
   Maven Recipe: RPM Package.
@@ -303,7 +302,7 @@
 
   x86_64
   false
-  
+  
 
   /etc
   root
@@ -703,6 +702,34 @@
  
 
 
+  suse12
+  
+
+  
+org.codehaus.mojo
+rpm-maven-plugin
+
+  Development
+  
+
+  /usr/lib/systemd/system/
+  root
+  root
+  644
+  false
+  
+
+  
${project.build.directory}${dirsep}${project.artifactId}-${project.version}${dirsep}usr${dirsep}lib${dirsep}systemd${dirsep}system${dirsep}ambari-agent.service
+
+  
+
+  
+
+  
+
+  
+
+
   windows-distro
   
 
diff --git a/ambari-agent/src/packages/tarball/all.xml 
b/ambari-agent/src/packages/tarball/all.xml
index 2ff57cd..5f8c273 100644
--- a/ambari-agent/src/packages/tarball/all.xml
+++ b/ambari-agent/src/packages/tarball/all.xml
@@ -186,6 +186,11 @@
   /etc/ambari-agent/conf
 
 
+  644
+  conf/unix/ambari-agent.service
+  /usr/lib/systemd/system
+
+
   755
   ${basedir}/target/src/ambari-agent
   /var/lib/ambari-agent/bin



[ambari] branch branch-2.7 updated: AMBARI-25230 improve fast-hdfs tool exception handling (benyoka) (#2916)

2019-04-11 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-2.7 by this push:
 new 2a98cea  AMBARI-25230 improve fast-hdfs tool exception handling 
(benyoka) (#2916)
2a98cea is described below

commit 2a98cea0baadcaaa1b653f8209ca308c739853fb
Author: benyoka 
AuthorDate: Thu Apr 11 13:36:02 2019 +0200

AMBARI-25230 improve fast-hdfs tool exception handling (benyoka) (#2916)
---
 .../src/main/java/org/apache/ambari/fast_hdfs_resource/Runner.java   | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git 
a/contrib/fast-hdfs-resource/src/main/java/org/apache/ambari/fast_hdfs_resource/Runner.java
 
b/contrib/fast-hdfs-resource/src/main/java/org/apache/ambari/fast_hdfs_resource/Runner.java
index 9cf0a73..03a995c 100644
--- 
a/contrib/fast-hdfs-resource/src/main/java/org/apache/ambari/fast_hdfs_resource/Runner.java
+++ 
b/contrib/fast-hdfs-resource/src/main/java/org/apache/ambari/fast_hdfs_resource/Runner.java
@@ -35,7 +35,7 @@ import com.google.gson.Gson;
 
 public class Runner {
   public static void main(String[] args)
-  throws IOException, URISyntaxException {
+  throws IOException, URISyntaxException, Exception  {
 // 1 - Check arguments
 if (args.length != 1) {
   System.err.println("Incorrect number of arguments. Please provide:\n"
@@ -64,7 +64,7 @@ public class Runner {
   // 3 - Load data from JSON
   resources = (Resource[]) gson.fromJson(new FileReader(jsonFilePath),
   Resource[].class);
-  
+
   Configuration conf = new Configuration();
   FileSystem dfs = null;
 
@@ -144,6 +144,7 @@ public class Runner {
 catch(Exception e) {
System.out.println("Exception occurred, Reason: " + e.getMessage());
e.printStackTrace();
+   throw e;
 }
 finally {
   for(FileSystem dfs:fileSystemNameToInstance.values()) {



[ambari] branch branch-2.6 updated: AMBARI-25230 improve fast-hdfs tool exception handling (benyoka) (#2915)

2019-04-11 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch branch-2.6
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-2.6 by this push:
 new 34ecd4c  AMBARI-25230 improve fast-hdfs tool exception handling 
(benyoka) (#2915)
34ecd4c is described below

commit 34ecd4ceacbe905dca52e9118a7d327420ab285c
Author: benyoka 
AuthorDate: Thu Apr 11 13:47:13 2019 +0200

AMBARI-25230 improve fast-hdfs tool exception handling (benyoka) (#2915)
---
 .../main/java/org/apache/ambari/fast_hdfs_resource/Runner.java | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git 
a/contrib/fast-hdfs-resource/src/main/java/org/apache/ambari/fast_hdfs_resource/Runner.java
 
b/contrib/fast-hdfs-resource/src/main/java/org/apache/ambari/fast_hdfs_resource/Runner.java
index 98119b0..ab0d08a 100644
--- 
a/contrib/fast-hdfs-resource/src/main/java/org/apache/ambari/fast_hdfs_resource/Runner.java
+++ 
b/contrib/fast-hdfs-resource/src/main/java/org/apache/ambari/fast_hdfs_resource/Runner.java
@@ -31,7 +31,7 @@ import com.google.gson.Gson;
 
 public class Runner {
   public static void main(String[] args)
-  throws IOException, URISyntaxException {
+  throws IOException, URISyntaxException, Exception {
 // 1 - Check arguments
 if (args.length != 1) {
   System.err.println("Incorrect number of arguments. Please provide:\n"
@@ -65,7 +65,7 @@ public class Runner {
   // 4 - Connect to HDFS
   System.out.println("Using filesystem uri: " + 
FileSystem.getDefaultUri(conf).toString());
   dfs.initialize(FileSystem.getDefaultUri(conf), conf);
-  
+
   for (Resource resource : resources) {
 System.out.println("Creating: " + resource);
 
@@ -104,12 +104,14 @@ public class Runner {
 catch(Exception e) {
System.out.println("Exception occurred, Reason: " + e.getMessage());
e.printStackTrace();
+   throw e;
 }
 finally {
-  dfs.close();
+  if (null != dfs) {
+dfs.close();
+  }
 }
 
 System.out.println("All resources created.");
   }
-
 }



[ambari] branch branch-2.7 updated: AMBARI-25201 check acting users password on change password request (#2924)

2019-04-12 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-2.7 by this push:
 new 1d58a2a  AMBARI-25201 check acting users password on change password 
request (#2924)
1d58a2a is described below

commit 1d58a2ad29cd9ee2ffb1a7c0cc2beda7c13effd1
Author: benyoka 
AuthorDate: Fri Apr 12 19:32:50 2019 +0200

AMBARI-25201 check acting users password on change password request (#2924)

* AMBARI-25201 check acting users password on change password request

* AMBARI-25201 fix failing unit tests (benyoka)
---
 .../server/security/authorization/Users.java   | 23 --
 .../server/security/authorization/TestUsers.java   | 24 +-
 .../server/security/authorization/UsersTest.java   | 92 +-
 3 files changed, 126 insertions(+), 13 deletions(-)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/Users.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/Users.java
index 3e750c6..0974a72 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/Users.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/Users.java
@@ -26,6 +26,7 @@ import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
+import java.util.Optional;
 import java.util.Set;
 
 import javax.persistence.EntityManager;
@@ -1230,14 +1231,13 @@ public class Users {
 
 if (userAuthenticationEntity != null) {
   if (userAuthenticationEntity.getAuthenticationType() == 
UserAuthenticationType.LOCAL) {
-// If the authentication record represents a local password and the 
authenticated user is
-// changing the password for himself, ensure the old key value matches 
the current key value
-// If the authenticated user is can manager users and is not changing 
his own password, there
-// is no need to check that the authenticated user knows the current 
password - just update it.
-if (isSelf &&
-(StringUtils.isEmpty(currentKey) || 
!passwordEncoder.matches(currentKey, 
userAuthenticationEntity.getAuthenticationKey( {
-  // The authenticated user is the same user as subject user and the 
correct current password
-  // was not supplied.
+
+String expectedCurrentKey = isSelf
+  ? userAuthenticationEntity.getAuthenticationKey()
+  : getAuthenticatedUserLocalAuthenticationMethod().
+  orElseThrow(() -> new AmbariException("Authentication 
error")).getAuthenticationKey();
+
+if (StringUtils.isEmpty(currentKey) || 
!passwordEncoder.matches(currentKey, expectedCurrentKey)) {
   throw new AmbariException("Wrong current password provided");
 }
 
@@ -1255,6 +1255,13 @@ public class Users {
 }
   }
 
+  private Optional 
getAuthenticatedUserLocalAuthenticationMethod() {
+User authenticatedUser = getUser(AuthorizationHelper.getAuthenticatedId());
+return authenticatedUser.getAuthenticationMethods().stream()
+  .filter(am -> 
UserAuthenticationType.LOCAL.equals(am.getAuthenticationType()))
+  .findAny();
+  }
+
   public void removeAuthentication(String username, Long authenticationId) {
 removeAuthentication(getUserEntity(username), authenticationId);
   }
diff --git 
a/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/TestUsers.java
 
b/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/TestUsers.java
index f7174f5..0c1ce05 100644
--- 
a/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/TestUsers.java
+++ 
b/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/TestUsers.java
@@ -17,6 +17,10 @@
  */
 package org.apache.ambari.server.security.authorization;
 
+import static java.util.Collections.emptySet;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.mock;
+import static org.easymock.EasyMock.replay;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNotSame;
@@ -49,6 +53,7 @@ import org.apache.ambari.server.orm.entities.ResourceEntity;
 import org.apache.ambari.server.orm.entities.ResourceTypeEntity;
 import org.apache.ambari.server.orm.entities.UserAuthenticationEntity;
 import org.apache.ambari.server.orm.entities.UserEntity;
+import org.apache.ambari.server.security.authentication.AmbariUserDetailsImpl;
 import org.apache.ambari.server.security.ldap.LdapBatchDto;
 import org.apache.ambari.server.security.ldap.LdapGroupDto;
 import org.apache.ambari.server.security.ldap.LdapUserDto;
@@ -57,6 +62,9 @@ import org.easymock.EasyMock;
 import org.junit.After;
 import org.ju

[ambari] branch branch-2.7 updated: AMBARI-25278 display all .count type Kafka metrics as rates in Grafana (#2982)

2019-05-30 Thread benyoka
This is an automated email from the ASF dual-hosted git repository.

benyoka pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-2.7 by this push:
 new 7484e79  AMBARI-25278 display all .count type Kafka metrics as rates 
in Grafana (#2982)
7484e79 is described below

commit 7484e7912b34d41b339789609ea1ac5ebf1c2b36
Author: benyoka 
AuthorDate: Thu May 30 11:48:02 2019 +0200

AMBARI-25278 display all .count type Kafka metrics as rates in Grafana 
(#2982)
---
 .../grafana-dashboards/HDF/grafana-kafka-home.json   | 18 +-
 .../grafana-dashboards/HDF/grafana-kafka-hosts.json  | 14 +++---
 .../grafana-dashboards/HDF/grafana-kafka-topics.json | 20 ++--
 .../grafana-dashboards/HDP/grafana-kafka-home.json   | 18 +-
 .../grafana-dashboards/HDP/grafana-kafka-hosts.json  | 14 +++---
 .../grafana-dashboards/HDP/grafana-kafka-topics.json | 20 ++--
 6 files changed, 52 insertions(+), 52 deletions(-)

diff --git 
a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/files/grafana-dashboards/HDF/grafana-kafka-home.json
 
b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/files/grafana-dashboards/HDF/grafana-kafka-home.json
index 5ec4404..983142a 100644
--- 
a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/files/grafana-dashboards/HDF/grafana-kafka-home.json
+++ 
b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/files/grafana-dashboards/HDF/grafana-kafka-home.json
@@ -89,7 +89,7 @@
   "metric": "kafka.server.BrokerTopicMetrics.BytesInPerSec.count",
   "precision": "default",
   "refId": "A",
-  "transform": "none",
+  "transform": "rate",
   "transformData": "none"
 },
 {
@@ -101,7 +101,7 @@
   "metric": "kafka.server.BrokerTopicMetrics.BytesOutPerSec.count",
   "precision": "default",
   "refId": "B",
-  "transform": "none",
+  "transform": "rate",
   "transformData": "none"
 }
   ],
@@ -172,7 +172,7 @@
   "metric": 
"kafka.server.BrokerTopicMetrics.MessagesInPerSec.count",
   "precision": "default",
   "refId": "A",
-  "transform": "none",
+  "transform": "rate",
   "transformData": "none"
 }
   ],
@@ -558,7 +558,7 @@
   "metric": 
"kafka.network.RequestMetrics.RequestsPerSec.request.Produce.count",
   "precision": "default",
   "refId": "A",
-  "transform": "none",
+  "transform": "rate",
   "transformData": "none"
 }
   ],
@@ -629,7 +629,7 @@
   "metric": 
"kafka.network.RequestMetrics.RequestsPerSec.request.FetchConsumer.count",
   "precision": "default",
   "refId": "A",
-  "transform": "none",
+  "transform": "rate",
   "transformData": "none"
 }
   ],
@@ -709,7 +709,7 @@
   "metric": 
"kafka.controller.ControllerStats.LeaderElectionRateAndTimeMs.count",
   "precision": "default",
   "refId": "A",
-  "transform": "none",
+  "transform": "rate",
   "transformData": "rate"
 }
   ],
@@ -780,7 +780,7 @@
   "metric": 
"kafka.controller.ControllerStats.UncleanLeaderElectionsPerSec.count",
   "precision": "default",
   "refId": "A",
-  "transform": "none",
+  "transform": "rate",
   "transformData": "none"
 }
   ],
@@ -860,7 +860,7 @@
   "metric": "kafka.server.ReplicaManager.IsrShrinksPerSec.count",
   "precision": "default",
   "refId": "A",
-  "t