Selaa lähdekoodia

AMBARI-6138. OS key issue on RHEL workstation (in forums) (aonishuk)

Andrew Onishuk 11 vuotta sitten
vanhempi
commit
2fcd5b11f5

+ 1 - 1
ambari-common/src/main/python/common_functions/os_check.py

@@ -104,7 +104,7 @@ class OSCheck:
       return 'oraclelinux'
     elif operatingSystem.startswith('suse linux enterprise server'):
       return 'sles'
-    elif operatingSystem.startswith('red hat enterprise linux server'):
+    elif operatingSystem.startswith('red hat enterprise linux'):
       return 'redhat'
 
     if operatingSystem != '':

+ 17 - 0
ambari-server/src/test/python/TestOSCheck.py

@@ -68,6 +68,23 @@ class TestOSCheck(TestCase):
     result = OSCheck.get_os_type()
     self.assertEquals(result, 'centos')
 
+    # 5 - Red Hat Enterprise Linux
+    mock_exists.return_value = False
+    # Red Hat Enterprise Linux Server release 6.5 (Santiago)
+    mock_linux_distribution.return_value = ('Red Hat Enterprise Linux Server', '6.5', 'Santiago')
+    result = OSCheck.get_os_type()
+    self.assertEquals(result, 'redhat')
+
+    # Red Hat Enterprise Linux Workstation release 6.4 (Santiago)
+    mock_linux_distribution.return_value = ('Red Hat Enterprise Linux Workstation', '6.4', 'Santiago')
+    result = OSCheck.get_os_type()
+    self.assertEquals(result, 'redhat')
+
+    # Red Hat Enterprise Linux AS release 4 (Nahant Update 3)
+    mock_linux_distribution.return_value = ('Red Hat Enterprise Linux AS', '4', 'Nahant Update 3')
+    result = OSCheck.get_os_type()
+    self.assertEquals(result, 'redhat')
+
 
   @patch("platform.linux_distribution")
   @patch("os.path.exists")