Procházet zdrojové kódy

AMBARI-9038 [WinGA] Dashboard doesn't load after installation on Windows

Added the missing setting required for the OS detection to work properly
Florian Barca před 10 roky
rodič
revize
273e1b1070

+ 1 - 0
ambari-server/src/main/python/ambari_server/serverConfiguration.py

@@ -43,6 +43,7 @@ BLIND_PASSWORD = "*****"
 # Common messages
 PRESS_ENTER_MSG = "Press <enter> to continue."
 
+OS_FAMILY_PROPERTY = "server.os_family"
 OS_TYPE_PROPERTY = "server.os_type"
 
 BOOTSTRAP_DIR_PROPERTY = "bootstrap.dir"

+ 5 - 5
ambari-server/src/main/python/ambari_server/serverSetup.py

@@ -329,12 +329,12 @@ def configure_os_settings():
   except (KeyError):
     print_error_msg("os_type is not set in the properties file. Setting it now.")
 
-  if OSCheck.is_windows_family():
-    master_os_type = OS_TYPE + OS_VERSION
-  else:
-    # MacOS not supported
-    master_os_type = OS_FAMILY + OS_VERSION
+  # to check server/agent compatibility
+  master_os_family = OS_FAMILY + OS_VERSION
+  # to check supported os_types
+  master_os_type = OS_TYPE + OS_VERSION
 
+  write_property(OS_FAMILY_PROPERTY, master_os_family)
   write_property(OS_TYPE_PROPERTY, master_os_type)
   return 0
 

+ 3 - 0
ambari-server/src/test/python/TestAmbariServer.py

@@ -2170,6 +2170,9 @@ MIIFHjCCAwYCCQDpHKOBI+Lt0zANBgkqhkiG9w0BAQUFADBRMQswCQYDVQQGEwJV
     rcode = ambari_server.configure_os_settings()
     self.assertEqual(0, rcode)
     self.assertTrue(write_property_mock.called)
+    self.assertEqual(2, write_property_mock.call_count)
+    self.assertEquals(write_property_mock.call_args_list[0][0][0], "server.os_family")
+    self.assertEquals(write_property_mock.call_args_list[1][0][0], "server.os_type")
 
 
   @patch("__builtin__.open")