ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mradhakrish...@apache.org
Subject [1/2] ambari git commit: AMBARI-22283 : Add stack name and version to mpack API (mradhakrishnan)
Date Mon, 23 Oct 2017 19:48:03 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-feature-AMBARI-14714 3d8c9b744 -> f50d9a2aa


AMBARI-22283 : Add stack name and version to mpack API (mradhakrishnan)


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

Branch: refs/heads/branch-feature-AMBARI-14714
Commit: 1c6de7914d6c7417584cd93e506f4e9c2f0d43e5
Parents: 3d8c9b7
Author: Madhuvanthi Radhakrishnan <mradhakrishnan@hortonworks.com>
Authored: Sun Oct 22 14:34:34 2017 -0700
Committer: Madhuvanthi Radhakrishnan <mradhakrishnan@hortonworks.com>
Committed: Sun Oct 22 14:34:34 2017 -0700

----------------------------------------------------------------------
 .../server/controller/internal/MpackResourceProvider.java | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1c6de791/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/MpackResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/MpackResourceProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/MpackResourceProvider.java
index 2642d10..c72ae1b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/MpackResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/MpackResourceProvider.java
@@ -144,12 +144,15 @@ public class MpackResourceProvider extends AbstractControllerResourceProvider
{
       MpackResponse response = getManagementController().registerMpack(mpackRequest);
       if (response != null) {
         notifyCreate(Resource.Type.Mpack, request);
+        String[] stackNameVersion = response.getStackId().split("-");
         Resource resource = new ResourceImpl(Resource.Type.Mpack);
         resource.setProperty(MPACK_ID, response.getMpackId());
         resource.setProperty(REGISTRY_ID, response.getRegistryId());
         resource.setProperty(MPACK_NAME, response.getMpackName());
         resource.setProperty(MPACK_VERSION, response.getMpackVersion());
         resource.setProperty(MPACK_URI, response.getMpackUri());
+        resource.setProperty(STACK_NAME_PROPERTY_ID, stackNameVersion[0]);
+        resource.setProperty(STACK_VERSION_PROPERTY_ID, stackNameVersion[1]);
 
         associatedResources.add(resource);
         return getRequestStatus(null, associatedResources);
@@ -252,6 +255,9 @@ public class MpackResourceProvider extends AbstractControllerResourceProvider
{
         resource.setProperty(MPACK_VERSION, entity.getMpackVersion());
         resource.setProperty(MPACK_URI, entity.getMpackUri());
         resource.setProperty(REGISTRY_ID, entity.getRegistryId());
+        StackEntity stackEntity = stackDAO.findByMpack(entity.getMpackId());
+        resource.setProperty(STACK_NAME_PROPERTY_ID, stackEntity.getStackName());
+        resource.setProperty(STACK_VERSION_PROPERTY_ID, stackEntity.getStackVersion());
         results.add(resource);
       }
     } else {
@@ -290,7 +296,9 @@ public class MpackResourceProvider extends AbstractControllerResourceProvider
{
           resource.setProperty(MPACK_VERSION, entity.getMpackVersion());
           resource.setProperty(MPACK_URI, entity.getMpackUri());
           resource.setProperty(REGISTRY_ID, entity.getRegistryId());
-
+          StackEntity stackEntity = stackDAO.findByMpack(entity.getMpackId());
+          resource.setProperty(STACK_NAME_PROPERTY_ID, stackEntity.getStackName());
+          resource.setProperty(STACK_VERSION_PROPERTY_ID, stackEntity.getStackVersion());
           List<Packlet> packlets = getManagementController().getPacklets(entity.getMpackId());
           resource.setProperty(PACKLETS, packlets);
           results.add(resource);


Mime
View raw message