ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From su...@apache.org
Subject git commit: AMBARI-6527. Ambari support on CentOS7 /RHEL7 - I
Date Mon, 06 Oct 2014 14:59:47 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk bb1b5135b -> 5ce6ebfcb


AMBARI-6527. Ambari support on CentOS7 /RHEL7 - I


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

Branch: refs/heads/trunk
Commit: 5ce6ebfcbd4b3ec6f1e0e342347d5a083300d40a
Parents: bb1b513
Author: Subin <subin@SuMcPro.local>
Authored: Mon Oct 6 20:24:48 2014 +0530
Committer: Subin <subin@SuMcPro.local>
Committed: Mon Oct 6 20:29:26 2014 +0530

----------------------------------------------------------------------
 .../src/main/python/ambari_agent/Facter.py         | 17 ++++++++++++-----
 .../src/main/python/ambari_commons/os_check.py     | 17 +++++++++++++++++
 .../ambari/server/agent/HeartBeatHandler.java      |  1 +
 .../ambari/server/api/services/AmbariMetaInfo.java |  2 +-
 .../src/main/python/ambari_server/utils.py         |  4 +++-
 ambari-server/src/main/resources/os_family.json    |  6 ++++++
 6 files changed, 40 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/5ce6ebfc/ambari-agent/src/main/python/ambari_agent/Facter.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/Facter.py b/ambari-agent/src/main/python/ambari_agent/Facter.py
index 0116675..947f380 100644
--- a/ambari-agent/src/main/python/ambari_agent/Facter.py
+++ b/ambari-agent/src/main/python/ambari_agent/Facter.py
@@ -189,8 +189,10 @@ class Facter():
 
   # Return first ip adress
   def getIpAddress(self):
-    result = self.data_return_first("(?: inet addr:)(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})",
-                                    self.DATA_IFCONFIG_OUTPUT)
+    ip_pattern="(?: inet addr:)(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})"
+    if OSCheck.is_redhat7():
+      ip_pattern="(?: inet )(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})"
+    result = self.data_return_first(ip_pattern,self.DATA_IFCONFIG_OUTPUT)
     if result == '':
       log.warn("Can't get an ip address from {0}".format(self.DATA_IFCONFIG_OUTPUT))
       return socket.gethostbyname(socket.gethostname())
@@ -199,8 +201,10 @@ class Facter():
 
   # Return  netmask
   def getNetmask(self):
-    result = self.data_return_first("(?: Mask:)(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})",
-                                    self.DATA_IFCONFIG_OUTPUT)
+    mask_pattern="(?: Mask:)(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})"
+    if OSCheck.is_redhat7():
+      mask_pattern="(?: netmask )(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})"
+    result = self.data_return_first(mask_pattern,self.DATA_IFCONFIG_OUTPUT)
     if result == '':
       log.warn("Can't get a netmask from {0}".format(self.DATA_IFCONFIG_OUTPUT))
       return 'OS NOT SUPPORTED'
@@ -209,7 +213,10 @@ class Facter():
 
   # Return interfaces
   def getInterfaces(self):
-    result = self.data_return_list("(\w+)(?:.*Link encap:)", self.DATA_IFCONFIG_OUTPUT)
+    interface_pattern="(\w+)(?:.*Link encap:)"
+    if OSCheck.is_redhat7():
+      interface_pattern="(\w+)(?:.*flags=)"
+    result = self.data_return_list(interface_pattern, self.DATA_IFCONFIG_OUTPUT)
     if result == '':
       log.warn("Can't get a network interfaces list from {0}".format(self.DATA_IFCONFIG_OUTPUT))
       return 'OS NOT SUPPORTED'

http://git-wip-us.apache.org/repos/asf/ambari/blob/5ce6ebfc/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 2bab473..dfbd9e2 100644
--- a/ambari-common/src/main/python/ambari_commons/os_check.py
+++ b/ambari-common/src/main/python/ambari_commons/os_check.py
@@ -28,6 +28,8 @@ def linux_distribution():
 
   if PYTHON_VER < 26:
     linux_distribution = platform.dist()
+  elif os.path.exists('/etc/redhat-release'):
+    linux_distribution = platform.dist()
   else:
     linux_distribution = platform.linux_distribution()
 
@@ -212,3 +214,18 @@ class OSCheck:
     except Exception:
       pass
     return False
+
+  @staticmethod
+  def is_redhat7():
+    """
+     Return true if it is so or false if not
+
+     This is safe check for redhat7 , doesn't generate exception
+    """
+    try:
+      ostemp=OSCheck.get_os_family()+OSCheck().get_os_major_version()
+      if ostemp == 'redhat7':
+        return True
+    except Exception:
+      pass
+    return False
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/5ce6ebfc/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
index fa633c1..1d9ee20 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartBeatHandler.java
@@ -636,6 +636,7 @@ public class HeartBeatHandler {
 
     String agentOsType = getOsType(register.getHardwareProfile().getOS(),
         register.getHardwareProfile().getOSRelease());
+    LOG.info("agentOsType = "+agentOsType );
     if (!ambariMetaInfo.isOsSupported(agentOsType)) {
       LOG.warn("Received registration request from host with not supported"
           + " os type"

http://git-wip-us.apache.org/repos/asf/ambari/blob/5ce6ebfc/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-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
index 371ca3b..5f6d830 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
@@ -124,7 +124,7 @@ public class AmbariMetaInfo {
   public static final String REPOSITORY_XML_PROPERTY_BASEURL = "baseurl";
   // all the supported OS'es
   private static final List<String> ALL_SUPPORTED_OS = Arrays.asList(
-      "centos5", "redhat5", "centos6", "redhat6", "oraclelinux5",
+      "redhat7","centos7","centos5", "redhat5", "centos6", "redhat6", "oraclelinux5",
       "oraclelinux6", "suse11", "sles11", "ubuntu12");
 
   private final ActionDefinitionManager adManager = new ActionDefinitionManager();

http://git-wip-us.apache.org/repos/asf/ambari/blob/5ce6ebfc/ambari-server/src/main/python/ambari_server/utils.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari_server/utils.py b/ambari-server/src/main/python/ambari_server/utils.py
index 9b46d94..474caa4 100644
--- a/ambari-server/src/main/python/ambari_server/utils.py
+++ b/ambari-server/src/main/python/ambari_server/utils.py
@@ -23,7 +23,7 @@ import sys
 import time
 import glob
 import subprocess
-from ambari_commons import OSConst
+from ambari_commons import OSConst,OSCheck
 
 # PostgreSQL settings
 PG_STATUS_RUNNING_DEFAULT = "running"
@@ -192,6 +192,8 @@ def get_postgre_hba_dir(OS_FAMILY):
     # Like: /etc/postgresql/9.1/main/
     return os.path.join(PG_HBA_INIT_FILES[OS_FAMILY], get_ubuntu_pg_version(),
                         "main")
+  elif OSCheck.is_redhat7():
+    return PG_HBA_ROOT_DEFAULT
   else:
     if not os.path.isfile(PG_HBA_INIT_FILES[OS_FAMILY]):
       # Link: /etc/init.d/postgresql --> /etc/init.d/postgresql-9.1

http://git-wip-us.apache.org/repos/asf/ambari/blob/5ce6ebfc/ambari-server/src/main/resources/os_family.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/os_family.json b/ambari-server/src/main/resources/os_family.json
index 392e524..6638ea5 100644
--- a/ambari-server/src/main/resources/os_family.json
+++ b/ambari-server/src/main/resources/os_family.json
@@ -1,4 +1,10 @@
 {
+  "redhat7": [
+    "redhat7",
+    "centos7",
+    "oraclelinux7",
+    "rhel7"
+  ],
   "redhat6": [
     "redhat6",
     "centos6",


Mime
View raw message