ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mradhakrish...@apache.org
Subject [63/94] [abbrv] ambari git commit: AMBARI-21882. Throw an error if unsupported database JDBC driver is configured for HDP services. (stoader)
Date Mon, 11 Sep 2017 04:39:33 GMT
AMBARI-21882. Throw an error if unsupported database JDBC driver is configured for HDP services.
(stoader)


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

Branch: refs/heads/branch-feature-AMBARI-14714
Commit: 680f1148e8e0dac064b7b77f9fba77d7d5a3c448
Parents: 202eaed
Author: Toader, Sebastian <stoader@hortonworks.com>
Authored: Wed Sep 6 15:07:49 2017 +0200
Committer: Toader, Sebastian <stoader@hortonworks.com>
Committed: Wed Sep 6 15:07:49 2017 +0200

----------------------------------------------------------------------
 .../functions/setup_ranger_plugin_xml.py        |   1 +
 .../0.12.0.2.0/package/scripts/params_linux.py  |   2 +
 .../2.1.0.3.0/package/scripts/params_linux.py   |   2 +
 .../RANGER/0.4.0/package/scripts/params.py      |   2 +
 .../RANGER/1.0.0.3.0/package/scripts/params.py  |   2 +
 .../0.5.0.2.3/package/scripts/params.py         |   3 +
 .../1.0.0.3.0/package/scripts/params.py         |   3 +
 .../1.4.4.2.0/package/scripts/params_linux.py   |   2 +
 .../1.4.4.3.0/package/scripts/params_linux.py   |   2 +
 .../custom_actions/scripts/check_host.py        |   1 +
 .../HIVE/test_jdbc_driver_config.py             |  66 ++
 .../RANGER/test_db_flavor_config.py             |  63 ++
 .../RANGER_KMS/test_db_flavor_config.py         |  63 ++
 .../SQOOP/test_jdbc_driver_config.py            |  63 ++
 .../common-services/configs/hive_default.json   | 650 ++++++++++++++
 .../configs/hive_unsupported_jdbc_type.json     | 650 ++++++++++++++
 .../configs/ranger_admin_default.json           | 386 ++++++++
 .../ranger_admin_unsupported_db_flavor.json     | 386 ++++++++
 .../configs/ranger_kms_default.json             | 802 +++++++++++++++++
 .../ranger_kms_unsupported_db_flavor.json       | 802 +++++++++++++++++
 .../common-services/configs/sqoop_default.json  | 879 +++++++++++++++++++
 .../configs/sqoop_unsupported_jdbc_driver.json  | 879 +++++++++++++++++++
 .../test/python/custom_actions/TestCheckHost.py |  33 +
 23 files changed, 5742 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/680f1148/ambari-common/src/main/python/resource_management/libraries/functions/setup_ranger_plugin_xml.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/setup_ranger_plugin_xml.py
b/ambari-common/src/main/python/resource_management/libraries/functions/setup_ranger_plugin_xml.py
index c80c577..485c1a6 100644
--- a/ambari-common/src/main/python/resource_management/libraries/functions/setup_ranger_plugin_xml.py
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/setup_ranger_plugin_xml.py
@@ -284,6 +284,7 @@ def get_audit_configs(config):
     previous_jdbc_jar_name = default("/hostLevelParams/previous_custom_sqlanywhere_jdbc_name",
None)
     audit_jdbc_url = format('jdbc:sqlanywhere:database={xa_audit_db_name};host={xa_db_host}')
     jdbc_driver = "sap.jdbc4.sqlanywhere.IDriver"
+  else: raise Fail(format("'{xa_audit_db_flavor}' db flavor not supported."))
 
   return jdbc_jar_name, previous_jdbc_jar_name, audit_jdbc_url, jdbc_driver
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/680f1148/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
index 39c06f2..9ba1f99 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/params_linux.py
@@ -49,6 +49,7 @@ from resource_management.libraries.functions.get_architecture import get_archite
 from resource_management.libraries.functions.version import get_major_version
 
 from resource_management.core.utils import PasswordString
+from resource_management.core.exceptions import Fail
 from resource_management.core.shell import checked_call
 from ambari_commons.credential_store_helper import get_password_from_credential_store
 
@@ -288,6 +289,7 @@ elif hive_jdbc_driver == "sap.jdbc4.sqlanywhere.IDriver":
   jdbc_jar_name = default("/hostLevelParams/custom_sqlanywhere_jdbc_name", None)
   hive_previous_jdbc_jar_name = default("/hostLevelParams/previous_custom_sqlanywhere_jdbc_name",
None)
   sqla_db_used = True
+else: raise Fail(format("JDBC driver '{hive_jdbc_driver}' not supported."))
 
 default_mysql_jar_name = "mysql-connector-java.jar"
 default_mysql_target = format("{hive_lib}/{default_mysql_jar_name}")

http://git-wip-us.apache.org/repos/asf/ambari/blob/680f1148/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/params_linux.py
b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/params_linux.py
index 90d9067..f6b676b 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/2.1.0.3.0/package/scripts/params_linux.py
@@ -49,6 +49,7 @@ from resource_management.libraries.functions.get_architecture import get_archite
 
 from resource_management.core.utils import PasswordString
 from resource_management.core.shell import checked_call
+from resource_management.core.exceptions import Fail
 from ambari_commons.credential_store_helper import get_password_from_credential_store
 
 # Default log4j version; put config files under /etc/hive/conf
@@ -286,6 +287,7 @@ elif hive_jdbc_driver == "sap.jdbc4.sqlanywhere.IDriver":
   jdbc_jar_name = default("/hostLevelParams/custom_sqlanywhere_jdbc_name", None)
   hive_previous_jdbc_jar_name = default("/hostLevelParams/previous_custom_sqlanywhere_jdbc_name",
None)
   sqla_db_used = True
+else: raise Fail(format("JDBC driver '{hive_jdbc_driver}' not supported."))
 
 default_mysql_jar_name = "mysql-connector-java.jar"
 default_mysql_target = format("{hive_lib}/{default_mysql_jar_name}")

http://git-wip-us.apache.org/repos/asf/ambari/blob/680f1148/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py
b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py
index d0f0974..5731e6c 100644
--- a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py
@@ -29,6 +29,7 @@ from resource_management.libraries.functions.stack_features import check_stack_f
 from resource_management.libraries.functions.stack_features import get_stack_feature_version
 from resource_management.libraries.functions import StackFeature
 from resource_management.libraries.functions.get_bare_principal import get_bare_principal
+from resource_management.core.exceptions import Fail
 
 # a map of the Ambari role to the component name
 # for use with <stack-root>/current/<component>
@@ -199,6 +200,7 @@ elif db_flavor.lower() == 'sqla':
   previous_jdbc_jar_name = default("/hostLevelParams/previous_custom_sqlanywhere_jdbc_name",
None)
   audit_jdbc_url = format('jdbc:sqlanywhere:database={ranger_auditdb_name};host={db_host}')
if stack_supports_ranger_audit_db else None
   jdbc_dialect = "org.eclipse.persistence.platform.database.SQLAnywherePlatform"
+else: raise Fail(format("'{db_flavor}' db flavor not supported."))
 
 downloaded_custom_connector = format("{tmp_dir}/{jdbc_jar_name}")
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/680f1148/ambari-server/src/main/resources/common-services/RANGER/1.0.0.3.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER/1.0.0.3.0/package/scripts/params.py
b/ambari-server/src/main/resources/common-services/RANGER/1.0.0.3.0/package/scripts/params.py
index 24f459c..b88f1a4 100644
--- a/ambari-server/src/main/resources/common-services/RANGER/1.0.0.3.0/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/RANGER/1.0.0.3.0/package/scripts/params.py
@@ -29,6 +29,7 @@ from resource_management.libraries.functions.stack_features import check_stack_f
 from resource_management.libraries.functions.stack_features import get_stack_feature_version
 from resource_management.libraries.functions import StackFeature
 from resource_management.libraries.functions.get_bare_principal import get_bare_principal
+from resource_management.core.exceptions import Fail
 
 # a map of the Ambari role to the component name
 # for use with <stack-root>/current/<component>
@@ -197,6 +198,7 @@ elif db_flavor.lower() == 'sqla':
   previous_jdbc_jar_name = default("/hostLevelParams/previous_custom_sqlanywhere_jdbc_name",
None)
   audit_jdbc_url = format('jdbc:sqlanywhere:database={ranger_auditdb_name};host={db_host}')
if stack_supports_ranger_audit_db else None
   jdbc_dialect = "org.eclipse.persistence.platform.database.SQLAnywherePlatform"
+else: raise Fail(format("'{db_flavor}' db flavor not supported."))
 
 downloaded_custom_connector = format("{tmp_dir}/{jdbc_jar_name}")
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/680f1148/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/params.py
b/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/params.py
index 466646b..56003ad 100755
--- a/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/RANGER_KMS/0.5.0.2.3/package/scripts/params.py
@@ -32,6 +32,7 @@ from resource_management.libraries.functions.setup_ranger_plugin_xml import
gene
 from resource_management.libraries.resources.hdfs_resource import HdfsResource
 from resource_management.libraries.functions import stack_select
 from resource_management.libraries.functions import get_kinit_path
+from resource_management.core.exceptions import Fail
 
 config  = Script.get_config()
 tmp_dir = Script.get_tmp_dir()
@@ -163,6 +164,7 @@ elif db_flavor == 'sqla':
   db_jdbc_url = format('jdbc:sqlanywhere:database={db_name};host={db_host}')
   db_jdbc_driver = "sap.jdbc4.sqlanywhere.IDriver"
   jdbc_dialect = "org.eclipse.persistence.platform.database.SQLAnywherePlatform"
+else: raise Fail(format("'{db_flavor}' db flavor not supported."))
 
 downloaded_custom_connector = format("{tmp_dir}/{jdbc_jar_name}")
 
@@ -210,6 +212,7 @@ if has_ranger_admin:
       xa_previous_jdbc_jar_name = default("/hostLevelParams/previous_custom_sqlanywhere_jdbc_name",
None)
       audit_jdbc_url = format('jdbc:sqlanywhere:database={xa_audit_db_name};host={xa_db_host}')
       jdbc_driver = "sap.jdbc4.sqlanywhere.IDriver"
+    else: raise Fail(format("'{xa_audit_db_flavor}' db flavor not supported."))
 
   downloaded_connector_path = format("{tmp_dir}/{jdbc_jar}") if stack_supports_ranger_audit_db
else None
   driver_source = format("{jdk_location}/{jdbc_jar}") if stack_supports_ranger_audit_db else
None

http://git-wip-us.apache.org/repos/asf/ambari/blob/680f1148/ambari-server/src/main/resources/common-services/RANGER_KMS/1.0.0.3.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER_KMS/1.0.0.3.0/package/scripts/params.py
b/ambari-server/src/main/resources/common-services/RANGER_KMS/1.0.0.3.0/package/scripts/params.py
index 003eee1..da8eb8c 100755
--- a/ambari-server/src/main/resources/common-services/RANGER_KMS/1.0.0.3.0/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/RANGER_KMS/1.0.0.3.0/package/scripts/params.py
@@ -32,6 +32,7 @@ from resource_management.libraries.functions.setup_ranger_plugin_xml import
gene
 from resource_management.libraries.resources.hdfs_resource import HdfsResource
 from resource_management.libraries.functions import stack_select
 from resource_management.libraries.functions import get_kinit_path
+from resource_management.core.exceptions import Fail
 
 config  = Script.get_config()
 tmp_dir = Script.get_tmp_dir()
@@ -162,6 +163,7 @@ elif db_flavor == 'sqla':
   db_jdbc_url = format('jdbc:sqlanywhere:database={db_name};host={db_host}')
   db_jdbc_driver = "sap.jdbc4.sqlanywhere.IDriver"
   jdbc_dialect = "org.eclipse.persistence.platform.database.SQLAnywherePlatform"
+else: raise Fail(format("'{db_flavor}' db flavor not supported."))
 
 downloaded_custom_connector = format("{tmp_dir}/{jdbc_jar_name}")
 
@@ -209,6 +211,7 @@ if has_ranger_admin:
       xa_previous_jdbc_jar_name = default("/hostLevelParams/previous_custom_sqlanywhere_jdbc_name",
None)
       audit_jdbc_url = format('jdbc:sqlanywhere:database={xa_audit_db_name};host={xa_db_host}')
       jdbc_driver = "sap.jdbc4.sqlanywhere.IDriver"
+    else: raise Fail(format("'{xa_audit_db_flavor}' db flavor not supported."))
 
   downloaded_connector_path = format("{tmp_dir}/{jdbc_jar}") if stack_supports_ranger_audit_db
else None
   driver_source = format("{jdk_location}/{jdbc_jar}") if stack_supports_ranger_audit_db else
None

http://git-wip-us.apache.org/repos/asf/ambari/blob/680f1148/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/params_linux.py
b/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/params_linux.py
index c1138b3..400c87c 100644
--- a/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.2.0/package/scripts/params_linux.py
@@ -28,6 +28,7 @@ from resource_management.libraries.functions import StackFeature
 from resource_management.libraries.functions.stack_features import check_stack_feature
 from resource_management.libraries.functions.expect import expect
 from resource_management.libraries.functions.setup_atlas_hook import has_atlas_in_cluster
+from resource_management.core.exceptions import Fail
 
 
 # a map of the Ambari role to the component name
@@ -117,6 +118,7 @@ if "jdbc_drivers" in config['configurations']['sqoop-env']:
         jdbc_name = default("/hostLevelParams/custom_hsqldb_jdbc_name", None)
         previous_jdbc_jar_name = default("/hostLevelParams/previous_custom_hsqldb_jdbc_name",
None)
         jdbc_driver_name = "hsqldb"
+      else: raise Fail(format("JDBC driver '{driver_name}' not supported."))
     else:
       continue
     sqoop_jdbc_drivers_dict.append(jdbc_name)

http://git-wip-us.apache.org/repos/asf/ambari/blob/680f1148/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.3.0/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.3.0/package/scripts/params_linux.py
b/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.3.0/package/scripts/params_linux.py
index c1138b3..400c87c 100644
--- a/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.3.0/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/SQOOP/1.4.4.3.0/package/scripts/params_linux.py
@@ -28,6 +28,7 @@ from resource_management.libraries.functions import StackFeature
 from resource_management.libraries.functions.stack_features import check_stack_feature
 from resource_management.libraries.functions.expect import expect
 from resource_management.libraries.functions.setup_atlas_hook import has_atlas_in_cluster
+from resource_management.core.exceptions import Fail
 
 
 # a map of the Ambari role to the component name
@@ -117,6 +118,7 @@ if "jdbc_drivers" in config['configurations']['sqoop-env']:
         jdbc_name = default("/hostLevelParams/custom_hsqldb_jdbc_name", None)
         previous_jdbc_jar_name = default("/hostLevelParams/previous_custom_hsqldb_jdbc_name",
None)
         jdbc_driver_name = "hsqldb"
+      else: raise Fail(format("JDBC driver '{driver_name}' not supported."))
     else:
       continue
     sqoop_jdbc_drivers_dict.append(jdbc_name)

http://git-wip-us.apache.org/repos/asf/ambari/blob/680f1148/ambari-server/src/main/resources/custom_actions/scripts/check_host.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/custom_actions/scripts/check_host.py b/ambari-server/src/main/resources/custom_actions/scripts/check_host.py
index a485415..3ca2909 100644
--- a/ambari-server/src/main/resources/custom_actions/scripts/check_host.py
+++ b/ambari-server/src/main/resources/custom_actions/scripts/check_host.py
@@ -319,6 +319,7 @@ class CheckHost(Script):
         jdbc_url = jdk_location + jdbc_driver_sqla_name
         jdbc_driver_class = JDBC_DRIVER_CLASS_SQLA
         jdbc_name = jdbc_driver_sqla_name
+    else: no_jdbc_error_message = format("'{db_name}' database type not supported.")
 
     if no_jdbc_error_message:
       Logger.warning(no_jdbc_error_message)

http://git-wip-us.apache.org/repos/asf/ambari/blob/680f1148/ambari-server/src/test/python/common-services/HIVE/test_jdbc_driver_config.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/common-services/HIVE/test_jdbc_driver_config.py
b/ambari-server/src/test/python/common-services/HIVE/test_jdbc_driver_config.py
new file mode 100644
index 0000000..e4d81b1
--- /dev/null
+++ b/ambari-server/src/test/python/common-services/HIVE/test_jdbc_driver_config.py
@@ -0,0 +1,66 @@
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+"""
+
+import os
+
+from resource_management.core.exceptions import Fail
+from stacks.utils.RMFTestCase import RMFTestCase
+
+import unittest
+
+class TestJdbcDriverConfig(RMFTestCase):
+  STACK_VERSION = "2.6"
+  CONFIG_DIR = os.path.join(os.path.dirname(__file__), '../configs')
+
+  def test_jdbc_type_0_12_0_2_0(self):
+    self.executeScript("HIVE/0.12.0.2.0/package/scripts/hive_server.py",
+                       classname="HiveServer",
+                       command="configure",
+                       target=RMFTestCase.TARGET_COMMON_SERVICES,
+                       stack_version=self.STACK_VERSION,
+                       config_file=os.path.join(self.CONFIG_DIR, "hive_default.json"))
+
+  def test_unsupported_jdbc_type_throws_error_0_12_0_2_0(self):
+    with self.assertRaises(Fail):
+      self.executeScript("HIVE/0.12.0.2.0/package/scripts/hive_server.py",
+                       classname="HiveServer",
+                       command="configure",
+                       target=RMFTestCase.TARGET_COMMON_SERVICES,
+                       stack_version=self.STACK_VERSION,
+                       config_file=os.path.join(self.CONFIG_DIR, "hive_unsupported_jdbc_type.json"))
+
+  def test_jdbc_type_2_1_0_3_0(self):
+    self.executeScript("HIVE/2.1.0.3.0/package/scripts/hive_server.py",
+                       classname="HiveServer",
+                       command="configure",
+                       target=RMFTestCase.TARGET_COMMON_SERVICES,
+                       stack_version=self.STACK_VERSION,
+                       config_file=os.path.join(self.CONFIG_DIR, "hive_default.json"))
+
+  def test_unsupported_jdbc_type_throws_error_2_1_0_3_0(self):
+    with self.assertRaises(Fail):
+      self.executeScript("HIVE/2.1.0.3.0/package/scripts/hive_server.py",
+                         classname="HiveServer",
+                         command="configure",
+                         target=RMFTestCase.TARGET_COMMON_SERVICES,
+                         stack_version=self.STACK_VERSION,
+                         config_file=os.path.join(self.CONFIG_DIR, "hive_unsupported_jdbc_type.json"))
+
+
+
+

http://git-wip-us.apache.org/repos/asf/ambari/blob/680f1148/ambari-server/src/test/python/common-services/RANGER/test_db_flavor_config.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/common-services/RANGER/test_db_flavor_config.py
b/ambari-server/src/test/python/common-services/RANGER/test_db_flavor_config.py
new file mode 100644
index 0000000..568e3fd
--- /dev/null
+++ b/ambari-server/src/test/python/common-services/RANGER/test_db_flavor_config.py
@@ -0,0 +1,63 @@
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+"""
+
+import os
+
+from resource_management.core.exceptions import Fail
+from stacks.utils.RMFTestCase import RMFTestCase
+
+import unittest
+
+class TestDbFlavorConfig(RMFTestCase):
+  STACK_VERSION = "2.6"
+  CONFIG_DIR = os.path.join(os.path.dirname(__file__), '../configs')
+
+
+  def test_db_flavor_0_4_0(self):
+    self.executeScript("RANGER/0.4.0/package/scripts/ranger_admin.py",
+                       classname="RangerAdmin",
+                       command="configure",
+                       target=RMFTestCase.TARGET_COMMON_SERVICES,
+                       stack_version=self.STACK_VERSION,
+                       config_file=os.path.join(self.CONFIG_DIR, "ranger_admin_default.json"))
+
+  def test_unsupported_db_flavor_0_4_0(self):
+    with self.assertRaises(Fail):
+      self.executeScript("RANGER/0.4.0/package/scripts/ranger_admin.py",
+                       classname="RangerAdmin",
+                       command="configure",
+                       target=RMFTestCase.TARGET_COMMON_SERVICES,
+                       stack_version=self.STACK_VERSION,
+                       config_file=os.path.join(self.CONFIG_DIR, "ranger_admin_unsupported_db_flavor.json"))
+
+  def test_db_flavor_1_0_0_3_0(self):
+    self.executeScript("RANGER/1.0.0.3.0/package/scripts/ranger_admin.py",
+                       classname="RangerAdmin",
+                       command="configure",
+                       target=RMFTestCase.TARGET_COMMON_SERVICES,
+                       stack_version=self.STACK_VERSION,
+                       config_file=os.path.join(self.CONFIG_DIR, "ranger_admin_default.json"))
+
+  def test_unsupported_db_flavor_1_0_0_3_0(self):
+    with self.assertRaises(Fail):
+      self.executeScript("RANGER/1.0.0.3.0/package/scripts/ranger_admin.py",
+                         classname="RangerAdmin",
+                         command="configure",
+                         target=RMFTestCase.TARGET_COMMON_SERVICES,
+                         stack_version=self.STACK_VERSION,
+                         config_file=os.path.join(self.CONFIG_DIR, "ranger_admin_unsupported_db_flavor.json"))
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/680f1148/ambari-server/src/test/python/common-services/RANGER_KMS/test_db_flavor_config.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/common-services/RANGER_KMS/test_db_flavor_config.py
b/ambari-server/src/test/python/common-services/RANGER_KMS/test_db_flavor_config.py
new file mode 100644
index 0000000..48654ee
--- /dev/null
+++ b/ambari-server/src/test/python/common-services/RANGER_KMS/test_db_flavor_config.py
@@ -0,0 +1,63 @@
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+"""
+
+import os
+
+from resource_management.core.exceptions import Fail
+from stacks.utils.RMFTestCase import RMFTestCase
+
+import unittest
+
+class TestDbFlavorConfig(RMFTestCase):
+  STACK_VERSION = "2.6"
+  CONFIG_DIR = os.path.join(os.path.dirname(__file__), '../configs')
+
+
+  def test_db_flavor_0_5_0_2_3(self):
+    self.executeScript("RANGER_KMS/0.5.0.2.3/package/scripts/kms_server.py",
+                       classname="KmsServer",
+                       command="configure",
+                       target=RMFTestCase.TARGET_COMMON_SERVICES,
+                       stack_version=self.STACK_VERSION,
+                       config_file=os.path.join(self.CONFIG_DIR, "ranger_kms_default.json"))
+
+  def test_unsupported_db_flavor_0_5_0_2_3(self):
+    with self.assertRaises(Fail):
+      self.executeScript("RANGER_KMS/0.5.0.2.3/package/scripts/kms_server.py",
+                       classname="KmsServer",
+                       command="configure",
+                       target=RMFTestCase.TARGET_COMMON_SERVICES,
+                       stack_version=self.STACK_VERSION,
+                       config_file=os.path.join(self.CONFIG_DIR, "ranger_kms_unsupported_db_flavor.json"))
+
+  def test_db_flavor_1_0_0_3_0(self):
+    self.executeScript("RANGER_KMS/1.0.0.3.0/package/scripts/kms_server.py",
+                       classname="KmsServer",
+                       command="configure",
+                       target=RMFTestCase.TARGET_COMMON_SERVICES,
+                       stack_version=self.STACK_VERSION,
+                       config_file=os.path.join(self.CONFIG_DIR, "ranger_kms_default.json"))
+
+  def test_unsupported_db_flavor_1_0_0_3_0(self):
+    with self.assertRaises(Fail):
+      self.executeScript("RANGER_KMS/1.0.0.3.0/package/scripts/kms_server.py",
+                         classname="KmsServer",
+                         command="configure",
+                         target=RMFTestCase.TARGET_COMMON_SERVICES,
+                         stack_version=self.STACK_VERSION,
+                         config_file=os.path.join(self.CONFIG_DIR, "ranger_kms_unsupported_db_flavor.json"))
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/680f1148/ambari-server/src/test/python/common-services/SQOOP/test_jdbc_driver_config.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/common-services/SQOOP/test_jdbc_driver_config.py
b/ambari-server/src/test/python/common-services/SQOOP/test_jdbc_driver_config.py
new file mode 100644
index 0000000..7bb809a
--- /dev/null
+++ b/ambari-server/src/test/python/common-services/SQOOP/test_jdbc_driver_config.py
@@ -0,0 +1,63 @@
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+"""
+
+import os
+
+from resource_management.core.exceptions import Fail
+from stacks.utils.RMFTestCase import RMFTestCase
+
+import unittest
+
+class TestJdbcDriverConfig(RMFTestCase):
+  STACK_VERSION = "2.6"
+  CONFIG_DIR = os.path.join(os.path.dirname(__file__), '../configs')
+
+
+  def test_jdbc_driver_1_4_4_2_0(self):
+    self.executeScript("SQOOP/1.4.4.2.0/package/scripts/sqoop_client.py",
+                       classname="SqoopClient",
+                       command="configure",
+                       target=RMFTestCase.TARGET_COMMON_SERVICES,
+                       stack_version=self.STACK_VERSION,
+                       config_file=os.path.join(self.CONFIG_DIR, "sqoop_default.json"))
+
+  def test_unsupported_jdbc_driver_1_4_4_2_0(self):
+    with self.assertRaises(Fail):
+      self.executeScript("SQOOP/1.4.4.2.0/package/scripts/sqoop_client.py",
+                       classname="SqoopClient",
+                       command="configure",
+                       target=RMFTestCase.TARGET_COMMON_SERVICES,
+                       stack_version=self.STACK_VERSION,
+                       config_file=os.path.join(self.CONFIG_DIR, "sqoop_unsupported_jdbc_driver.json"))
+
+  def test_jdbc_driver_1_4_4_3_0(self):
+    self.executeScript("SQOOP/1.4.4.3.0/package/scripts/sqoop_client.py",
+                       classname="SqoopClient",
+                       command="configure",
+                       target=RMFTestCase.TARGET_COMMON_SERVICES,
+                       stack_version=self.STACK_VERSION,
+                       config_file=os.path.join(self.CONFIG_DIR, "sqoop_default.json"))
+
+  def test_unsupported_jdbc_driver_1_4_4_3_0(self):
+    with self.assertRaises(Fail):
+      self.executeScript("SQOOP/1.4.4.3.0/package/scripts/sqoop_client.py",
+                         classname="SqoopClient",
+                         command="configure",
+                         target=RMFTestCase.TARGET_COMMON_SERVICES,
+                         stack_version=self.STACK_VERSION,
+                         config_file=os.path.join(self.CONFIG_DIR, "sqoop_unsupported_jdbc_driver.json"))
\ No newline at end of file


Mime
View raw message