소스 검색

AMBARI-9336. os_family is missing after ambari upgrade (aonishuk)

Andrew Onishuk 10 년 전
부모
커밋
d2f3326034

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

@@ -798,6 +798,9 @@ def update_ambari_properties():
     if not JCE_NAME_PROPERTY in new_properties.keys() and isJDK16Installed:
       new_properties.process_pair(JCE_NAME_PROPERTY, JCE_POLICY_FILENAMES[1])
 
+    if not OS_FAMILY_PROPERTY in new_properties.keys():
+      new_properties.process_pair(OS_FAMILY_PROPERTY, OS_FAMILY + OS_VERSION)
+
     new_properties.store(open(conf_file, 'w'))
 
   except Exception, e:

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

@@ -61,7 +61,7 @@ with patch("platform.linux_distribution", return_value = os_distro_value):
         from ambari_server.properties import Properties
         from ambari_server.resourceFilesKeeper import ResourceFilesKeeper, KeeperException
         from ambari_server.serverConfiguration import configDefaults, \
-          check_database_name_property, \
+          check_database_name_property, OS_FAMILY_PROPERTY, \
           find_properties_file, get_ambari_classpath, get_ambari_jars, get_ambari_properties, get_JAVA_HOME, get_share_jars, \
           parse_properties_file, read_ambari_user, update_ambari_properties, update_properties_2, write_property, find_jdk, \
           AMBARI_CONF_VAR, AMBARI_SERVER_LIB, JDBC_DATABASE_PROPERTY, JDBC_RCA_PASSWORD_FILE_PROPERTY, \
@@ -4434,7 +4434,7 @@ MIIFHjCCAwYCCQDpHKOBI+Lt0zANBgkqhkiG9w0BAQUFADBRMQswCQYDVQQGEwJV
 
 
   @patch("ambari_server.serverConfiguration.get_conf_dir")
-  def test_update_ambari_properties_without_user_property(self, get_conf_dir_mock):
+  def test_update_ambari_properties_without_some_properties(self, get_conf_dir_mock):
     '''
       Checks: update_ambari_properties call should add ambari-server.user property if
       it's absent
@@ -4466,6 +4466,7 @@ MIIFHjCCAwYCCQDpHKOBI+Lt0zANBgkqhkiG9w0BAQUFADBRMQswCQYDVQQGEwJV
     self.assertTrue(NR_USER_PROPERTY in ambari_properties.keys())
     value = ambari_properties[NR_USER_PROPERTY]
     self.assertEqual(value, "root")
+    self.assertTrue(OS_FAMILY_PROPERTY in ambari_properties.keys())
 
     os.unlink(fn2)
     pass

+ 1 - 1
ambari-server/src/test/python/TestOSCheck.py

@@ -226,7 +226,7 @@ class TestOSCheck(TestCase):
         else:
           pass
 
-    self.assertEquals(count, 8)
+    self.assertEquals(count, 9)
     # Command should not fail if *.rpmsave file is missing
     result = update_ambari_properties()
     self.assertEquals(result, 0)