This is an automated email from the ASF dual-hosted git repository.

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

commit 2d5787a3c67dc1648569d98a7acae44ee69bb113
Author: Madhuvanthi Radhakrishnan <mradhakrish...@hortonworks.com>
AuthorDate: Fri Feb 9 20:18:45 2018 -0800

    [AMBARI-96286] Stack Metainfo.xml should contain the osSpecifics tag. Add 
as part of metainfo generation.
---
 .../java/org/apache/ambari/server/mpack/MpackManager.java   | 13 +++++++++++++
 .../apache/ambari/server/state/stack/StackMetainfoXml.java  |  4 ++++
 2 files changed, 17 insertions(+)

diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/mpack/MpackManager.java 
b/ambari-server/src/main/java/org/apache/ambari/server/mpack/MpackManager.java
index 300c22e..22a2a74 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/mpack/MpackManager.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/mpack/MpackManager.java
@@ -29,6 +29,7 @@ import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.nio.file.StandardCopyOption;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
@@ -46,6 +47,7 @@ import org.apache.ambari.server.orm.entities.MpackEntity;
 import org.apache.ambari.server.orm.entities.StackEntity;
 import org.apache.ambari.server.state.Module;
 import org.apache.ambari.server.state.Mpack;
+import org.apache.ambari.server.state.OsSpecific;
 import org.apache.ambari.server.state.StackId;
 import org.apache.ambari.server.state.stack.StackMetainfoXml;
 import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
@@ -328,6 +330,17 @@ public class MpackManager {
     version.setActive(true);
     generatedMetainfo.setVersion(version);
 
+    //Add osSpecifics to the metainfo.xml
+    OsSpecific osSpecific = new OsSpecific("any");
+    OsSpecific.Package pkg = new OsSpecific.Package();
+    pkg.setName(mpack.getName().toLowerCase());
+    ArrayList<OsSpecific.Package> packageArrayList = new ArrayList<>();
+    packageArrayList.add(pkg);
+    ArrayList<OsSpecific> osSpecificArrayList = new ArrayList<>();
+    osSpecificArrayList.add(osSpecific);
+    osSpecific.addPackages(packageArrayList);
+    generatedMetainfo.setOsSpecifics(osSpecificArrayList);
+
     Map<String, String> prerequisites = mpack.getPrerequisites();
     if (prerequisites != null && prerequisites.containsKey(MIN_JDK_PROPERTY)) {
       
generatedMetainfo.setMinJdk(mpack.getPrerequisites().get(MIN_JDK_PROPERTY));
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/StackMetainfoXml.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/StackMetainfoXml.java
index 7f56b50..31568d8 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/StackMetainfoXml.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/StackMetainfoXml.java
@@ -131,6 +131,10 @@ public class StackMetainfoXml implements Validable{
     this.version = version;
   }
 
+  public void setOsSpecifics(List<OsSpecific> osSpecifics) {
+    this.osSpecifics = osSpecifics;
+  }
+
   /**
    * Internal list of os-specific details (loaded from xml). Added at schema 
ver 2
    */

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

Reply via email to