Browse Source

AMBARI-4385. Unable to install using EC2 RHAT 6.4 AMI (aonishuk)

Andrew Onischuk 11 năm trước cách đây
mục cha
commit
d48edfaa0f
32 tập tin đã thay đổi với 136 bổ sung138 xóa
  1. 2 11
      ambari-agent/src/main/python/resource_management/core/providers/__init__.py
  2. 88 74
      ambari-agent/src/main/python/resource_management/core/system.py
  3. 0 6
      ambari-agent/src/main/python/resource_management/libraries/providers/__init__.py
  4. 1 1
      ambari-agent/src/main/python/resource_management/libraries/providers/monitor_webserver.py
  5. 2 3
      ambari-agent/src/main/python/resource_management/libraries/providers/repository.py
  6. 1 1
      ambari-agent/src/test/python/resource_management/TestContentSources.py
  7. 1 1
      ambari-agent/src/test/python/resource_management/TestExecuteResource.py
  8. 1 1
      ambari-agent/src/test/python/resource_management/TestFileResource.py
  9. 1 1
      ambari-agent/src/test/python/resource_management/TestGroupResource.py
  10. 1 1
      ambari-agent/src/test/python/resource_management/TestLinkResource.py
  11. 6 6
      ambari-agent/src/test/python/resource_management/TestMonitorWebserverResource.py
  12. 5 5
      ambari-agent/src/test/python/resource_management/TestPackageResource.py
  13. 1 1
      ambari-agent/src/test/python/resource_management/TestUserResource.py
  14. 1 1
      ambari-server/src/main/resources/stacks/HDP/1.3.3/hooks/before-START/scripts/params.py
  15. 1 1
      ambari-server/src/main/resources/stacks/HDP/1.3.3/services/GANGLIA/package/scripts/params.py
  16. 1 1
      ambari-server/src/main/resources/stacks/HDP/1.3.3/services/HDFS/package/scripts/params.py
  17. 1 1
      ambari-server/src/main/resources/stacks/HDP/1.3.3/services/HIVE/package/scripts/mysql_server.py
  18. 1 1
      ambari-server/src/main/resources/stacks/HDP/1.3.3/services/NAGIOS/package/scripts/nagios.py
  19. 1 1
      ambari-server/src/main/resources/stacks/HDP/1.3.3/services/NAGIOS/package/scripts/nagios_server_config.py
  20. 1 1
      ambari-server/src/main/resources/stacks/HDP/1.3.3/services/NAGIOS/package/scripts/params.py
  21. 1 1
      ambari-server/src/main/resources/stacks/HDP/1.3.3/services/NAGIOS/package/templates/hadoop-commands.cfg.j2
  22. 5 5
      ambari-server/src/main/resources/stacks/HDP/1.3.3/services/NAGIOS/package/templates/hadoop-services.cfg.j2
  23. 1 1
      ambari-server/src/main/resources/stacks/HDP/2.1.1/hooks/before-START/scripts/params.py
  24. 1 1
      ambari-server/src/main/resources/stacks/HDP/2.1.1/services/GANGLIA/package/scripts/params.py
  25. 1 1
      ambari-server/src/main/resources/stacks/HDP/2.1.1/services/HDFS/package/scripts/params.py
  26. 1 1
      ambari-server/src/main/resources/stacks/HDP/2.1.1/services/HIVE/package/scripts/mysql_server.py
  27. 1 1
      ambari-server/src/main/resources/stacks/HDP/2.1.1/services/NAGIOS/package/scripts/nagios.py
  28. 1 1
      ambari-server/src/main/resources/stacks/HDP/2.1.1/services/NAGIOS/package/scripts/nagios_server_config.py
  29. 1 1
      ambari-server/src/main/resources/stacks/HDP/2.1.1/services/NAGIOS/package/scripts/params.py
  30. 1 1
      ambari-server/src/main/resources/stacks/HDP/2.1.1/services/NAGIOS/package/templates/hadoop-commands.cfg.j2
  31. 4 4
      ambari-server/src/main/resources/stacks/HDP/2.1.1/services/NAGIOS/package/templates/hadoop-services.cfg.j2
  32. 1 1
      ambari-server/src/test/resources/stacks/HDP/2.0.7/services/HIVE/package/scripts/mysql_server.py

+ 2 - 11
ambari-agent/src/main/python/resource_management/core/providers/__init__.py

@@ -46,18 +46,9 @@ PROVIDERS = dict(
   redhat=dict(
     Package="resource_management.core.providers.package.yumrpm.YumProvider",
   ),
-  centos=dict(
-    Package="resource_management.core.providers.package.yumrpm.YumProvider",
-  ),
   suse=dict(
     Package="resource_management.core.providers.package.zypper.ZypperProvider",
   ),
-  fedora=dict(
-    Package="resource_management.core.providers.package.yumrpm.YumProvider",
-  ),
-  amazon=dict(
-    Package="resource_management.core.providers.package.yumrpm.YumProvider",
-  ),
   default=dict(
     File="resource_management.core.providers.system.FileProvider",
     Directory="resource_management.core.providers.system.DirectoryProvider",
@@ -76,8 +67,8 @@ 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.platform]:
-        class_path = provider[env.system.platform][resource]
+      if resource in provider[env.system.os_family]:
+        class_path = provider[env.system.os_family][resource]
         break
       if resource in provider["default"]:
         class_path = provider["default"][resource]

+ 88 - 74
ambari-agent/src/main/python/resource_management/core/system.py

@@ -24,7 +24,9 @@ __all__ = ["System"]
 
 import os
 import sys
+import platform
 from resource_management.core import shell
+from resource_management.core.exceptions import Fail
 from functools import wraps
 
 def lazy_property(undecorated):
@@ -45,90 +47,80 @@ def lazy_property(undecorated):
 class System(object):
   @lazy_property
   def os(self):
+    """
+    Return values:
+    linux, unknown
+    
+    In case cannot detect raises 'unknown'
+    """
     platform = sys.platform
     if platform.startswith('linux'):
       return "linux"
-    elif platform == "darwin":
-      return "darwin"
     else:
       return "unknown"
-
-  def unquote(self, val):
-    if val[0] == '"':
-      val = val[1:-1]
-    return val
-
-  @lazy_property
-  def arch(self):
-    machine = self.machine
-    if machine in ("i386", "i486", "i686"):
-      return "x86_32"
-    return machine
-
+    
   @lazy_property
-  def machine(self):
-    code, out = shell.call(["/bin/uname", "-m"])
-    return out.strip()
-
+  def os_version(self):
+    """
+    Example return value:
+    "6.3" for "Centos 6.3"
+    
+    In case cannot detect raises 'unknown'
+    """
+    dist = platform.linux_distribution()
+    if dist[1] != '':
+      return dist[1]
+    else:
+      return 'unknown'
+    
   @lazy_property
-  def lsb(self):
-    if os.path.exists("/usr/bin/lsb_release"):
-      code, out = shell.call(["/usr/bin/lsb_release", "-a"])
-      lsb = {}
-      for l in out.split('\n'):
-        v = l.split(':', 1)
-        if len(v) != 2:
-          continue
-        lsb[v[0].strip().lower()] = self.unquote(v[1].strip().lower())
-      
-      # failsafe
-      if not 'distributor id' in lsb:
-        return None
-        
-      lsb['id'] = lsb.pop('distributor id')
-      return lsb
+  def os_type(self):
+    """
+    Return values:
+    redhat, fedora, centos, oraclelinux, ascendos,
+    amazon, xenserver, oel, ovs, cloudlinux, slc, scientific, psbm,
+    ubuntu, debian, sles, sled, opensuse, suse ... and others
+    
+    In case cannot detect raises exception.
+    """
+    dist = platform.linux_distribution()
+    operatingSystem = dist[0].lower()
+
+    # special cases
+    if os.path.exists('/etc/oracle-release'):
+      return 'oraclelinux'
+    elif operatingSystem.startswith('suse linux enterprise server'):
+      return 'sles'
+    elif operatingSystem.startswith('red hat enterprise linux server'):
+      return 'redhat'
+    
+    # in general
+    if operatingSystem:
+      return operatingSystem
+    else:
+      raise Fail("Cannot detect os type")
     
-    return None
-
   @lazy_property
-  def platform(self):
-    operatingsystem = self.os
-    if operatingsystem == "linux":
-      lsb = self.lsb
-      if not lsb:
-        if os.path.exists("/etc/fedora-release"):
-          return "fedora"
-        if os.path.exists("/etc/centos-release"):
-          return "centos"
-        if os.path.exists("/etc/oracle-release"):
-          return "oracle"        
-        if os.path.exists("/etc/redhat-release"):
-          with file('/etc/redhat-release') as f:
-           release = f.read().lower() 
-           if 'centos' in release:
-             return 'centos'
-           elif 'fedora' in release:
-             return 'fedora'
-          return 'redhat'
-        if os.path.exists("/etc/SuSE-release"):
-          return "suse"
-        if os.path.exists("/etc/system-release"):
-          with open("/etc/system-release", "rb") as fp:
-            release = fp.read()
-          if "Amazon Linux" in release:
-            return "amazon"
-        return "unknown"
+  def os_family(self):
+    """
+    Return values:
+    redhat, debian, suse
+    
+    In case cannot detect raises exception
+    """
+    os_type = self.os_type
+    if os_type in ['redhat', 'centos', 'fedora', 'oraclelinux', 'ascendos',
+                     'amazon', 'xenserver', 'oel', 'ovs', 'cloudlinux',
+                     'slc', 'scientific', 'psbm']:
+      os_family = 'redhat'
+    elif os_type in ['ubuntu', 'debian']:
+      os_family = 'debian'
+    elif os_type in ['sles', 'sled', 'opensuse', 'suse']:
+      os_family = 'suse'
+    else:
+      raise Fail("Cannot detect os family for os: {0}".format(os_type))
       
-      lsb_id = lsb['id'].lower()
-      if lsb_id =="suse linux":
-        return "suse"
-      return lsb_id
-    return "unknown"
-
-  @lazy_property
-  def locales(self):
-    code, out = shell.call("locale -a")
-    return out.strip().split("\n")
+    return os_family
 
   @lazy_property
   def ec2(self):
@@ -148,6 +140,23 @@ class System(object):
     elif os.path.exists("/proc/xen"):
       return "xen"
     return None
+  
+  @lazy_property
+  def arch(self):
+    machine = self.machine
+    if machine in ("i386", "i486", "i686"):
+      return "x86_32"
+    return machine
+
+  @lazy_property
+  def machine(self):
+    code, out = shell.call(["/bin/uname", "-m"])
+    return out.strip()
+
+  @lazy_property
+  def locales(self):
+    code, out = shell.call("locale -a")
+    return out.strip().split("\n")
 
   @classmethod
   def get_instance(cls):
@@ -156,3 +165,8 @@ class System(object):
     except AttributeError:
       cls._instance = cls()
     return cls._instance
+  
+  def unquote(self, val):
+    if val[0] == '"':
+      val = val[1:-1]
+    return val

+ 0 - 6
ambari-agent/src/main/python/resource_management/libraries/providers/__init__.py

@@ -23,14 +23,8 @@ Ambari Agent
 PROVIDERS = dict(
   redhat=dict(
   ),
-  centos=dict(
-  ),
   suse=dict(
   ),
-  fedora=dict(
-  ),
-  amazon=dict(
-  ),
   default=dict(
     ExecuteHadoop="resource_management.libraries.providers.execute_hadoop.ExecuteHadoopProvider",
     TemplateConfig="resource_management.libraries.providers.template_config.TemplateConfigProvider",

+ 1 - 1
ambari-agent/src/main/python/resource_management/libraries/providers/monitor_webserver.py

@@ -42,7 +42,7 @@ class MonitorWebserverProvider(Provider):
 
   def get_serivice_params(self):
     self.system = System.get_instance()
-    if self.system.platform == "suse":
+    if self.system.os_family == "suse":
       self.service_name = "apache2"
       self.httpd_conf_dir = '/etc/apache2'
     else:

+ 2 - 3
ambari-agent/src/main/python/resource_management/libraries/providers/repository.py

@@ -26,7 +26,7 @@ class RepositoryProvider(Provider):
   def action_create(self):
     with Environment.get_instance_copy() as env:
       repo_file_name = self.resource.repo_file_name
-      repo_dir = repos_dirs[env.system.platform]
+      repo_dir = repos_dirs[env.system.os_family]
       
       File(format("{repo_dir}/{repo_file_name}.repo"),
         content = InlineTemplate("""[{{repo_id}}]
@@ -40,14 +40,13 @@ gpgcheck=0""", repo_id=self.resource.repo_id, repo_file_name=self.resource.repo_
   def action_remove(self):
     with Environment.get_instance_copy() as env:
       repo_file_name = self.resource.repo_file_name
-      repo_dir = repos_dirs[env.system.platform]
+      repo_dir = repos_dirs[env.system.os_family]
         
       File(format("{repo_dir}/{repo_file_name}.repo"),
            action = "delete")
     
   
 repos_dirs = {
-  'centos': '/etc/yum.repos.d',
   'redhat': '/etc/yum.repos.d',
   'suse': '/etc/zypp/repos.d'
 }

+ 1 - 1
ambari-agent/src/test/python/resource_management/TestContentSources.py

@@ -32,7 +32,7 @@ import urllib2
 import os
 
 
-@patch.object(System, "platform", new = 'redhat')
+@patch.object(System, "os_family", new = 'redhat')
 class TestContentSources(TestCase):
 
   @patch("__builtin__.open")

+ 1 - 1
ambari-agent/src/test/python/resource_management/TestExecuteResource.py

@@ -31,7 +31,7 @@ import grp
 import pwd
 
 
-@patch.object(System, "platform", new='redhat')
+@patch.object(System, "os_family", new='redhat')
 class TestExecuteResource(TestCase):
   @patch.object(logging.Logger, "info")
   @patch.object(subprocess, "Popen")

+ 1 - 1
ambari-agent/src/test/python/resource_management/TestFileResource.py

@@ -28,7 +28,7 @@ import resource_management.core.providers.system
 import resource_management
 
 
-@patch.object(System, "platform", new = 'redhat')
+@patch.object(System, "os_family", new = 'redhat')
 class TestFileResource(TestCase):
   @patch.object(os.path, "dirname")
   @patch.object(os.path, "isdir")

+ 1 - 1
ambari-agent/src/test/python/resource_management/TestGroupResource.py

@@ -26,7 +26,7 @@ import subprocess
 import grp
 
 
-@patch.object(System, "platform", new = 'redhat')
+@patch.object(System, "os_family", new = 'redhat')
 class TestGroupResource(TestCase):
 
   @patch.object(grp, "getgrnam")

+ 1 - 1
ambari-agent/src/test/python/resource_management/TestLinkResource.py

@@ -25,7 +25,7 @@ from resource_management.core.resources.system import Link
 
 import os
 
-@patch.object(System, "platform", new = 'redhat')
+@patch.object(System, "os_family", new = 'redhat')
 class TestLinkResource(TestCase):
 
   @patch.object(os.path, "realpath")

+ 6 - 6
ambari-agent/src/test/python/resource_management/TestMonitorWebserverResource.py

@@ -26,8 +26,8 @@ from resource_management.libraries.resources.monitor_webserver\
 
 
 class TestMonitorWebserverResource(TestCase):
-  @patch.object(System, "platform", new='centos')
-  def test_setup_centos(self):
+  @patch.object(System, "os_family", new='redhat')
+  def test_setup_redhat(self):
     with Environment(test_mode=True) as env:
       MonitorWebserverProvider(MonitorWebserver("start")).action_start()
     defined_resources = env.resource_list
@@ -38,7 +38,7 @@ class TestMonitorWebserverResource(TestCase):
                          " Execute['/etc/init.d/httpd start']]"
     self.assertEqual(str(defined_resources), expected_resources)
 
-  @patch.object(System, "platform", new='suse')
+  @patch.object(System, "os_family", new='suse')
   def test_setup_suse(self):
     with Environment(test_mode=True) as env:
       MonitorWebserverProvider(MonitorWebserver("start")).action_start()
@@ -50,8 +50,8 @@ class TestMonitorWebserverResource(TestCase):
                          " Execute['/etc/init.d/apache2 start']]"
     self.assertEqual(str(defined_resources), expected_resources)
 
-  @patch.object(System, "platform", new='centos')
-  def test_stop_centos(self):
+  @patch.object(System, "os_family", new='redhat')
+  def test_stop_redhat(self):
     with Environment(test_mode=True) as env:
       MonitorWebserverProvider(MonitorWebserver("stop")).action_stop()
     defined_resources = env.resource_list
@@ -59,7 +59,7 @@ class TestMonitorWebserverResource(TestCase):
                          "Execute['/etc/init.d/httpd stop']]"
     self.assertEqual(str(defined_resources), expected_resources)
 
-  @patch.object(System, "platform", new='suse')
+  @patch.object(System, "os_family", new='suse')
   def test_stop_suse(self):
     with Environment(test_mode=True) as env:
       MonitorWebserverProvider(MonitorWebserver("stop")).action_stop()

+ 5 - 5
ambari-agent/src/test/python/resource_management/TestPackageResource.py

@@ -28,7 +28,7 @@ from resource_management.core import shell
 class TestPackageResource(TestCase):
 
   @patch.object(shell, "checked_call")
-  @patch.object(System, "platform", new = 'redhat')
+  @patch.object(System, "os_family", new = 'redhat')
   def test_action_install_rhel(self, shell_mock):     
     with Environment('/') as env:
       Package("some_package",
@@ -36,7 +36,7 @@ class TestPackageResource(TestCase):
     shell_mock.assert_called_with("/usr/bin/yum -d 0 -e 0 -y install some_package")
     
   @patch.object(shell, "checked_call")
-  @patch.object(System, "platform", new = 'suse')
+  @patch.object(System, "os_family", new = 'suse')
   def test_action_install_suse(self, shell_mock):     
     with Environment('/') as env:
       Package("some_package",
@@ -45,7 +45,7 @@ class TestPackageResource(TestCase):
     
     
   @patch.object(shell, "checked_call")
-  @patch.object(System, "platform", new = 'redhat')
+  @patch.object(System, "os_family", new = 'redhat')
   def test_action_remove_rhel(self, shell_mock):     
     with Environment('/') as env:
       Package("some_package",
@@ -54,7 +54,7 @@ class TestPackageResource(TestCase):
     shell_mock.assert_called_with("/usr/bin/yum -d 0 -e 0 -y erase some_package")
     
   @patch.object(shell, "checked_call")
-  @patch.object(System, "platform", new = 'suse')
+  @patch.object(System, "os_family", new = 'suse')
   def test_action_remove_suse(self, shell_mock):     
     with Environment('/') as env:
       Package("some_package",
@@ -63,7 +63,7 @@ class TestPackageResource(TestCase):
     shell_mock.assert_called_with("/usr/bin/zypper --quiet remove --no-confirm some_package")
       
   @patch.object(shell, "checked_call")
-  @patch.object(System, "platform", new = 'redhat')
+  @patch.object(System, "os_family", new = 'redhat')
   def test_action_install_version_attr(self, shell_mock):     
     with Environment('/') as env:
       Package("some_package",

+ 1 - 1
ambari-agent/src/test/python/resource_management/TestUserResource.py

@@ -25,7 +25,7 @@ from resource_management.core.resources import User
 import pwd
 import subprocess
 
-@patch.object(System, "platform", new = 'redhat')
+@patch.object(System, "os_family", new = 'redhat')
 class TestUserResource(TestCase):
 
   @patch.object(subprocess, "Popen")

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/1.3.3/hooks/before-START/scripts/params.py

@@ -124,7 +124,7 @@ else:
 
 #hadoop-env.sh
 java_home = config['hostLevelParams']['java_home']
-if System.get_instance().platform == "suse":
+if System.get_instance().os_family == "suse":
   jsvc_path = "/usr/lib/bigtop-utils"
 else:
   jsvc_path = "/usr/libexec/bigtop-utils"

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/1.3.3/services/GANGLIA/package/scripts/params.py

@@ -68,7 +68,7 @@ has_tasktracker = not len(tt_hosts) == 0
 has_hbase_rs = not len(hbase_rs_hosts) == 0
 has_flume = not len(flume_hosts) == 0
 
-if System.get_instance().platform == "suse":
+if System.get_instance().os_family == "suse":
   rrd_py_path = '/srv/www/cgi-bin'
 else:
   rrd_py_path = '/var/www/cgi-bin'

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/1.3.3/services/HDFS/package/scripts/params.py

@@ -23,7 +23,7 @@ import os
 
 config = Script.get_config()
 
-if System.get_instance().platform == "oracle":
+if System.get_instance().os_type == "oraclelinux":
   ulimit_cmd = ''
 else:
   ulimit_cmd = "ulimit -c unlimited && if [ `ulimit -c` != 'unlimited' ]; then exit 77; fi && "

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/1.3.3/services/HIVE/package/scripts/mysql_server.py

@@ -25,7 +25,7 @@ from mysql_service import mysql_service
 
 class MysqlServer(Script):
 
-  if System.get_instance().platform == "suse":
+  if System.get_instance().os_family == "suse":
     daemon_name = 'mysql'
   else:
     daemon_name = 'mysqld'

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/1.3.3/services/NAGIOS/package/scripts/nagios.py

@@ -89,7 +89,7 @@ def set_web_permisssions():
     mode  = 0640
   )
 
-  if System.get_instance().platform == "suse":
+  if System.get_instance().os_family == "suse":
     command = format("usermod -G {nagios_group} wwwrun")
   else:
     command = format("usermod -a -G {nagios_group} apache")

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/1.3.3/services/NAGIOS/package/scripts/nagios_server_config.py

@@ -40,7 +40,7 @@ def nagios_server_config():
   nagios_server_configfile( 'hadoop-commands.cfg')
   nagios_server_configfile( 'contacts.cfg')
   
-  if System.get_instance().platform != "suse":
+  if System.get_instance().os_family != "suse":
     nagios_server_configfile( 'nagios',
                               config_dir = '/etc/init.d/', 
                               mode = 0755, 

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/1.3.3/services/NAGIOS/package/scripts/params.py

@@ -103,7 +103,7 @@ ganglia_collector_hs_port = "8666"
   
 all_ping_ports = config['clusterHostInfo']['all_ping_ports']
 
-if System.get_instance().platform == "suse":
+if System.get_instance().os_family == "suse":
   nagios_p1_pl = "/usr/lib/nagios/p1.pl"
   htpasswd_cmd = "htpasswd2"
 else:

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/1.3.3/services/NAGIOS/package/templates/hadoop-commands.cfg.j2

@@ -20,7 +20,7 @@
 #
 #
 
-{% if env.system.platform != "suse" %}
+{% if env.system.os_family != "suse" %}
 # 'check_cpu' check remote cpu load
 define command {
         command_name    check_cpu

+ 5 - 5
ambari-server/src/main/resources/stacks/HDP/1.3.3/services/NAGIOS/package/templates/hadoop-services.cfg.j2

@@ -222,7 +222,7 @@ define service {
         max_check_attempts      3
 }
 
-{% if env.system.platform != "suse" %}
+{% if env.system.os_family != "suse" %}
 define service {
         host_name               {{ namenode_hostname }}
         use                     hadoop-service
@@ -317,7 +317,7 @@ define service {
         retry_check_interval    1
         max_check_attempts      3
 }
-{% if env.system.platform != "suse" %}
+{% if env.system.os_family != "suse" %}
 define service {
         hostgroup_name          jobtracker
         use                     hadoop-service
@@ -405,7 +405,7 @@ define service {
         max_check_attempts      3
 }
 
-{% if env.system.platform != "suse" %}
+{% if env.system.os_family != "suse" %}
 define service {
         hostgroup_name          resourcemanager
         use                     hadoop-service
@@ -489,7 +489,7 @@ define service {
         max_check_attempts      3
 }
 
-{% if env.system.platform != "suse" %}
+{% if env.system.os_family != "suse" %}
 define service {
         hostgroup_name          historyserver2
         use                     hadoop-service
@@ -622,7 +622,7 @@ define service {
 #         max_check_attempts      3
 # #}
 {%  for hbasemaster in hbase_master_hosts  %}
-{% if env.system.platform != "suse" %}
+{% if env.system.os_family != "suse" %}
 define service {
         host_name               {{ hbasemaster }}
         use                     hadoop-service

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/2.1.1/hooks/before-START/scripts/params.py

@@ -124,7 +124,7 @@ else:
 
 #hadoop-env.sh
 java_home = config['hostLevelParams']['java_home']
-if System.get_instance().platform == "suse":
+if System.get_instance().os_family == "suse":
   jsvc_path = "/usr/lib/bigtop-utils"
 else:
   jsvc_path = "/usr/libexec/bigtop-utils"

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/2.1.1/services/GANGLIA/package/scripts/params.py

@@ -74,7 +74,7 @@ has_hbase_rs = not len(hbase_rs_hosts) == 0
 has_flume = not len(flume_hosts) == 0
 has_journalnode = not len(jn_hosts) == 0
 
-if System.get_instance().platform == "suse":
+if System.get_instance().os_family == "suse":
   rrd_py_path = '/srv/www/cgi-bin'
 else:
   rrd_py_path = '/var/www/cgi-bin'

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/2.1.1/services/HDFS/package/scripts/params.py

@@ -23,7 +23,7 @@ import os
 
 config = Script.get_config()
 
-if System.get_instance().platform == "oracle":
+if System.get_instance().os_type == "oraclelinux":
   ulimit_cmd = ''
 else:
   ulimit_cmd = "ulimit -c unlimited && if [ `ulimit -c` != 'unlimited' ]; then exit 77; fi && "

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/2.1.1/services/HIVE/package/scripts/mysql_server.py

@@ -25,7 +25,7 @@ from mysql_service import mysql_service
 
 class MysqlServer(Script):
 
-  if System.get_instance().platform == "suse":
+  if System.get_instance().os_family == "suse":
     daemon_name = 'mysql'
   else:
     daemon_name = 'mysqld'

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/2.1.1/services/NAGIOS/package/scripts/nagios.py

@@ -89,7 +89,7 @@ def set_web_permisssions():
     mode  = 0640
   )
 
-  if System.get_instance().platform == "suse":
+  if System.get_instance().os_family == "suse":
     command = format("usermod -G {nagios_group} wwwrun")
   else:
     command = format("usermod -a -G {nagios_group} apache")

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/2.1.1/services/NAGIOS/package/scripts/nagios_server_config.py

@@ -40,7 +40,7 @@ def nagios_server_config():
   nagios_server_configfile( 'hadoop-commands.cfg')
   nagios_server_configfile( 'contacts.cfg')
   
-  if System.get_instance().platform != "suse":
+  if System.get_instance().os_family != "suse":
     nagios_server_configfile( 'nagios',
                               config_dir = '/etc/init.d/', 
                               mode = 0755, 

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/2.1.1/services/NAGIOS/package/scripts/params.py

@@ -97,7 +97,7 @@ ganglia_collector_hs_port = "8666"
   
 all_ping_ports = config['clusterHostInfo']['all_ping_ports']
 
-if System.get_instance().platform == "suse":
+if System.get_instance().os_family == "suse":
   nagios_p1_pl = "/usr/lib/nagios/p1.pl"
   htpasswd_cmd = "htpasswd2"
 else:

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/2.1.1/services/NAGIOS/package/templates/hadoop-commands.cfg.j2

@@ -20,7 +20,7 @@
 #
 #
 
-{% if env.system.platform != "suse" %}
+{% if env.system.os_family != "suse" %}
 # 'check_cpu' check remote cpu load
 define command {
         command_name    check_cpu

+ 4 - 4
ambari-server/src/main/resources/stacks/HDP/2.1.1/services/NAGIOS/package/templates/hadoop-services.cfg.j2

@@ -235,7 +235,7 @@ define service {
         max_check_attempts      3
 }
 
-{% if env.system.platform != "suse" %}
+{% if env.system.os_family != "suse" %}
 define service {
         host_name               {{ namenode_hostname }}
         use                     hadoop-service
@@ -323,7 +323,7 @@ define service {
         max_check_attempts      3
 }
 
-{% if env.system.platform != "suse" %}
+{% if env.system.os_family != "suse" %}
 define service {
         hostgroup_name          resourcemanager
         use                     hadoop-service
@@ -407,7 +407,7 @@ define service {
         max_check_attempts      3
 }
 
-{% if env.system.platform != "suse" %}
+{% if env.system.os_family != "suse" %}
 define service {
         hostgroup_name          historyserver2
         use                     hadoop-service
@@ -551,7 +551,7 @@ define service {
 #         max_check_attempts      3
 # #}
 {%  for hbasemaster in hbase_master_hosts  %}
-{% if env.system.platform != "suse" %}
+{% if env.system.os_family != "suse" %}
 define service {
         host_name               {{ hbasemaster }}
         use                     hadoop-service

+ 1 - 1
ambari-server/src/test/resources/stacks/HDP/2.0.7/services/HIVE/package/scripts/mysql_server.py

@@ -25,7 +25,7 @@ from mysql_service import mysql_service
 
 class MysqlServer(Script):
 
-  if System.get_instance().platform == "suse":
+  if System.get_instance().os_family == "suse":
     daemon_name = 'mysql'
   else:
     daemon_name = 'mysqld'