You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ds...@apache.org on 2015/09/21 17:41:16 UTC

ambari git commit: AMBARI-13122 [Upgrade] ambari server schema upgrade failed for Path 1.6.1 -> 2.1.2 and 2.0.2->2.1.2 and 2.1.1->2.1.2 (dsen)

Repository: ambari
Updated Branches:
  refs/heads/trunk cbd8ec164 -> e59f15744


AMBARI-13122 [Upgrade] ambari server schema upgrade failed for Path 1.6.1 -> 2.1.2 and 2.0.2->2.1.2 and 2.1.1->2.1.2 (dsen)


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

Branch: refs/heads/trunk
Commit: e59f157447e2d69623ccf7d3558a118032041554
Parents: cbd8ec1
Author: Dmytro Sen <ds...@apache.org>
Authored: Mon Sep 21 18:41:03 2015 +0300
Committer: Dmytro Sen <ds...@apache.org>
Committed: Mon Sep 21 18:41:03 2015 +0300

----------------------------------------------------------------------
 .../src/main/python/ambari_server/dbConfiguration_linux.py   | 7 +++++++
 ambari-server/src/main/python/ambari_server/serverUpgrade.py | 5 ++++-
 ambari-server/src/test/python/TestAmbariServer.py            | 8 +++++---
 3 files changed, 16 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e59f1574/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py b/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py
index 328e53e..0abd28e 100644
--- a/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py
+++ b/ambari-server/src/main/python/ambari_server/dbConfiguration_linux.py
@@ -778,6 +778,13 @@ class OracleConfig(LinuxDBMSConfig):
   def _is_jdbc_driver_installed(self, properties):
     return LinuxDBMSConfig._find_jdbc_driver("*ojdbc*.jar")
 
+  def _get_default_driver_path(self, properties):
+    drivers = LinuxDBMSConfig._find_jdbc_driver("*ojdbc*.jar")
+    if drivers == -1:
+      return os.path.join(configDefaults.JAVA_SHARE_PATH, self.driver_file_name)
+    else:
+      return os.pathsep.join(drivers)
+
   def _configure_database_name(self):
     if self.persistence_type != STORAGE_TYPE_LOCAL:
       # Oracle uses service name or service id

http://git-wip-us.apache.org/repos/asf/ambari/blob/e59f1574/ambari-server/src/main/python/ambari_server/serverUpgrade.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari_server/serverUpgrade.py b/ambari-server/src/main/python/ambari_server/serverUpgrade.py
index 73961d8..3545b65 100644
--- a/ambari-server/src/main/python/ambari_server/serverUpgrade.py
+++ b/ambari-server/src/main/python/ambari_server/serverUpgrade.py
@@ -30,7 +30,8 @@ import glob
 from ambari_commons.exceptions import FatalException
 from ambari_commons.logging_utils import print_info_msg, print_warning_msg, print_error_msg, get_verbose
 from ambari_commons.os_utils import is_root, run_os_command
-from ambari_server.dbConfiguration import DBMSConfigFactory, check_jdbc_drivers, get_jdbc_driver_path
+from ambari_server.dbConfiguration import DBMSConfigFactory, check_jdbc_drivers, \
+  get_jdbc_driver_path, ensure_jdbc_driver_is_installed
 from ambari_server.properties import Properties
 from ambari_server.serverConfiguration import configDefaults, \
   check_database_name_property, get_ambari_properties, get_ambari_version, get_full_ambari_classpath, \
@@ -232,6 +233,8 @@ def run_schema_upgrade(args):
                     "JDK manually to " + configDefaults.JDK_INSTALL_DIR)
     return 1
 
+  ensure_jdbc_driver_is_installed(args, get_ambari_properties())
+
   print 'Upgrading database schema'
 
   class_path = get_full_ambari_classpath()

http://git-wip-us.apache.org/repos/asf/ambari/blob/e59f1574/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 fe6380f..f2ac75e 100644
--- a/ambari-server/src/test/python/TestAmbariServer.py
+++ b/ambari-server/src/test/python/TestAmbariServer.py
@@ -4668,6 +4668,7 @@ class TestAmbariServer(TestCase):
     pass
 
 
+  @patch("ambari_server.serverUpgrade.ensure_jdbc_driver_is_installed")
   @patch("ambari_server.serverUpgrade.get_jdbc_driver_path")
   @patch("ambari_server.serverUpgrade.ensure_can_start_under_current_user")
   @patch("ambari_server.serverUpgrade.generate_env")
@@ -4681,7 +4682,8 @@ class TestAmbariServer(TestCase):
   def test_run_schema_upgrade(self, get_YN_input_mock, get_ambari_properties_mock, java_exe_path_mock, run_os_command_mock,
                               get_ambari_classpath_mock, get_conf_dir_mock,
                               read_ambari_user_mock, generate_env_mock,
-                              ensure_can_start_under_current_user_mock, get_jdbc_mock):
+                              ensure_can_start_under_current_user_mock, get_jdbc_mock,
+                              ensure_jdbc_driver_is_installed_mock):
     java_exe_path_mock.return_value = "/usr/lib/java/bin/java"
     run_os_command_mock.return_value = (0, None, None)
     get_ambari_classpath_mock.return_value = 'test' + os.pathsep + 'path12'
@@ -6235,7 +6237,7 @@ class TestAmbariServer(TestCase):
     # Non-Silent option, no drivers at first ask, present drivers after that
     args = reset_mocks()
 
-    glob_mock.side_effect = [[], drivers_list]
+    glob_mock.side_effect = [[], drivers_list, drivers_list]
 
     dbms = factory.create(args, props)
     rcode = dbms.ensure_jdbc_driver_installed(props)
@@ -6262,7 +6264,7 @@ class TestAmbariServer(TestCase):
 
     # Failed to copy_files
     args = reset_mocks()
-    glob_mock.side_effect = [drivers_list]
+    glob_mock.side_effect = [[], drivers_list, drivers_list]
 
     try:
       dbms = factory.create(args, props)