ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aonis...@apache.org
Subject [1/2] ambari git commit: AMBARI-21054. Add ppc as a new OS for User. (aonishuk)
Date Tue, 06 Jun 2017 10:58:47 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 533ec274c -> be980bb6f
  refs/heads/trunk 119d2624f -> bc90de2e9


AMBARI-21054. Add ppc as a new OS for User. (aonishuk)


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

Branch: refs/heads/trunk
Commit: bc90de2e9843f41229d86f4dad6accbb66163500
Parents: 119d262
Author: Andrew Onishuk <aonishuk@hortonworks.com>
Authored: Tue Jun 6 13:58:40 2017 +0300
Committer: Andrew Onishuk <aonishuk@hortonworks.com>
Committed: Tue Jun 6 13:58:40 2017 +0300

----------------------------------------------------------------------
 .../src/main/python/ambari_commons/os_check.py   |  6 ++++++
 .../ambari_commons/resources/os_family.json      | 10 ++++++++++
 .../core/providers/__init__.py                   | 19 +++++++++++++------
 .../libraries/providers/__init__.py              |  3 ---
 .../AmbariManagementControllerImpl.java          | 16 ++++++++++++----
 .../ambari/server/state/stack/OsFamily.java      | 12 ++++++++++++
 .../resources/stacks/HDP/2.6/repos/repoinfo.xml  | 14 ++++++++++++++
 7 files changed, 67 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/bc90de2e/ambari-common/src/main/python/ambari_commons/os_check.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/ambari_commons/os_check.py b/ambari-common/src/main/python/ambari_commons/os_check.py
index b430c86..0416584 100644
--- a/ambari-common/src/main/python/ambari_commons/os_check.py
+++ b/ambari-common/src/main/python/ambari_commons/os_check.py
@@ -86,6 +86,9 @@ def _is_oracle_linux():
 def _is_redhat_linux():
   return _IS_REDHAT_LINUX
 
+def _is_powerpc():
+  return platform.processor() == 'powerpc' or platform.machine().startswith('ppc')
+
 def advanced_check(distribution):
   distribution = list(distribution)
   if os.path.exists(SYSTEM_RELEASE_FILE):
@@ -255,6 +258,9 @@ class OSCheck:
 
     if operatingSystem == '':
       raise Exception("Cannot detect os type. Exiting...")
+
+    if _is_powerpc():
+      operatingSystem += '-ppc'
     
     return operatingSystem
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/bc90de2e/ambari-common/src/main/python/ambari_commons/resources/os_family.json
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/ambari_commons/resources/os_family.json b/ambari-common/src/main/python/ambari_commons/resources/os_family.json
index 859ce56..b9cdbf6 100644
--- a/ambari-common/src/main/python/ambari_commons/resources/os_family.json
+++ b/ambari-common/src/main/python/ambari_commons/resources/os_family.json
@@ -22,6 +22,16 @@
           7
         ]
       },
+      "redhat-ppc": {
+        "extends" : "redhat",
+        "distro": [
+          "redhat-ppc",
+          "centos-ppc"
+        ],
+        "versions": [
+          6
+        ]
+      },
       "debian": {
         "extends" : "ubuntu",
         "distro": [

http://git-wip-us.apache.org/repos/asf/ambari/blob/bc90de2e/ambari-common/src/main/python/resource_management/core/providers/__init__.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/core/providers/__init__.py
b/ambari-common/src/main/python/resource_management/core/providers/__init__.py
index 21ae0d5..ac6ee16 100644
--- a/ambari-common/src/main/python/resource_management/core/providers/__init__.py
+++ b/ambari-common/src/main/python/resource_management/core/providers/__init__.py
@@ -24,7 +24,7 @@ __all__ = ["Provider", "find_provider"]
 
 from resource_management.core.exceptions import Fail
 from resource_management.libraries.providers import PROVIDERS as LIBRARY_PROVIDERS
-
+from ambari_commons.os_check import OSCheck
 
 class Provider(object):
   def __init__(self, resource):
@@ -53,9 +53,6 @@ PROVIDERS = dict(
   ubuntu=dict(
     Package="resource_management.core.providers.package.apt.AptProvider",
   ),
-  debian=dict(
-    Package="resource_management.core.providers.package.apt.AptProvider",
-  ),
   winsrv=dict(
     Service="resource_management.core.providers.windows.service.ServiceProvider",
     ServiceConfig="resource_management.core.providers.windows.service.ServiceConfigProvider",
@@ -82,9 +79,19 @@ PROVIDERS = dict(
 def find_provider(env, resource, class_path=None):
   if not class_path:
     providers = [PROVIDERS, LIBRARY_PROVIDERS]
+
     for provider in providers:
-      if resource in provider[env.system.os_family]:
-        class_path = provider[env.system.os_family][resource]
+
+      if env.system.os_family in provider:
+        os_family_provider = provider[env.system.os_family]
+      else:
+        # take care of os extensions
+        for family in provider:
+          if OSCheck.is_in_family(env.system.os_family, family):
+            os_family_provider = provider[family]
+
+      if resource in os_family_provider:
+        class_path = os_family_provider[resource]
         break
       if resource in provider["default"]:
         class_path = provider["default"][resource]

http://git-wip-us.apache.org/repos/asf/ambari/blob/bc90de2e/ambari-common/src/main/python/resource_management/libraries/providers/__init__.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/providers/__init__.py
b/ambari-common/src/main/python/resource_management/libraries/providers/__init__.py
index bd7c98a..770f9b5 100644
--- a/ambari-common/src/main/python/resource_management/libraries/providers/__init__.py
+++ b/ambari-common/src/main/python/resource_management/libraries/providers/__init__.py
@@ -33,9 +33,6 @@ PROVIDERS = dict(
   ubuntu=dict(
     Repository="resource_management.libraries.providers.repository.UbuntuRepositoryProvider",
   ),
-  debian=dict(
-    Repository="resource_management.libraries.providers.repository.UbuntuRepositoryProvider",
-  ),
   winsrv=dict(
     Msi="resource_management.libraries.providers.msi.MsiProvider"
   ),

http://git-wip-us.apache.org/repos/asf/ambari/blob/bc90de2e/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 186a19e..b67b45b 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
@@ -187,6 +187,7 @@ import org.apache.ambari.server.state.quicklinksprofile.QuickLinkVisibilityContr
 import org.apache.ambari.server.state.quicklinksprofile.QuickLinksProfile;
 import org.apache.ambari.server.state.repository.VersionDefinitionXml;
 import org.apache.ambari.server.state.scheduler.RequestExecutionFactory;
+import org.apache.ambari.server.state.stack.OsFamily;
 import org.apache.ambari.server.state.stack.RepositoryXml;
 import org.apache.ambari.server.state.stack.WidgetLayout;
 import org.apache.ambari.server.state.stack.WidgetLayoutInfo;
@@ -313,6 +314,8 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
   private ExtensionLinkDAO linkDAO;
   @Inject
   private StackDAO stackDAO;
+  @Inject
+  private OsFamily osFamily;
 
   /**
    * The KerberosHelper to help setup for enabling for disabling Kerberos
@@ -2621,13 +2624,18 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
   }
 
   private List<ServiceOsSpecific> getOSSpecificsByFamily(Map<String, ServiceOsSpecific>
osSpecifics, String osFamily) {
-    List<ServiceOsSpecific> foundedOSSpecifics = new ArrayList<>();
+    List<ServiceOsSpecific> foundOSSpecifics = new ArrayList<>();
     for (Entry<String, ServiceOsSpecific> osSpecific : osSpecifics.entrySet()) {
-      if (osSpecific.getKey().contains(osFamily)) {
-        foundedOSSpecifics.add(osSpecific.getValue());
+      String[] osFamilyNames = osSpecific.getKey().split("\\s*,\\s*");
+
+      for(String osFamilyName:osFamilyNames) {
+        if (this.osFamily.isVersionedOsFamilyExtendedByVersionedFamily(osFamily, osFamilyName))
{
+          foundOSSpecifics.add(osSpecific.getValue());
+          break;
+        }
       }
     }
-    return foundedOSSpecifics;
+    return foundOSSpecifics;
   }
 
   private ActionExecutionContext getActionExecutionContext

http://git-wip-us.apache.org/repos/asf/ambari/blob/bc90de2e/ambari-server/src/main/java/org/apache/ambari/server/state/stack/OsFamily.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/OsFamily.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/OsFamily.java
index bd89be0..b0d961c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/stack/OsFamily.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/stack/OsFamily.java
@@ -208,6 +208,18 @@ public class OsFamily {
       return (currentFamily.equals(family) || getOsFamilyParent(currentFamily)!=null &&
isFamilyExtendedByFamily(getOsFamilyParent(currentFamily), family));
     }
 
+    public boolean isVersionedOsFamilyExtendedByVersionedFamily(String currentVersionedFamily,
String versionedFamily) {
+      Map<String,String> pos = this.parse_os(currentVersionedFamily);
+      String currentFamily = pos.get(OS_DISTRO);
+      String currentFamilyVersion = pos.get(OS_VERSION);
+
+      pos = this.parse_os(versionedFamily);
+      String family = pos.get(OS_DISTRO);
+      String familyVersion = pos.get(OS_VERSION);
+
+      return currentFamilyVersion.equals(familyVersion) && isFamilyExtendedByFamily(currentFamily,
family);
+    }
+
     private String getOsFamilyParent(String osFamily) {
       return osMap.get(osFamily).getExtendsFamily();
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/bc90de2e/ambari-server/src/main/resources/stacks/HDP/2.6/repos/repoinfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/repos/repoinfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/repos/repoinfo.xml
index 81a70a5..23441f5 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/repos/repoinfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/repos/repoinfo.xml
@@ -31,6 +31,20 @@
       <unique>false</unique>
     </repo>
   </os>
+  <os family="redhat-ppc6">
+    <repo>
+      <baseurl>http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.6.0.3</baseurl>
+      <repoid>HDP-2.6</repoid>
+      <reponame>HDP</reponame>
+      <unique>true</unique>
+    </repo>
+    <repo>
+      <baseurl>http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.21/repos/centos6</baseurl>
+      <repoid>HDP-UTILS-1.1.0.21</repoid>
+      <reponame>HDP-UTILS</reponame>
+      <unique>false</unique>
+    </repo>
+  </os>
   <os family="redhat7">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/centos7/2.x/updates/2.6.0.3</baseurl>


Mime
View raw message