Browse Source

AMBARI-6111. Change dbconnection test connection failure message to be more explicit.(vbrodetskyi)

Vitaly Brodetskyi 11 years ago
parent
commit
901b59ce46

+ 4 - 3
ambari-server/src/main/resources/custom_actions/check_host.py

@@ -188,9 +188,10 @@ class CheckHost(Script):
                    "--retry 5 {jdbc_url} -o {jdbc_name}'")
       Execute(cmd, not_if=format("[ -f /usr/lib/ambari-agent/{jdbc_name}]"), environment = environment)
     except Exception, e:
-      message = "Error downloading JDBC connector from Ambari Server resources. Confirm you ran ambari-server setup to " \
-                "install JDBC connector. Use \"ambari-server setup --help\" for more information. Check network access to " \
-                "Ambari Server.\n" + str(e)
+      message = format("Error: Ambari Server cannot download the database JDBC driver and is unable to test the " \
+                "database connection. You must run ambari-server setup --jdbc-db={db_name} " \
+                "--jdbc-driver=/path/to/your/{db_name}/driver.jar on the Ambari Server host to make the JDBC " \
+                "driver available for download and to enable testing the database connection.\n") + str(e)
       print message
       db_connection_check_structured_output = {"exit_code" : 1, "message": message}
       return db_connection_check_structured_output

+ 6 - 5
ambari-server/src/test/python/TestCheckHost.py

@@ -105,11 +105,12 @@ class TestCheckHost(TestCase):
 
     checkHost.actionexecute(None)
 
-    self.assertEquals(structured_out_mock.call_args[0][0], {'db_connection_check': {'message': 'Error downloading JDBC ' \
-                              'connector from Ambari Server resources. Confirm you ran ambari-server setup to ' \
-                              'install JDBC connector. Use "ambari-server setup --help" for more information. Check ' \
-                              'network access to Ambari Server.\ntest exception', 'exit_code': 1}})
-    
+    self.assertEquals(format_mock.call_args[0][0], 'Error: Ambari Server cannot download the database JDBC driver '
+                  'and is unable to test the database connection. You must run ambari-server setup '
+                  '--jdbc-db={db_name} --jdbc-driver=/path/to/your/{db_name}/driver.jar on the Ambari '
+                  'Server host to make the JDBC driver available for download and to enable testing '
+                  'the database connection.\n')
+    self.assertEquals(structured_out_mock.call_args[0][0]['db_connection_check']['exit_code'], 1)
     self.assertEquals(format_mock.call_args_list[4][0][0], "/bin/sh -c 'cd /usr/lib/ambari-agent/ && curl -kf " \
                                                             "--retry 5 {jdbc_url} -o {jdbc_name}'")