Преглед изворни кода

AMBARI-14953. Support Ambari Server/Agent and HDP install on Amazon Linux. (aonishuk)

Andrew Onishuk пре 9 година
родитељ
комит
268ae5b626
59 измењених фајлова са 188 додато и 92 уклоњено
  1. 4 4
      ambari-agent/conf/unix/ambari-agent
  2. 21 5
      ambari-agent/conf/unix/install-helper.sh
  3. 0 5
      ambari-agent/src/packages/tarball/all.xml
  4. 24 3
      ambari-common/src/main/python/ambari_commons/os_check.py
  5. 9 1
      ambari-common/src/main/python/ambari_commons/resources/os_family.json
  6. 3 0
      ambari-common/src/main/python/resource_management/core/providers/__init__.py
  7. 3 0
      ambari-common/src/main/python/resource_management/libraries/providers/__init__.py
  8. 4 4
      ambari-common/src/main/unix/ambari-python-wrap
  9. 2 2
      ambari-funtest/src/test/resources/stacks/HDP/2.0.1/services/GANGLIA/metainfo.xml
  10. 1 1
      ambari-funtest/src/test/resources/stacks/HDP/2.0.1/services/HDFS/metainfo.xml
  11. 2 2
      ambari-funtest/src/test/resources/stacks/HDP/2.0.1/services/HIVE/metainfo.xml
  12. 1 1
      ambari-funtest/src/test/resources/stacks/HDP/2.0.1/services/OOZIE/metainfo.xml
  13. 2 2
      ambari-funtest/src/test/resources/stacks/HDP/2.0.5/services/GANGLIA/metainfo.xml
  14. 1 1
      ambari-funtest/src/test/resources/stacks/HDP/2.0.5/services/HDFS/metainfo.xml
  15. 2 2
      ambari-funtest/src/test/resources/stacks/HDP/2.0.5/services/HIVE/metainfo.xml
  16. 1 1
      ambari-funtest/src/test/resources/stacks/HDP/2.0.5/services/OOZIE/metainfo.xml
  17. 2 2
      ambari-funtest/src/test/resources/stacks/HDP/2.0.7/services/HIVE/metainfo.xml
  18. 1 1
      ambari-funtest/src/test/resources/stacks/HDP/2.1.1/services/AMBARI_METRICS/metainfo.xml
  19. 1 0
      ambari-server/conf/unix/ambari-env.sh
  20. 20 4
      ambari-server/conf/unix/install-helper.sh
  21. 4 3
      ambari-server/sbin/ambari-server
  22. 0 5
      ambari-server/src/main/assemblies/server.xml
  23. 3 2
      ambari-server/src/main/python/ambari_server/utils.py
  24. 1 1
      ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/metainfo.xml
  25. 2 2
      ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/metainfo.xml
  26. 1 1
      ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/metainfo.xml
  27. 2 2
      ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/metainfo.xml
  28. 1 1
      ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/metainfo.xml
  29. 1 1
      ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/metainfo.xml
  30. 2 2
      ambari-server/src/main/resources/stacks/HDP/2.1/services/HIVE/metainfo.xml
  31. 1 1
      ambari-server/src/main/resources/stacks/HDP/2.1/services/OOZIE/metainfo.xml
  32. 12 0
      ambari-server/src/main/resources/stacks/HDP/2.2/repos/repoinfo.xml
  33. 1 1
      ambari-server/src/main/resources/stacks/HDP/2.2/services/FALCON/metainfo.xml
  34. 1 1
      ambari-server/src/main/resources/stacks/HDP/2.2/services/FLUME/metainfo.xml
  35. 1 1
      ambari-server/src/main/resources/stacks/HDP/2.2/services/HBASE/metainfo.xml
  36. 1 1
      ambari-server/src/main/resources/stacks/HDP/2.2/services/HDFS/metainfo.xml
  37. 3 3
      ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/metainfo.xml
  38. 1 1
      ambari-server/src/main/resources/stacks/HDP/2.2/services/KAFKA/metainfo.xml
  39. 1 1
      ambari-server/src/main/resources/stacks/HDP/2.2/services/KNOX/metainfo.xml
  40. 1 1
      ambari-server/src/main/resources/stacks/HDP/2.2/services/OOZIE/metainfo.xml
  41. 1 1
      ambari-server/src/main/resources/stacks/HDP/2.2/services/PIG/metainfo.xml
  42. 1 1
      ambari-server/src/main/resources/stacks/HDP/2.2/services/RANGER/metainfo.xml
  43. 1 1
      ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/metainfo.xml
  44. 1 1
      ambari-server/src/main/resources/stacks/HDP/2.2/services/SPARK/metainfo.xml
  45. 1 1
      ambari-server/src/main/resources/stacks/HDP/2.2/services/SQOOP/metainfo.xml
  46. 1 1
      ambari-server/src/main/resources/stacks/HDP/2.2/services/STORM/metainfo.xml
  47. 1 1
      ambari-server/src/main/resources/stacks/HDP/2.2/services/TEZ/metainfo.xml
  48. 2 2
      ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/metainfo.xml
  49. 1 1
      ambari-server/src/main/resources/stacks/HDP/2.3.ECS/services/ZOOKEEPER/metainfo.xml
  50. 12 0
      ambari-server/src/main/resources/stacks/HDP/2.3/repos/repoinfo.xml
  51. 1 1
      ambari-server/src/main/resources/stacks/HDP/2.3/services/ACCUMULO/metainfo.xml
  52. 1 1
      ambari-server/src/main/resources/stacks/HDP/2.3/services/ATLAS/metainfo.xml
  53. 1 1
      ambari-server/src/main/resources/stacks/HDP/2.3/services/HDFS/metainfo.xml
  54. 3 3
      ambari-server/src/main/resources/stacks/HDP/2.3/services/HIVE/metainfo.xml
  55. 1 1
      ambari-server/src/main/resources/stacks/HDP/2.3/services/OOZIE/metainfo.xml
  56. 1 1
      ambari-server/src/main/resources/stacks/HDP/2.3/services/PIG/metainfo.xml
  57. 1 1
      ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER_KMS/metainfo.xml
  58. 1 1
      ambari-server/src/main/resources/stacks/HDP/2.3/services/ZOOKEEPER/metainfo.xml
  59. 12 0
      ambari-server/src/main/resources/stacks/HDP/2.4/repos/repoinfo.xml

+ 4 - 4
ambari-agent/conf/unix/ambari-agent

@@ -40,7 +40,7 @@ export AMBARI_CONF_DIR=/etc/ambari-server/conf:$PATH
 export PYTHONPATH=/usr/lib/python2.6/site-packages:$PYTHONPATH
 
 AMBARI_AGENT=ambari-agent
-PYTHON_WRAP=/var/lib/ambari-agent/ambari-python-wrap
+PYTHON_WRAP=/usr/bin/ambari-python-wrap
 PIDDIR=/var/run/ambari-agent
 PIDFILE=$PIDDIR/$AMBARI_AGENT.pid
 OUTFILE=/var/log/ambari-agent/ambari-agent.out
@@ -81,10 +81,10 @@ change_files_permissions() {
 	ambari-sudo.sh chown 	$current_user "/usr/lib/ambari-agent/"
 }
 
-# fills $PYTHON
-. $PYTHON_WRAP -V 2>/dev/null
 
-export PYTHON=$PYTHON
+if [ -z "$PYTHON" ] ; then
+  export PYTHON=`readlink $PYTHON_WRAP`
+fi
 
 # Trying to read the passphrase from an environment
 if [ ! -z $AMBARI_PASSPHRASE ]; then

+ 21 - 5
ambari-agent/conf/unix/install-helper.sh

@@ -30,7 +30,6 @@ JINJA_AGENT_DIR="/usr/lib/ambari-agent/lib/ambari_jinja2"
 SIMPLEJSON_AGENT_DIR="/usr/lib/ambari-agent/lib/ambari_simplejson"
 
 PYTHON_WRAPER_TARGET="/usr/bin/ambari-python-wrap"
-PYTHON_WRAPER_SOURCE="/var/lib/ambari-agent/ambari-python-wrap"
 
 do_install(){
   if [ -d "/etc/ambari-agent/conf.save" ]; then
@@ -55,10 +54,6 @@ do_install(){
   if [ ! -d "$SIMPLEJSON_DIR" ]; then
     ln -s "$SIMPLEJSON_AGENT_DIR" "$SIMPLEJSON_DIR"
   fi
-  # setting python-wrapper script
-  if [ ! -f "$PYTHON_WRAPER_TARGET" ]; then
-    ln -s "$PYTHON_WRAPER_SOURCE" "$PYTHON_WRAPER_TARGET"
-  fi
   
   # on nano Ubuntu, when umask=027 those folders are created without 'x' bit for 'others'.
   # which causes failures when hadoop users try to access tmp_dir
@@ -85,6 +80,27 @@ do_install(){
     fi
     mv $BAK ${BAK}_$(date '+%d_%m_%y_%H_%M').save
   fi
+
+  # remove old python wrapper
+  rm -f "$PYTHON_WRAPER_TARGET"
+
+  AMBARI_PYTHON=""
+  python_binaries=( "/usr/bin/python" "/usr/bin/python2" "/usr/bin/python2.7", "/usr/bin/python2.6" )
+  for python_binary in "${python_binaries[@]}"
+  do
+    $python_binary -c "import sys ; ver = sys.version_info ; sys.exit(not (ver >= (2,6) and ver<(3,0)))" 1>/dev/null 2>/dev/null
+
+    if [ $? -eq 0 ] ; then
+      AMBARI_PYTHON="$python_binary"
+      break;
+    fi
+  done
+
+  if [ -z "$AMBARI_PYTHON" ] ; then
+    >&2 echo "Cannot detect python for ambari to use. Please manually set $PYTHON_WRAPER link to point to correct python binary"
+  else
+    ln -s "$AMBARI_PYTHON" "$PYTHON_WRAPER_TARGET"
+  fi
 }
 
 do_remove(){

+ 0 - 5
ambari-agent/src/packages/tarball/all.xml

@@ -139,11 +139,6 @@
 	  </files>
   -->
   <files>
-    <file>
-      <fileMode>755</fileMode>
-      <source>../ambari-common/src/main/unix/ambari-python-wrap</source>
-      <outputDirectory>/var/lib/ambari-agent/</outputDirectory>
-    </file>
     <file>
       <fileMode>755</fileMode>
       <source>conf/unix/ambari-sudo.sh</source>

+ 24 - 3
ambari-common/src/main/python/ambari_commons/os_check.py

@@ -18,6 +18,7 @@ See the License for the specific language governing permissions and
 limitations under the License.
 '''
 
+import re
 import os
 import sys
 import platform
@@ -81,6 +82,21 @@ def _is_oracle_linux():
 def _is_redhat_linux():
   return _IS_REDHAT_LINUX
 
+def advanced_check(distribution):
+  distribution = list(distribution)
+  if os.path.exists("/etc/issue"):
+    with open("/etc/issue", "rb") as fp:
+      issue_content = fp.read()
+  
+    if "Amazon" in issue_content:
+      distribution[0] = "amazon"
+      search_groups = re.search('(\d+)\.(\d+)', issue_content)
+      
+      if search_groups:
+        distribution[1] = search_groups.group(1) # if version is 2015.09 only get 2015.
+      
+  return tuple(distribution)
+    
 
 class OS_CONST_TYPE(type):
 
@@ -167,10 +183,15 @@ class OSCheck:
         distribution = platform.dist()
       else:
         distribution = platform.linux_distribution()
+        
+    
 
-    if distribution[0] == '' and platform.system().lower() == 'darwin':
-      # mac - used for unit tests
-      distribution = ("Darwin", "TestOnly", "1.1.1", "1.1.1", "1.1")
+    if distribution[0] == '':
+      distribution = advanced_check(distribution)
+    
+      if platform.system().lower() == 'darwin':
+        # mac - used for unit tests
+        distribution = ("Darwin", "TestOnly", "1.1.1", "1.1.1", "1.1")
     
     return distribution
 

+ 9 - 1
ambari-common/src/main/python/ambari_commons/resources/os_family.json

@@ -6,7 +6,6 @@
       "centos",
       "oraclelinux",
       "ascendos",
-      "amazon",
       "xenserver",
       "oel",
       "ovs",
@@ -21,6 +20,15 @@
       7
     ]
   },
+  "amazon": {
+    "extends" : "redhat",
+    "distro": [
+      "amazon"
+    ],
+    "versions": [
+      2015
+    ]
+  },
   "debian": {
     "extends" : "ubuntu",
     "distro": [

+ 3 - 0
ambari-common/src/main/python/resource_management/core/providers/__init__.py

@@ -41,6 +41,9 @@ class Provider(object):
 
 
 PROVIDERS = dict(
+  amazon=dict(
+    Package="resource_management.core.providers.package.yumrpm.YumProvider",
+  ),
   redhat=dict(
     Package="resource_management.core.providers.package.yumrpm.YumProvider",
   ),

+ 3 - 0
ambari-common/src/main/python/resource_management/libraries/providers/__init__.py

@@ -21,6 +21,9 @@ Ambari Agent
 """
 
 PROVIDERS = dict(
+  amazon=dict(
+    Repository="resource_management.libraries.providers.repository.RhelSuseRepositoryProvider",
+  ),
   redhat=dict(
     Repository="resource_management.libraries.providers.repository.RhelSuseRepositoryProvider",
   ),

+ 4 - 4
ambari-common/src/main/unix/ambari-python-wrap

@@ -24,14 +24,14 @@ if [ -a /usr/bin/python2 ] && [ -z "$PYTHON" ]; then
   PYTHON=/usr/bin/python2
 fi
 
-if [ -a /usr/bin/python2.6 ] && [ -z "$PYTHON" ]; then
-  PYTHON=/usr/bin/python2.6
-fi
-
 if [ -a /usr/bin/python2.7 ] && [ -z "$PYTHON" ]; then
   PYTHON=/usr/bin/python2.7
 fi
 
+if [ -a /usr/bin/python2.6 ] && [ -z "$PYTHON" ]; then
+  PYTHON=/usr/bin/python2.6
+fi
+
 # if no preferable python versions found, try to use system one. Hoping it's Python 2
 if [[ -z "$PYTHON" ]]; then
   PYTHON=/usr/bin/python

+ 2 - 2
ambari-funtest/src/test/resources/stacks/HDP/2.0.1/services/GANGLIA/metainfo.xml

@@ -59,7 +59,7 @@
           </packages>
         </osSpecific>
         <osSpecific>
-          <osFamily>redhat5,redhat6,suse11</osFamily>
+          <osFamily>redhat5,amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>libganglia-3.5.0-99</name>
@@ -113,7 +113,7 @@
           </packages>
         </osSpecific>
         <osSpecific>
-          <osFamily>redhat5,redhat6</osFamily>
+          <osFamily>redhat5,amazon2015,redhat6</osFamily>
           <packages>
             <package>
               <name>httpd</name>

+ 1 - 1
ambari-funtest/src/test/resources/stacks/HDP/2.0.1/services/HDFS/metainfo.xml

@@ -94,7 +94,7 @@
         </osSpecific>
 
         <osSpecific>
-          <osFamily>redhat5,redhat6,suse11</osFamily>
+          <osFamily>redhat5,amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>snappy</name>

+ 2 - 2
ambari-funtest/src/test/resources/stacks/HDP/2.0.1/services/HIVE/metainfo.xml

@@ -115,7 +115,7 @@
           </packages>
         </osSpecific>
         <osSpecific>
-          <osFamily>redhat5,redhat6,suse11</osFamily>
+          <osFamily>redhat5,amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>mysql</name>
@@ -123,7 +123,7 @@
           </packages>
         </osSpecific>
         <osSpecific>
-          <osFamily>redhat5,redhat6,ubuntu12</osFamily>
+          <osFamily>redhat5,amazon2015,redhat6,ubuntu12</osFamily>
           <packages>
             <package>
               <name>mysql-server</name>

+ 1 - 1
ambari-funtest/src/test/resources/stacks/HDP/2.0.1/services/OOZIE/metainfo.xml

@@ -102,7 +102,7 @@
         </osSpecific>
 
         <osSpecific>
-          <osFamily>redhat5,redhat6,suse11</osFamily>
+          <osFamily>redhat5,amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>extjs-2.2-1</name>

+ 2 - 2
ambari-funtest/src/test/resources/stacks/HDP/2.0.5/services/GANGLIA/metainfo.xml

@@ -60,7 +60,7 @@
           </packages>
         </osSpecific>
         <osSpecific>
-          <osFamily>redhat5,redhat6,suse11</osFamily>
+          <osFamily>redhat5,amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>libganglia-3.5.0-99</name>
@@ -114,7 +114,7 @@
           </packages>
         </osSpecific>
         <osSpecific>
-          <osFamily>redhat5,redhat6</osFamily>
+          <osFamily>redhat5,amazon2015,redhat6</osFamily>
           <packages>
             <package>
               <name>httpd</name>

+ 1 - 1
ambari-funtest/src/test/resources/stacks/HDP/2.0.5/services/HDFS/metainfo.xml

@@ -132,7 +132,7 @@
         </osSpecific>
 
         <osSpecific>
-          <osFamily>redhat5,redhat6,suse11</osFamily>
+          <osFamily>redhat5,amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>snappy</name>

+ 2 - 2
ambari-funtest/src/test/resources/stacks/HDP/2.0.5/services/HIVE/metainfo.xml

@@ -220,7 +220,7 @@
           </packages>
         </osSpecific>
         <osSpecific>
-          <osFamily>redhat5,redhat6,suse11</osFamily>
+          <osFamily>redhat5,amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>mysql</name>
@@ -228,7 +228,7 @@
           </packages>
         </osSpecific>
         <osSpecific>
-          <osFamily>redhat5,redhat6,ubuntu12</osFamily>
+          <osFamily>redhat5,amazon2015,redhat6,ubuntu12</osFamily>
           <packages>
             <package>
               <name>mysql-server</name>

+ 1 - 1
ambari-funtest/src/test/resources/stacks/HDP/2.0.5/services/OOZIE/metainfo.xml

@@ -102,7 +102,7 @@
         </osSpecific>
 
         <osSpecific>
-          <osFamily>redhat5,redhat6,suse11</osFamily>
+          <osFamily>redhat5,amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>extjs-2.2-1</name>

+ 2 - 2
ambari-funtest/src/test/resources/stacks/HDP/2.0.7/services/HIVE/metainfo.xml

@@ -134,7 +134,7 @@
           </packages>
         </osSpecific>
         <osSpecific>
-          <osFamily>redhat5,redhat6,suse11</osFamily>
+          <osFamily>redhat5,amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>mysql</name>
@@ -142,7 +142,7 @@
           </packages>
         </osSpecific>
         <osSpecific>
-          <osFamily>redhat5,redhat6,ubuntu12</osFamily>
+          <osFamily>redhat5,amazon2015,redhat6,ubuntu12</osFamily>
           <packages>
             <package>
               <name>mysql-server</name>

+ 1 - 1
ambari-funtest/src/test/resources/stacks/HDP/2.1.1/services/AMBARI_METRICS/metainfo.xml

@@ -65,7 +65,7 @@
 
       <osSpecifics>
         <osSpecific>
-          <osFamily>redhat5,redhat6,suse11</osFamily>
+          <osFamily>redhat5,amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>ambari-metrics-collector</name>

+ 1 - 0
ambari-server/conf/unix/ambari-env.sh

@@ -17,6 +17,7 @@
 AMBARI_PASSHPHRASE="DEV"
 export AMBARI_JVM_ARGS=$AMBARI_JVM_ARGS' -Xms512m -Xmx2048m -Djava.security.auth.login.config=/etc/ambari-server/conf/krb5JAASLogin.conf -Djava.security.krb5.conf=/etc/krb5.conf -Djavax.security.auth.useSubjectCredsOnly=false'
 export PATH=$PATH:/var/lib/ambari-server
+export PYTHONPATH=$PYTHONPATH:/usr/lib/python2.6/site-packages
 
 # customize python binary for ambari
 # export PYTHON=/usr/bin/python2

+ 20 - 4
ambari-server/conf/unix/install-helper.sh

@@ -32,7 +32,6 @@ JINJA_SERVER_DIR="${ROOT}/usr/lib/ambari-server/lib/ambari_jinja2"
 SIMPLEJSON_SERVER_DIR="${ROOT}/usr/lib/ambari-server/lib/ambari_simplejson"
 
 PYTHON_WRAPER_TARGET="${ROOT}/usr/bin/ambari-python-wrap"
-PYTHON_WRAPER_SOURCE="${ROOT}/var/lib/ambari-server/ambari-python-wrap"
 
 AMBARI_SERVER_EXECUTABLE_LINK="${ROOT}/usr/sbin/ambari-server"
 AMBARI_SERVER_EXECUTABLE="${ROOT}/etc/init.d/ambari-server"
@@ -62,9 +61,26 @@ do_install(){
   if [ ! -d "$SIMPLEJSON_DIR" ]; then
     ln -s "$SIMPLEJSON_SERVER_DIR" "$SIMPLEJSON_DIR"
   fi
-  # setting python-wrapper script
-  if [ ! -f "$PYTHON_WRAPER_TARGET" ]; then
-    ln -s "$PYTHON_WRAPER_SOURCE" "$PYTHON_WRAPER_TARGET"
+
+  # remove old python wrapper
+  rm -f "$PYTHON_WRAPER_TARGET"
+
+  AMBARI_PYTHON=""
+  python_binaries=( "/usr/bin/python" "/usr/bin/python2" "/usr/bin/python2.7", "/usr/bin/python2.6" )
+  for python_binary in "${python_binaries[@]}"
+  do
+    $python_binary -c "import sys ; ver = sys.version_info ; sys.exit(not (ver >= (2,6) and ver<(3,0)))" 1>/dev/null 2>/dev/null
+
+    if [ $? -eq 0 ] ; then
+      AMBARI_PYTHON="$python_binary"
+      break;
+    fi
+  done
+
+  if [ -z "$AMBARI_PYTHON" ] ; then
+    >&2 echo "Cannot detect python for ambari to use. Please manually set $PYTHON_WRAPER link to point to correct python binary"
+  else
+    ln -s "$AMBARI_PYTHON" "$PYTHON_WRAPER_TARGET"
   fi
 
   which chkconfig > /dev/null 2>&1

+ 4 - 3
ambari-server/sbin/ambari-server

@@ -37,10 +37,11 @@ esac
 
 export PATH=/usr/lib/ambari-server/*:$PATH:/sbin/:/usr/sbin
 export AMBARI_CONF_DIR=/etc/ambari-server/conf
-PYTHON_WRAP=/var/lib/ambari-server/ambari-python-wrap
+PYTHON_WRAP=/usr/bin/ambari-python-wrap
 
-# fills $PYTHON
-. $PYTHON_WRAP -V 2>/dev/null
+if [ -z "$PYTHON" ] ; then
+  export PYTHON=`readlink $PYTHON_WRAP`
+fi
 
 if [ -a /var/lib/ambari-server/ambari-env.sh ]; then
   . /var/lib/ambari-server/ambari-env.sh

+ 0 - 5
ambari-server/src/main/assemblies/server.xml

@@ -203,11 +203,6 @@
       <source>${basedir}/target/ambari-server</source>
       <outputDirectory>/etc/init.d</outputDirectory>
     </file>
-    <file>
-      <fileMode>755</fileMode>
-      <source>../ambari-common/src/main/unix/ambari-python-wrap</source>
-      <outputDirectory>/var/lib/ambari-server/</outputDirectory>
-    </file>
     <file>
       <source>${ambariProperties}</source>
       <outputDirectory>/etc/ambari-server/conf</outputDirectory>

+ 3 - 2
ambari-server/src/main/python/ambari_server/utils.py

@@ -216,7 +216,7 @@ def get_postgre_hba_dir(OS_FAMILY):
     # Like: /etc/postgresql/9.1/main/
     return os.path.join(get_pg_hba_init_files(), get_ubuntu_pg_version(),
                         "main")
-  elif OSCheck.is_redhat_family() and int(OSCheck.get_os_major_version()) >= 7:
+  elif not glob.glob(get_pg_hba_init_files() + '*'): # this happens when the service file is of new format (/usr/lib/systemd/system/postgresql.service)
     return PG_HBA_ROOT_DEFAULT
   else:
     if not os.path.isfile(get_pg_hba_init_files()):
@@ -224,8 +224,9 @@ def get_postgre_hba_dir(OS_FAMILY):
       os.symlink(glob.glob(get_pg_hba_init_files() + '*')[0],
                  get_pg_hba_init_files())
 
+    pg_hba_init_basename = os.path.basename(get_pg_hba_init_files())
     # Get postgres_data location (default: /var/lib/pgsql/data)
-    cmd = "alias exit=return; source " + get_pg_hba_init_files() + " status &>/dev/null; echo $PGDATA"
+    cmd = "alias basename='echo {0}; true' ; alias exit=return; source {1} status &>/dev/null; echo $PGDATA".format(pg_hba_init_basename, get_pg_hba_init_files())
     p = subprocess.Popen(cmd,
                          stdout=subprocess.PIPE,
                          stdin=subprocess.PIPE,

+ 1 - 1
ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/metainfo.xml

@@ -78,7 +78,7 @@
 
       <osSpecifics>
         <osSpecific>
-          <osFamily>redhat7,redhat6,suse11</osFamily>
+          <osFamily>redhat7,amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>ambari-metrics-collector</name>

+ 2 - 2
ambari-server/src/main/resources/common-services/GANGLIA/3.5.0/metainfo.xml

@@ -55,7 +55,7 @@
       </components>
       <osSpecifics>
         <osSpecific>
-          <osFamily>redhat6,suse11</osFamily>
+          <osFamily>amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>python-rrdtool-1.4.5</name>
@@ -112,7 +112,7 @@
           </packages>
         </osSpecific>
         <osSpecific>
-          <osFamily>redhat6</osFamily>
+          <osFamily>amazon2015,redhat6</osFamily>
           <packages>
             <package>
               <name>httpd</name>

+ 1 - 1
ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/metainfo.xml

@@ -171,7 +171,7 @@
         </osSpecific>
         
         <osSpecific>
-          <osFamily>redhat6,suse11</osFamily>
+          <osFamily>amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>snappy</name>

+ 2 - 2
ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/metainfo.xml

@@ -260,7 +260,7 @@
           </packages>
         </osSpecific>
         <osSpecific>
-          <osFamily>redhat6,suse11</osFamily>
+          <osFamily>amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>mysql</name>
@@ -269,7 +269,7 @@
           </packages>
         </osSpecific>
         <osSpecific>
-          <osFamily>redhat6,debian7,ubuntu12,ubuntu14</osFamily>
+          <osFamily>amazon2015,redhat6,debian7,ubuntu12,ubuntu14</osFamily>
           <packages>
             <package>
               <name>mysql-server</name>

+ 1 - 1
ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/metainfo.xml

@@ -73,7 +73,7 @@
 
       <osSpecifics>
         <osSpecific>
-          <osFamily>redhat7,redhat6</osFamily>
+          <osFamily>redhat7,amazon2015,redhat6</osFamily>
           <packages>
             <package>
               <name>krb5-server</name>

+ 1 - 1
ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/metainfo.xml

@@ -121,7 +121,7 @@
         </osSpecific>
         
        <osSpecific>
-          <osFamily>redhat6,suse11</osFamily>
+          <osFamily>amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>extjs-2.2-1</name>

+ 2 - 2
ambari-server/src/main/resources/stacks/HDP/2.1/services/HIVE/metainfo.xml

@@ -63,7 +63,7 @@
           </packages>
         </osSpecific>
         <osSpecific>
-          <osFamily>redhat6,suse11</osFamily>
+          <osFamily>amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>mysql</name>
@@ -87,7 +87,7 @@
           </packages>
         </osSpecific>
         <osSpecific>
-          <osFamily>redhat6,ubuntu12</osFamily>
+          <osFamily>amazon2015,redhat6,ubuntu12</osFamily>
           <packages>
             <package>
               <name>mysql-server</name>

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/2.1/services/OOZIE/metainfo.xml

@@ -42,7 +42,7 @@
         </osSpecific>
         
         <osSpecific>
-          <osFamily>redhat6,suse11</osFamily>
+          <osFamily>amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>extjs-2.2-1</name>

+ 12 - 0
ambari-server/src/main/resources/stacks/HDP/2.2/repos/repoinfo.xml

@@ -29,6 +29,18 @@
       <reponame>HDP-UTILS</reponame>
     </repo>
   </os>
+  <os family="amazon2015">
+    <repo>
+      <baseurl>http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.2.6.0</baseurl>
+      <repoid>HDP-2.2</repoid>
+      <reponame>HDP</reponame>
+    </repo>
+    <repo>
+      <baseurl>http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos6</baseurl>
+      <repoid>HDP-UTILS-1.1.0.20</repoid>
+      <reponame>HDP-UTILS</reponame>
+    </repo>
+  </os>
   <os family="suse11">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/suse11sp3/2.x/updates/2.2.6.0</baseurl>

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/2.2/services/FALCON/metainfo.xml

@@ -24,7 +24,7 @@
       <version>0.6.0.2.2</version>
       <osSpecifics>
         <osSpecific>
-          <osFamily>redhat7,redhat6,suse11</osFamily>
+          <osFamily>redhat7,amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>falcon_${stack_version}</name>

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/2.2/services/FLUME/metainfo.xml

@@ -26,7 +26,7 @@
 
       <osSpecifics>
         <osSpecific>
-          <osFamily>redhat7,redhat6,suse11</osFamily>
+          <osFamily>redhat7,amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>flume_${stack_version}</name>

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/2.2/services/HBASE/metainfo.xml

@@ -25,7 +25,7 @@
 
       <osSpecifics>
         <osSpecific>
-          <osFamily>redhat7,redhat6,suse11</osFamily>
+          <osFamily>redhat7,amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>hbase_${stack_version}</name>

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/2.2/services/HDFS/metainfo.xml

@@ -25,7 +25,7 @@
 
       <osSpecifics>
         <osSpecific>
-          <osFamily>redhat6,suse11</osFamily>
+          <osFamily>amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>hadoop_${stack_version}</name>

+ 3 - 3
ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/metainfo.xml

@@ -68,7 +68,7 @@
           </packages>
         </osSpecific>
         <osSpecific>
-          <osFamily>redhat6,redhat7,suse11</osFamily>
+          <osFamily>amazon2015,redhat6,redhat7,suse11</osFamily>
           <packages>
             <package>
               <name>hive_${stack_version}</name>
@@ -82,7 +82,7 @@
           </packages>
         </osSpecific>
         <osSpecific>
-          <osFamily>redhat6,suse11</osFamily>
+          <osFamily>amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>mysql</name>
@@ -120,7 +120,7 @@
           </packages>
         </osSpecific>
         <osSpecific>
-          <osFamily>redhat6,ubuntu12</osFamily>
+          <osFamily>amazon2015,redhat6,ubuntu12</osFamily>
           <packages>
             <package>
               <name>mysql-server</name>

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/2.2/services/KAFKA/metainfo.xml

@@ -23,7 +23,7 @@
       <extends>common-services/KAFKA/0.8.1.2.2</extends>
       <osSpecifics>
         <osSpecific>
-          <osFamily>redhat7,redhat6,suse11</osFamily>
+          <osFamily>redhat7,amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>kafka_${stack_version}</name>

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/2.2/services/KNOX/metainfo.xml

@@ -23,7 +23,7 @@
       <extends>common-services/KNOX/0.5.0.2.2</extends>
       <osSpecifics>
         <osSpecific>
-          <osFamily>redhat7,redhat6,suse11</osFamily>
+          <osFamily>redhat7,amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>knox_${stack_version}</name>

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/2.2/services/OOZIE/metainfo.xml

@@ -75,7 +75,7 @@
           </packages>
         </osSpecific>
         <osSpecific>
-          <osFamily>redhat5,redhat6,redhat7,suse11</osFamily>
+          <osFamily>redhat5,amazon2015,redhat6,redhat7,suse11</osFamily>
           <packages>
             <package>
               <name>oozie_${stack_version}</name>

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/2.2/services/PIG/metainfo.xml

@@ -24,7 +24,7 @@
       <version>0.14.0.2.2</version>
       <osSpecifics>
         <osSpecific>
-          <osFamily>redhat6,suse11</osFamily>
+          <osFamily>amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>pig_${stack_version}</name>

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/2.2/services/RANGER/metainfo.xml

@@ -32,7 +32,7 @@
       </themes>
       <osSpecifics>
         <osSpecific>
-          <osFamily>redhat7,redhat6,suse11</osFamily>
+          <osFamily>redhat7,amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>ranger_${stack_version}-admin</name>

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/2.2/services/SLIDER/metainfo.xml

@@ -23,7 +23,7 @@
       <extends>common-services/SLIDER/0.60.0.2.2</extends>
       <osSpecifics>
         <osSpecific>
-          <osFamily>redhat7,redhat6,suse11</osFamily>
+          <osFamily>redhat7,amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>slider_${stack_version}</name>

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/2.2/services/SPARK/metainfo.xml

@@ -27,7 +27,7 @@
       <version>1.2.1.2.2</version>
       <osSpecifics>
         <osSpecific>
-          <osFamily>redhat7,redhat6,suse11</osFamily>
+          <osFamily>redhat7,amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>spark_${stack_version}</name>

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/2.2/services/SQOOP/metainfo.xml

@@ -33,7 +33,7 @@
           </packages>
         </osSpecific>
         <osSpecific>
-          <osFamily>redhat7,redhat6,suse11</osFamily>
+          <osFamily>redhat7,amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>sqoop_${stack_version}</name>

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/2.2/services/STORM/metainfo.xml

@@ -31,7 +31,7 @@
       </components>
       <osSpecifics>
         <osSpecific>
-          <osFamily>redhat7,redhat6,suse11</osFamily>
+          <osFamily>redhat7,amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>storm_${stack_version}</name>

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/2.2/services/TEZ/metainfo.xml

@@ -25,7 +25,7 @@
 
       <osSpecifics>
         <osSpecific>
-          <osFamily>redhat7,redhat6,suse11</osFamily>
+          <osFamily>redhat7,amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>tez_${stack_version}</name>

+ 2 - 2
ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/metainfo.xml

@@ -32,7 +32,7 @@
       
       <osSpecifics>
         <osSpecific>
-          <osFamily>redhat6,suse11</osFamily>
+          <osFamily>amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>hadoop_${stack_version}-yarn</name>
@@ -72,7 +72,7 @@
       <version>2.6.0.2.2</version>
       <osSpecifics>
         <osSpecific>
-          <osFamily>redhat6,suse11</osFamily>
+          <osFamily>amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>hadoop_${stack_version}-mapreduce</name>

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/2.3.ECS/services/ZOOKEEPER/metainfo.xml

@@ -23,7 +23,7 @@
       <version>3.4.6.2.3</version>
       <osSpecifics>
         <osSpecific>
-          <osFamily>redhat7,redhat6,suse11</osFamily>
+          <osFamily>redhat7,amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>zookeeper_2_3_*</name>

+ 12 - 0
ambari-server/src/main/resources/stacks/HDP/2.3/repos/repoinfo.xml

@@ -41,6 +41,18 @@
       <reponame>HDP-UTILS</reponame>
     </repo>
   </os>
+  <os family="amazon2015">
+    <repo>
+      <baseurl>http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.3.0.0</baseurl>
+      <repoid>HDP-2.3</repoid>
+      <reponame>HDP</reponame>
+    </repo>
+    <repo>
+      <baseurl>http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos6</baseurl>
+      <repoid>HDP-UTILS-1.1.0.20</repoid>
+      <reponame>HDP-UTILS</reponame>
+    </repo>
+  </os>
   <os family="suse11">
     <repo>
       <baseurl>http://public-repo-1.hortonworks.com/HDP/suse11sp3/2.x/updates/2.3.0.0</baseurl>

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/2.3/services/ACCUMULO/metainfo.xml

@@ -24,7 +24,7 @@
       <version>1.7.0.2.3</version>
       <osSpecifics>
         <osSpecific>
-          <osFamily>redhat7,redhat6,suse11</osFamily>
+          <osFamily>redhat7,amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>accumulo_${stack_version}</name>

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/2.3/services/ATLAS/metainfo.xml

@@ -24,7 +24,7 @@
       <version>0.5.0.2.3</version>
       <osSpecifics>
         <osSpecific>
-          <osFamily>redhat7,redhat6,suse11</osFamily>
+          <osFamily>redhat7,amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>atlas-metadata_${stack_version}</name>

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/2.3/services/HDFS/metainfo.xml

@@ -56,7 +56,7 @@
           </packages>
         </osSpecific>
         <osSpecific>
-          <osFamily>redhat7,redhat6,suse11</osFamily>
+          <osFamily>redhat7,amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>hadoop_${stack_version}</name>

+ 3 - 3
ambari-server/src/main/resources/stacks/HDP/2.3/services/HIVE/metainfo.xml

@@ -34,7 +34,7 @@
           </packages>
         </osSpecific>
         <osSpecific>
-          <osFamily>redhat7,redhat6,suse11</osFamily>
+          <osFamily>redhat7,amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>hive_${stack_version}</name>
@@ -52,7 +52,7 @@
           </packages>
         </osSpecific>
         <osSpecific>
-          <osFamily>redhat6,suse11</osFamily>
+          <osFamily>amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>mysql</name>
@@ -95,7 +95,7 @@
           </packages>
         </osSpecific>
         <osSpecific>
-          <osFamily>redhat6,debian7,ubuntu12,ubuntu14</osFamily>
+          <osFamily>amazon2015,redhat6,debian7,ubuntu12,ubuntu14</osFamily>
           <packages>
             <package>
               <name>mysql-server</name>

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/2.3/services/OOZIE/metainfo.xml

@@ -46,7 +46,7 @@
           </packages>
         </osSpecific>
         <osSpecific>
-          <osFamily>redhat5,redhat6,redhat7,suse11</osFamily>
+          <osFamily>redhat5,amazon2015,redhat6,redhat7,suse11</osFamily>
           <packages>
             <package>
               <name>oozie_${stack_version}</name>

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/2.3/services/PIG/metainfo.xml

@@ -23,7 +23,7 @@
       <version>0.15.0.2.3</version>
       <osSpecifics>
         <osSpecific>
-          <osFamily>redhat7,redhat6,suse11</osFamily>
+          <osFamily>redhat7,amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>pig_${stack_version}</name>

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/2.3/services/RANGER_KMS/metainfo.xml

@@ -26,7 +26,7 @@
       <extends>common-services/RANGER_KMS/0.5.0.2.3</extends>
       <osSpecifics>
         <osSpecific>
-          <osFamily>redhat7,redhat6,suse11</osFamily>
+          <osFamily>redhat7,amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>ranger_${stack_version}-kms</name>

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/2.3/services/ZOOKEEPER/metainfo.xml

@@ -23,7 +23,7 @@
       <version>3.4.6.2.3</version>
       <osSpecifics>
         <osSpecific>
-          <osFamily>redhat6,suse11</osFamily>
+          <osFamily>amazon2015,redhat6,suse11</osFamily>
           <packages>
             <package>
               <name>zookeeper_${stack_version}</name>

+ 12 - 0
ambari-server/src/main/resources/stacks/HDP/2.4/repos/repoinfo.xml

@@ -41,6 +41,18 @@
       <reponame>HDP-UTILS</reponame>
     </repo>
   </os>
+  <os family="redhat2015">
+    <repo>
+      <baseurl>http://s3.amazonaws.com/dev.hortonworks.com/HDP/centos6/2.x/updates/2.4.0.0</baseurl>
+      <repoid>HDP-2.4</repoid>
+      <reponame>HDP</reponame>
+    </repo>
+    <repo>
+      <baseurl>http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos6</baseurl>
+      <repoid>HDP-UTILS-1.1.0.20</repoid>
+      <reponame>HDP-UTILS</reponame>
+    </repo>
+  </os>
   <os family="suse11">
     <repo>
       <baseurl>http://s3.amazonaws.com/dev.hortonworks.com/HDP/suse11sp3/2.x/updates/2.4.0.0</baseurl>