Updated Branches: refs/heads/trunk 0cdf5a8f9 -> 9a05963ce
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/9a05963c Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/9a05963c Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/9a05963c Branch: refs/heads/trunk Commit: 9a05963cedb986c1e9ea571642783404ac392f09 Parents: 0cdf5a8 Author: Oleksandr Diachenko <[email protected]> Authored: Thu Oct 17 15:31:19 2013 +0300 Committer: Oleksandr Diachenko <[email protected]> Committed: Thu Oct 17 15:31:31 2013 +0300 ---------------------------------------------------------------------- ambari-server/src/main/python/ambari-server.py | 9 +++++++++ ambari-server/src/test/python/TestAmbariServer.py | 15 ++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/9a05963c/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 53c9362..325a405 100755 --- a/ambari-server/src/main/python/ambari-server.py +++ b/ambari-server/src/main/python/ambari-server.py @@ -2242,6 +2242,15 @@ def start(args): "JDK manually to " + JDK_INSTALL_DIR raise FatalException(1, err) + if args.persistence_type == 'remote': + 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/9a05963c/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 cc8c160..9c8a764 100644 --- a/ambari-server/src/test/python/TestAmbariServer.py +++ b/ambari-server/src/test/python/TestAmbariServer.py @@ -2213,9 +2213,10 @@ 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, "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_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, @@ -2298,6 +2299,18 @@ MIIFHjCCAwYCCQDpHKOBI+Lt0zANBgkqhkiG9w0BAQUFADBRMQswCQYDVQQGEwJV # Remote DB args.persistence_type = "remote" + args.database = "oracle" + + # Case when jdbc driver is not used + 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) + + find_jdbc_driver_mock.reset_mock() + find_jdbc_driver_mock.return_value = 0 try: ambari_server.start(args) except FatalException as e:
