Updated Branches:
  refs/heads/trunk 3571423f6 -> 82e92080c

AMBARI-3480. On Ambari Start, re-check critical setup configs.(Artem Baranchuk 
via odiachenko)


Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/82e92080
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/82e92080
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/82e92080

Branch: refs/heads/trunk
Commit: 82e92080c49c3f9c54ea527e38900b1e6abf71d8
Parents: 3571423
Author: Oleksandr Diachenko <[email protected]>
Authored: Thu Oct 10 19:32:51 2013 +0300
Committer: Oleksandr Diachenko <[email protected]>
Committed: Thu Oct 10 19:32:51 2013 +0300

----------------------------------------------------------------------
 ambari-server/src/main/python/ambari-server.py   |  9 +++++++++
 .../src/test/python/TestAmbariServer.py          | 19 ++++++++++++++++++-
 2 files changed, 27 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/82e92080/ambari-server/src/main/python/ambari-server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari-server.py 
b/ambari-server/src/main/python/ambari-server.py
index 8987168..eb84354 100755
--- a/ambari-server/src/main/python/ambari-server.py
+++ b/ambari-server/src/main/python/ambari-server.py
@@ -2237,6 +2237,15 @@ def start(args):
                     "JDK manually to " + JDK_INSTALL_DIR
     raise FatalException(1, err)
 
+  if not is_local_database(args):
+    result = find_jdbc_driver(args)
+    msg = 'Before starting Ambari Server, ' \
+          'you must copy the {0} JDBC driver JAR file to {1}.'.format(
+          DATABASE_FULL_NAMES[args.database],
+          JAVA_SHARE_PATH)
+    if result == -1:
+      raise FatalException(-1, msg)
+
   # Preparations
 
   if is_root():

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/82e92080/ambari-server/src/test/python/TestAmbariServer.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/TestAmbariServer.py 
b/ambari-server/src/test/python/TestAmbariServer.py
index c77205a..28b8a52 100644
--- a/ambari-server/src/test/python/TestAmbariServer.py
+++ b/ambari-server/src/test/python/TestAmbariServer.py
@@ -2196,9 +2196,11 @@ 
MIIFHjCCAwYCCQDpHKOBI+Lt0zANBgkqhkiG9w0BAQUFADBRMQswCQYDVQQGEwJV
   @patch.object(ambari_server, "parse_properties_file")
   @patch.object(ambari_server, "read_ambari_user")
   @patch.object(ambari_server, "is_root")
+  @patch.object(ambari_server, "is_local_database")
+  @patch.object(ambari_server, "find_jdbc_driver")
   @patch("getpass.getuser")
   @patch("os.chdir")
-  def test_start(self, chdir_mock, getuser_mock, is_root_mock, 
read_ambari_user_mock,
+  def test_start(self, chdir_mock, getuser_mock, find_jdbc_driver_mock, 
is_local_database_mock, is_root_mock, read_ambari_user_mock,
                  parse_properties_file_mock, check_postgre_up_mock,
                  print_error_msg_mock, find_jdk_mock, search_file_mock,
                  print_info_msg_mock, popenMock, openMock, pexistsMock,
@@ -2281,6 +2283,21 @@ 
MIIFHjCCAwYCCQDpHKOBI+Lt0zANBgkqhkiG9w0BAQUFADBRMQswCQYDVQQGEwJV
 
     # Remote DB
     args.persistence_type = "remote"
+    args.database = "oracle"
+
+    # Case when jdbc driver is not used
+    is_local_database_mock.return_value = False
+    find_jdbc_driver_mock.return_value = -1
+    try:
+      ambari_server.start(args)
+      self.fail("Should fail with exception")
+    except FatalException as e:
+      self.assertTrue('Before starting Ambari Server' in e.reason)
+
+    is_local_database_mock.reset_mock()
+    find_jdbc_driver_mock.reset_mock()
+    is_local_database_mock.return_value = True
+    find_jdbc_driver_mock.return_value = 0
     try:
       ambari_server.start(args)
     except FatalException as e:

Reply via email to