Repository: incubator-ranger Updated Branches: refs/heads/ranger-0.5 fc66b15f2 -> 4a5a4f29b
RANGER-625:Change db flavor input parameter value from SQLAnywhere to SQLA Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/4a5a4f29 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/4a5a4f29 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/4a5a4f29 Branch: refs/heads/ranger-0.5 Commit: 4a5a4f29bb8a0cc6ecda51cdc9031bb6d510a6b3 Parents: fc66b15 Author: Velmurugan Periasamy <[email protected]> Authored: Mon Aug 24 21:05:11 2015 -0700 Committer: Velmurugan Periasamy <[email protected]> Committed: Mon Aug 24 21:05:11 2015 -0700 ---------------------------------------------------------------------- agents-common/scripts/enable-agent.sh | 2 +- hbase-agent/scripts/install.sh | 2 +- hdfs-agent/scripts/install.sh | 2 +- hive-agent/scripts/install.sh | 2 +- jisql/src/main/java/org/apache/util/sql/Jisql.java | 1 + kms/scripts/db_setup.py | 2 +- kms/scripts/dba_script.py | 4 ++-- kms/scripts/install.properties | 2 +- kms/scripts/setup.sh | 4 ++-- knox-agent/scripts/install.sh | 2 +- security-admin/scripts/db_setup.py | 7 +++---- security-admin/scripts/dba_script.py | 10 +++++----- security-admin/scripts/install.properties | 2 +- security-admin/scripts/setup.sh | 4 ++-- .../main/java/org/apache/ranger/biz/RangerBizUtil.java | 6 ++++-- storm-agent/scripts/install.sh | 2 +- 16 files changed, 28 insertions(+), 26 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/4a5a4f29/agents-common/scripts/enable-agent.sh ---------------------------------------------------------------------- diff --git a/agents-common/scripts/enable-agent.sh b/agents-common/scripts/enable-agent.sh index 6adb2c4..9f67709 100755 --- a/agents-common/scripts/enable-agent.sh +++ b/agents-common/scripts/enable-agent.sh @@ -382,7 +382,7 @@ then then export XAAUDIT_DB_JDBC_URL="jdbc:sqlserver://${audit_db_hostname};databaseName=${audit_db_name}" export XAAUDIT_DB_JDBC_DRIVER="com.microsoft.sqlserver.jdbc.SQLServerDriver" - elif [ "${db_flavor}" = "SQLANYWHERE" ] + elif [ "${db_flavor}" = "SQLA" ] then export XAAUDIT_DB_JDBC_URL="jdbc:sqlanywhere:database=${audit_db_name};host=${audit_db_hostname}" export XAAUDIT_DB_JDBC_DRIVER="sap.jdbc4.sqlanywhere.IDriver" http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/4a5a4f29/hbase-agent/scripts/install.sh ---------------------------------------------------------------------- diff --git a/hbase-agent/scripts/install.sh b/hbase-agent/scripts/install.sh index 116beab..a7b67f3 100644 --- a/hbase-agent/scripts/install.sh +++ b/hbase-agent/scripts/install.sh @@ -312,7 +312,7 @@ then newPropertyValue="com.microsoft.sqlserver.jdbc.SQLServerDriver" updatePropertyToFile $propertyName $newPropertyValue $to_file fi -if [ "${DB_FLAVOR}" == "SQLANYWHERE" ] +if [ "${DB_FLAVOR}" == "SQLA" ] then audit_db_hostname=`grep '^XAAUDIT.DB.HOSTNAME' ${install_dir}/install.properties | awk -F= '{ print $2 }'` audit_db_name=`grep '^XAAUDIT.DB.DATABASE_NAME' ${install_dir}/install.properties | awk -F= '{ print $2 }'` http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/4a5a4f29/hdfs-agent/scripts/install.sh ---------------------------------------------------------------------- diff --git a/hdfs-agent/scripts/install.sh b/hdfs-agent/scripts/install.sh index e9215fd..9eef8da 100644 --- a/hdfs-agent/scripts/install.sh +++ b/hdfs-agent/scripts/install.sh @@ -319,7 +319,7 @@ then newPropertyValue="com.microsoft.sqlserver.jdbc.SQLServerDriver" updatePropertyToFile $propertyName $newPropertyValue $to_file fi -if [ "${DB_FLAVOR}" == "SQLANYWHERE" ] +if [ "${DB_FLAVOR}" == "SQLA" ] then audit_db_hostname=`grep '^XAAUDIT.DB.HOSTNAME' ${install_dir}/install.properties | awk -F= '{ print $2 }'` audit_db_name=`grep '^XAAUDIT.DB.DATABASE_NAME' ${install_dir}/install.properties | awk -F= '{ print $2 }'` http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/4a5a4f29/hive-agent/scripts/install.sh ---------------------------------------------------------------------- diff --git a/hive-agent/scripts/install.sh b/hive-agent/scripts/install.sh index 74c6e56..cf7180d 100644 --- a/hive-agent/scripts/install.sh +++ b/hive-agent/scripts/install.sh @@ -296,7 +296,7 @@ then newPropertyValue="com.microsoft.sqlserver.jdbc.SQLServerDriver" updatePropertyToFile $propertyName $newPropertyValue $to_file fi -if [ "${DB_FLAVOR}" == "SQLANYWHERE" ] +if [ "${DB_FLAVOR}" == "SQLA" ] then audit_db_hostname=`grep '^XAAUDIT.DB.HOSTNAME' ${install_dir}/install.properties | awk -F= '{ print $2 }'` audit_db_name=`grep '^XAAUDIT.DB.DATABASE_NAME' ${install_dir}/install.properties | awk -F= '{ print $2 }'` http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/4a5a4f29/jisql/src/main/java/org/apache/util/sql/Jisql.java ---------------------------------------------------------------------- diff --git a/jisql/src/main/java/org/apache/util/sql/Jisql.java b/jisql/src/main/java/org/apache/util/sql/Jisql.java index cf7563c..9c74356 100644 --- a/jisql/src/main/java/org/apache/util/sql/Jisql.java +++ b/jisql/src/main/java/org/apache/util/sql/Jisql.java @@ -755,6 +755,7 @@ public class Jisql { + sqle.getErrorCode()); sqle = sqle.getNextException(); } + System.out.println("java.library.path:"+System.getProperty("java.library.path")); } /** http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/4a5a4f29/kms/scripts/db_setup.py ---------------------------------------------------------------------- diff --git a/kms/scripts/db_setup.py b/kms/scripts/db_setup.py index 9dbeb04..61940cc 100644 --- a/kms/scripts/db_setup.py +++ b/kms/scripts/db_setup.py @@ -557,7 +557,7 @@ def main(argv): xa_sqlObj = SqlServerConf(xa_db_host, SQLSERVER_CONNECTOR_JAR, JAVA_BIN) xa_db_core_file = os.path.join(RANGER_KMS_HOME , sqlserver_core_file) - elif XA_DB_FLAVOR == "SQLANYWHERE": + elif XA_DB_FLAVOR == "SQLA": if not os_name == "WINDOWS" : if os.environ['LD_LIBRARY_PATH'] == "": log("[E] ---------- LD_LIBRARY_PATH environment property not defined, aborting installation. ----------", "error") http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/4a5a4f29/kms/scripts/dba_script.py ---------------------------------------------------------------------- diff --git a/kms/scripts/dba_script.py b/kms/scripts/dba_script.py index 0830af4..03e0a19 100644 --- a/kms/scripts/dba_script.py +++ b/kms/scripts/dba_script.py @@ -1138,7 +1138,7 @@ def main(argv): else: XA_DB_FLAVOR='' while XA_DB_FLAVOR == "": - log("Enter db flavour{MYSQL|ORACLE|POSTGRES|MSSQL|SQLANYWHERE} :","info") + log("Enter db flavour{MYSQL|ORACLE|POSTGRES|MSSQL|SQLA} :","info") XA_DB_FLAVOR=raw_input() XA_DB_FLAVOR = XA_DB_FLAVOR.upper() @@ -1242,7 +1242,7 @@ def main(argv): xa_sqlObj = SqlServerConf(xa_db_host, SQLSERVER_CONNECTOR_JAR, JAVA_BIN) xa_db_core_file = os.path.join(RANGER_KMS_HOME,sqlserver_core_file) - elif XA_DB_FLAVOR == "SQLANYWHERE": + elif XA_DB_FLAVOR == "SQLA": if not os_name == "WINDOWS" : if os.environ['LD_LIBRARY_PATH'] == "": log("[E] ---------- LD_LIBRARY_PATH environment property not defined, aborting installation. ----------", "error") http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/4a5a4f29/kms/scripts/install.properties ---------------------------------------------------------------------- diff --git a/kms/scripts/install.properties b/kms/scripts/install.properties index bad7f20..563a0e0 100755 --- a/kms/scripts/install.properties +++ b/kms/scripts/install.properties @@ -23,7 +23,7 @@ PYTHON_COMMAND_INVOKER=python -#DB_FLAVOR=MYSQL|ORACLE|POSTGRES|MSSQL|SQLANYWHERE +#DB_FLAVOR=MYSQL|ORACLE|POSTGRES|MSSQL|SQLA DB_FLAVOR=MYSQL # # The executable path to be used to invoke command-line MYSQL http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/4a5a4f29/kms/scripts/setup.sh ---------------------------------------------------------------------- diff --git a/kms/scripts/setup.sh b/kms/scripts/setup.sh index 1410f46..2e7dd8e 100755 --- a/kms/scripts/setup.sh +++ b/kms/scripts/setup.sh @@ -277,7 +277,7 @@ sanity_check_files() { log "[E] ${sqlserver_core_file} does not exists" ; exit 1; fi fi - if [ "${DB_FLAVOR}" == "SQLANYWHERE" ] + if [ "${DB_FLAVOR}" == "SQLA" ] then if [ "${LD_LIBRARY_PATH}" == "" ] then @@ -410,7 +410,7 @@ update_properties() { updatePropertyToFilePy $propertyName $newPropertyValue $to_file fi - if [ "${DB_FLAVOR}" == "SQLANYWHERE" ] + if [ "${DB_FLAVOR}" == "SQLA" ] then propertyName=ranger.ks.jpa.jdbc.url newPropertyValue="jdbc:sqlanywhere:database=${db_name};host=${DB_HOST}" http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/4a5a4f29/knox-agent/scripts/install.sh ---------------------------------------------------------------------- diff --git a/knox-agent/scripts/install.sh b/knox-agent/scripts/install.sh index 163dbc5..271a2d4 100644 --- a/knox-agent/scripts/install.sh +++ b/knox-agent/scripts/install.sh @@ -215,7 +215,7 @@ then newPropertyValue="com.microsoft.sqlserver.jdbc.SQLServerDriver" updatePropertyToFile $propertyName $newPropertyValue $to_file fi -if [ "${DB_FLAVOR}" == "SQLANYWHERE" ] +if [ "${DB_FLAVOR}" == "SQLA" ] then audit_db_hostname=`grep '^XAAUDIT.DB.HOSTNAME' ${install_dir}/install.properties | awk -F= '{ print $2 }'` audit_db_name=`grep '^XAAUDIT.DB.DATABASE_NAME' ${install_dir}/install.properties | awk -F= '{ print $2 }'` http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/4a5a4f29/security-admin/scripts/db_setup.py ---------------------------------------------------------------------- diff --git a/security-admin/scripts/db_setup.py b/security-admin/scripts/db_setup.py index a010e19..1edc628 100644 --- a/security-admin/scripts/db_setup.py +++ b/security-admin/scripts/db_setup.py @@ -1211,6 +1211,7 @@ class SqlAnywhereConf(BaseDB): sys.exit(1) def check_table(self, db_name, db_user, db_password, TABLE_NAME): + self.set_options(db_name, db_user, db_password, TABLE_NAME) get_cmd = self.get_jisql_cmd(db_user, db_password, db_name) if os_name == "LINUX": query = get_cmd + " -c \; -query \"SELECT name FROM sysobjects where name = '%s' and type='U';\"" %(TABLE_NAME) @@ -1277,7 +1278,6 @@ class SqlAnywhereConf(BaseDB): def import_auditdb_patches(self, xa_sqlObj,xa_db_host, audit_db_host, db_name, audit_db_name, db_user, audit_db_user, db_password, audit_db_password, file_name, TABLE_NAME): log("[I] --------- Checking XA_ACCESS_AUDIT table to apply audit db patches --------- ","info") - self.set_options(audit_db_name, db_user, db_password, TABLE_NAME) output = self.check_table(audit_db_name, db_user, db_password, TABLE_NAME) if output == True: name = basename(file_name) @@ -1326,7 +1326,6 @@ class SqlAnywhereConf(BaseDB): log("[I] --------- Check audit user connection --------- ","info") self.check_connection(audit_db_name, audit_db_user, audit_db_password) log("[I] --------- Check audit table exists --------- ","info") - self.set_options(audit_db_name, db_user, db_password, TABLE_NAME) output = self.check_table(audit_db_name, db_user, db_password, TABLE_NAME) if output == False: self.import_db_file(audit_db_name ,db_user, db_password, file_name) @@ -1522,7 +1521,7 @@ def main(argv): xa_patch_file = os.path.join(RANGER_ADMIN_HOME , sqlserver_patches) audit_patch_file = os.path.join(RANGER_ADMIN_HOME ,sqlserver_auditdb_patches) - elif XA_DB_FLAVOR == "SQLANYWHERE": + elif XA_DB_FLAVOR == "SQLA": if not os_name == "WINDOWS" : if os.environ['LD_LIBRARY_PATH'] == "": log("[E] ---------- LD_LIBRARY_PATH environment property not defined, aborting installation. ----------", "error") @@ -1558,7 +1557,7 @@ def main(argv): audit_sqlObj = SqlServerConf(audit_db_host, SQLSERVER_CONNECTOR_JAR, JAVA_BIN) audit_db_file = os.path.join(RANGER_ADMIN_HOME , sqlserver_audit_file) - elif AUDIT_DB_FLAVOR == "SQLANYWHERE": + elif AUDIT_DB_FLAVOR == "SQLA": SQLANYWHERE_CONNECTOR_JAR = globalDict['SQL_CONNECTOR_JAR'] audit_sqlObj = SqlAnywhereConf(audit_db_host, SQLANYWHERE_CONNECTOR_JAR, JAVA_BIN) audit_db_file = os.path.join(RANGER_ADMIN_HOME , sqlanywhere_audit_file) http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/4a5a4f29/security-admin/scripts/dba_script.py ---------------------------------------------------------------------- diff --git a/security-admin/scripts/dba_script.py b/security-admin/scripts/dba_script.py index 0d5d573..90ae561 100644 --- a/security-admin/scripts/dba_script.py +++ b/security-admin/scripts/dba_script.py @@ -1352,7 +1352,7 @@ def main(argv): else: XA_DB_FLAVOR='' while XA_DB_FLAVOR == "": - log("Enter db flavour{MYSQL|ORACLE|POSTGRES|MSSQL|SQLANYWHERE} :","info") + log("Enter db flavour{MYSQL|ORACLE|POSTGRES|MSSQL|SQLA} :","info") XA_DB_FLAVOR=raw_input() AUDIT_DB_FLAVOR = XA_DB_FLAVOR @@ -1530,7 +1530,7 @@ def main(argv): xa_db_core_file = os.path.join(RANGER_ADMIN_HOME,sqlserver_core_file) xa_patch_file = os.path.join(RANGER_ADMIN_HOME,sqlserver_patches) - elif XA_DB_FLAVOR == "SQLANYWHERE": + elif XA_DB_FLAVOR == "SQLA": if not os_name == "WINDOWS" : if os.environ['LD_LIBRARY_PATH'] == "": log("[E] ---------- LD_LIBRARY_PATH environment property not defined, aborting installation. ----------", "error") @@ -1576,7 +1576,7 @@ def main(argv): audit_sqlObj = SqlServerConf(audit_db_host, SQLSERVER_CONNECTOR_JAR, JAVA_BIN) audit_db_file = os.path.join(RANGER_ADMIN_HOME,sqlserver_audit_file) - elif AUDIT_DB_FLAVOR == "SQLANYWHERE": + elif AUDIT_DB_FLAVOR == "SQLA": SQLANYWHERE_CONNECTOR_JAR=CONNECTOR_JAR audit_sqlObj = SqlAnywhereConf(audit_db_host, SQLANYWHERE_CONNECTOR_JAR, JAVA_BIN) audit_db_file = os.path.join(RANGER_ADMIN_HOME,sqlanywhere_audit_file) @@ -1600,7 +1600,7 @@ def main(argv): logFile("===============================================\n") xa_sqlObj.create_rangerdb_user(xa_db_root_user, db_user, db_password, xa_db_root_password,dryMode) xa_sqlObj.create_db(xa_db_root_user, xa_db_root_password, db_name, db_user, db_password,dryMode) - if not XA_DB_FLAVOR == "SQLANYWHERE": + if not XA_DB_FLAVOR == "SQLA": xa_sqlObj.grant_xa_db_user(xa_db_root_user, db_name, db_user, db_password, xa_db_root_password, is_revoke,dryMode) audit_sqlObj.create_auditdb_user(xa_db_host, audit_db_host, db_name, audit_db_name, xa_db_root_user, audit_db_root_user, db_user, audit_db_user, xa_db_root_password, audit_db_root_password, db_password, audit_db_password, DBA_MODE,dryMode) logFile("===============================================\n") @@ -1610,7 +1610,7 @@ def main(argv): log("[I] ---------- Creating Ranger Admin database ----------","info") xa_sqlObj.create_db(xa_db_root_user, xa_db_root_password, db_name, db_user, db_password,dryMode) log("[I] ---------- Granting permission to Ranger Admin db user ----------","info") - if not XA_DB_FLAVOR == "SQLANYWHERE": + if not XA_DB_FLAVOR == "SQLA": xa_sqlObj.grant_xa_db_user(xa_db_root_user, db_name, db_user, db_password, xa_db_root_password, is_revoke,dryMode) # Ranger Admin DB Host AND Ranger Audit DB Host are Different OR Same if audit_store == "db": http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/4a5a4f29/security-admin/scripts/install.properties ---------------------------------------------------------------------- diff --git a/security-admin/scripts/install.properties b/security-admin/scripts/install.properties index 294b0e8..4618ee3 100644 --- a/security-admin/scripts/install.properties +++ b/security-admin/scripts/install.properties @@ -23,7 +23,7 @@ PYTHON_COMMAND_INVOKER=python -#DB_FLAVOR=MYSQL|ORACLE|POSTGRES|MSSQL|SQLANYWHERE +#DB_FLAVOR=MYSQL|ORACLE|POSTGRES|MSSQL|SQLA DB_FLAVOR=MYSQL # # The executable path to be used to invoke command-line MYSQL http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/4a5a4f29/security-admin/scripts/setup.sh ---------------------------------------------------------------------- diff --git a/security-admin/scripts/setup.sh b/security-admin/scripts/setup.sh index a88b264..4fc1cef 100755 --- a/security-admin/scripts/setup.sh +++ b/security-admin/scripts/setup.sh @@ -303,7 +303,7 @@ sanity_check_files() { log "[E] ${sqlserver_core_file} does not exists" ; exit 1; fi fi - if [ "${DB_FLAVOR}" == "SQLANYWHERE" ] + if [ "${DB_FLAVOR}" == "SQLA" ] then if [ "${LD_LIBRARY_PATH}" == "" ] then @@ -887,7 +887,7 @@ update_properties() { updatePropertyToFilePy $propertyName $newPropertyValue $to_file_ranger fi - if [ "${DB_FLAVOR}" == "SQLANYWHERE" ] + if [ "${DB_FLAVOR}" == "SQLA" ] then propertyName=ranger.jpa.jdbc.url newPropertyValue="jdbc:sqlanywhere:database=${db_name};host=${DB_HOST}" http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/4a5a4f29/security-admin/src/main/java/org/apache/ranger/biz/RangerBizUtil.java ---------------------------------------------------------------------- diff --git a/security-admin/src/main/java/org/apache/ranger/biz/RangerBizUtil.java b/security-admin/src/main/java/org/apache/ranger/biz/RangerBizUtil.java index a536a1a..689e165 100644 --- a/security-admin/src/main/java/org/apache/ranger/biz/RangerBizUtil.java +++ b/security-admin/src/main/java/org/apache/ranger/biz/RangerBizUtil.java @@ -123,7 +123,7 @@ public class RangerBizUtil { auditDBType = PropertiesUtil.getProperty("ranger.audit.source.type", auditDBType).toLowerCase(); - + logger.info("java.library.path is " + System.getProperty("java.library.path")); logger.info("Audit datasource is " + auditDBType); random = new Random(); } @@ -1370,7 +1370,9 @@ public class RangerBizUtil { return AppConstants.DB_FLAVOR_SQLSERVER; } else if (StringUtils.containsIgnoreCase(propertyValue, "sqlanywhere")) { return AppConstants.DB_FLAVOR_SQLANYWHERE; - } else { + } else if (StringUtils.containsIgnoreCase(propertyValue, "sqla")) { + return AppConstants.DB_FLAVOR_SQLANYWHERE; + }else { if(logger.isDebugEnabled()) { logger.debug("DB Falvor could not be determined from property - " + propertyName + "=" + propertyValue); } http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/4a5a4f29/storm-agent/scripts/install.sh ---------------------------------------------------------------------- diff --git a/storm-agent/scripts/install.sh b/storm-agent/scripts/install.sh index 5b7674a..ab57bb9 100644 --- a/storm-agent/scripts/install.sh +++ b/storm-agent/scripts/install.sh @@ -258,7 +258,7 @@ then newPropertyValue="com.microsoft.sqlserver.jdbc.SQLServerDriver" updatePropertyToFile $propertyName $newPropertyValue $to_file fi -if [ "${DB_FLAVOR}" == "SQLANYWHERE" ] +if [ "${DB_FLAVOR}" == "SQLA" ] then audit_db_hostname=`grep '^XAAUDIT.DB.HOSTNAME' ${install_dir}/install.properties | awk -F= '{ print $2 }'` audit_db_name=`grep '^XAAUDIT.DB.DATABASE_NAME' ${install_dir}/install.properties | awk -F= '{ print $2 }'`
