Browse Source

AMBARI-2612. Rename agent.fqdn property in ambari.props to server.fqdn. (Dmytro Shkvyra via mahadev)

Mahadev Konar 12 years ago
parent
commit
0cd867fc5b

+ 1 - 1
ambari-server/conf/unix/ambari.properties

@@ -28,4 +28,4 @@ bootstrap.script=/usr/lib/python2.6/site-packages/ambari_server/bootstrap.py
 bootstrap.setup_agent.script=/usr/lib/python2.6/site-packages/ambari_server/setupAgent.py
 api.authenticate=true
 server.connection.max.idle.millis=900000
-agent.fqdn.service.url=http://169.254.169.254/latest/meta-data/public-hostname
+server.fqdn.service.url=http://169.254.169.254/latest/meta-data/public-hostname

+ 6 - 2
ambari-server/src/main/python/ambari-server.py

@@ -300,7 +300,7 @@ JAVA_HOME_PROPERTY = "java.home"
 JDK_URL_PROPERTY='jdk.url'
 JCE_URL_PROPERTY='jce_policy.url'
 OS_TYPE_PROPERTY = "server.os_type"
-GET_FQDN_SERVICE_URL="agent.fqdn.service.url"
+GET_FQDN_SERVICE_URL="server.fqdn.service.url"
 
 JDK_DOWNLOAD_CMD = "curl --create-dirs -o {0} {1}"
 JDK_DOWNLOAD_SIZE_CMD = "curl -I {0}"
@@ -375,7 +375,11 @@ def update_ambari_properties():
     new_properties.load(open(conf_file))
 
     for prop_key, prop_value in old_properties.getPropertyDict().items():
-      new_properties.process_pair(prop_key,prop_value)
+      if ("agent.fqdn.service.url" == prop_key):
+        #BUG-7179 what is agent.fqdn property in ambari.props?
+        new_properties.process_pair(GET_FQDN_SERVICE_URL,prop_value)
+      else:
+        new_properties.process_pair(prop_key,prop_value)
 
     # Adding custom user name property if it is absent
     # In previous versions without custom user support server was started as

+ 14 - 3
ambari-server/src/test/python/TestAmbaryServer.py

@@ -1276,6 +1276,10 @@ class TestAmbariServer(TestCase):
     fqdn = ambari_server.get_fqdn()
     self.assertEqual(fqdn, None)
     
+    #Check mbari_server.GET_FQDN_SERVICE_URL property name (AMBARI-2612)
+    #property name should be server.fqdn.service.url
+    self.assertEqual(ambari_server.GET_FQDN_SERVICE_URL, "server.fqdn.service.url")
+    
     #Read FQDN from service
     p = MagicMock()
     p[ambari_server.GET_FQDN_SERVICE_URL] = 'someurl'
@@ -2473,7 +2477,8 @@ MIIFHjCCAwYCCQDpHKOBI+Lt0zANBgkqhkiG9w0BAQUFADBRMQswCQYDVQQGEwJV
       "server.jdbc.user.passwd=/etc/ambari-server/conf/password.dat\n",
       "java.home=/usr/jdk64/jdk1.6.0_31\n",
       "server.os_type=redhat6\n",
-      "ambari-server.user=ambari\n"]
+      "ambari-server.user=ambari\n",
+      "agent.fqdn.service.url=URL\n"]
 
     NEW_PROPERTY = 'some_new_property=some_value\n'
     CHANGED_VALUE_PROPERTY = 'server.os_type=should_not_overwrite_value\n'
@@ -2507,8 +2512,14 @@ MIIFHjCCAwYCCQDpHKOBI+Lt0zANBgkqhkiG9w0BAQUFADBRMQswCQYDVQQGEwJV
       ambari_properties_content = f.readlines()
 
     for line in properties:
-      if not line in ambari_properties_content:
-        self.fail()
+      if (line == "agent.fqdn.service.url=URL\n"):
+        if (not ambari_server.GET_FQDN_SERVICE_URL+"=URL\n" in ambari_properties_content) and (line in ambari_properties_content):
+          self.fail()
+      else:
+        if not line in ambari_properties_content:
+          self.fail()
+
+
 
     if not NEW_PROPERTY in ambari_properties_content:
       self.fail()