You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by me...@apache.org on 2018/12/19 12:00:58 UTC
[ranger] 35/36: RANGER-2295: Set specific Ranger version in patches
status entry table
This is an automated email from the ASF dual-hosted git repository.
mehul pushed a commit to branch ranger-1.2
in repository https://gitbox.apache.org/repos/asf/ranger.git
commit f2d06ade7ba1e4789442afa21a228d3603e24b0a
Author: Pradeep <pr...@apache.org>
AuthorDate: Wed Nov 28 14:44:55 2018 +0530
RANGER-2295: Set specific Ranger version in patches status entry table
---
security-admin/scripts/db_setup.py | 66 +++++++++++++++++++++++++++++++++++---
1 file changed, 61 insertions(+), 5 deletions(-)
diff --git a/security-admin/scripts/db_setup.py b/security-admin/scripts/db_setup.py
index c20b6a2..40dbfe6 100644
--- a/security-admin/scripts/db_setup.py
+++ b/security-admin/scripts/db_setup.py
@@ -1019,9 +1019,21 @@ class MysqlConf(BaseDB):
isSchemaCreated=True
else:
isImported=self.import_db_file(db_name, db_user, db_password, file_name)
- if (isImported==False):
+ if (isImported):
+ if is_unix:
+ query = get_cmd + " -query \"update x_db_version_h set inst_by='%s' where active='Y' and updated_by='localhost';\"" %(ranger_version)
+ jisql_log(query, db_password)
+ ret = subprocess.call(shlex.split(query))
+ elif os_name == "WINDOWS":
+ query = get_cmd + " -query \"update x_db_version_h set inst_by='%s' where active='Y' and updated_by='localhost';\" -c ;" %(ranger_version)
+ jisql_log(query, db_password)
+ ret = subprocess.call(query)
+ if ret == 0:
+ log("[I] Patches status entries updated from base ranger version to current installed ranger version:"+ranger_version, "info")
+ else:
log("[I] Unable to create DB schema, Please drop the database and try again" ,"info")
break
+
if isSchemaCreated == True:
if is_unix:
query = get_cmd + " -query \"update x_db_version_h set active='Y' where version='%s' and active='N' and updated_by='%s';\"" %(version,client_host)
@@ -1968,7 +1980,18 @@ class OracleConf(BaseDB):
isSchemaCreated=True
else:
isImported=self.import_db_file(db_name, db_user, db_password, file_name)
- if (isImported==False):
+ if (isImported):
+ if is_unix:
+ query = get_cmd + " -c \; -query \"update x_db_version_h set inst_by='%s' where active='Y' and updated_by='localhost';\"" %(ranger_version)
+ jisql_log(query, db_password)
+ ret = subprocess.call(shlex.split(query))
+ elif os_name == "WINDOWS":
+ query = get_cmd + " -query \"update x_db_version_h set inst_by='%s' where active='Y' and updated_by='localhost';\" -c ;" %(ranger_version)
+ jisql_log(query, db_password)
+ ret = subprocess.call(query)
+ if ret == 0:
+ log("[I] Patches status entries updated from base ranger version to current installed ranger version:"+ranger_version, "info")
+ else:
log("[I] Unable to create DB schema, Please drop the database and try again" ,"info")
break
@@ -2938,7 +2961,18 @@ class PostgresConf(BaseDB):
isSchemaCreated=True
else:
isImported=self.import_db_file(db_name, db_user, db_password, file_name)
- if (isImported==False):
+ if (isImported):
+ if is_unix:
+ query = get_cmd + " -query \"update x_db_version_h set inst_by='%s' where active='Y' and updated_by='localhost';\"" %(ranger_version)
+ jisql_log(query, db_password)
+ ret = subprocess.call(shlex.split(query))
+ elif os_name == "WINDOWS":
+ query = get_cmd + " -query \"update x_db_version_h set inst_by='%s' where active='Y' and updated_by='localhost';\" -c ;" %(ranger_version)
+ jisql_log(query, db_password)
+ ret = subprocess.call(query)
+ if ret == 0:
+ log("[I] Patches status entries updated from base ranger version to current installed ranger version:"+ranger_version, "info")
+ else:
log("[I] Unable to create DB schema, Please drop the database and try again" ,"info")
break
if isSchemaCreated == True:
@@ -3863,7 +3897,18 @@ class SqlServerConf(BaseDB):
isSchemaCreated=True
else:
isImported=self.import_db_file(db_name, db_user, db_password, file_name)
- if (isImported==False):
+ if (isImported):
+ if is_unix:
+ query = get_cmd + " -query \"update x_db_version_h set inst_by='%s' where active='Y' and updated_by='localhost';\" -c \;" %(ranger_version)
+ jisql_log(query, db_password)
+ ret = subprocess.call(shlex.split(query))
+ elif os_name == "WINDOWS":
+ query = get_cmd + " -query \"update x_db_version_h set inst_by='%s' where active='Y' and updated_by='localhost';\" -c ;" %(ranger_version)
+ jisql_log(query, db_password)
+ ret = subprocess.call(query)
+ if ret == 0:
+ log("[I] Patches status entries updated from base ranger version to current installed ranger version:"+ranger_version, "info")
+ else:
log("[I] Unable to create DB schema, Please drop the database and try again" ,"info")
break
if isSchemaCreated == True:
@@ -4801,7 +4846,18 @@ class SqlAnywhereConf(BaseDB):
isSchemaCreated=True
else:
isImported=self.import_db_file(db_name, db_user, db_password, file_name)
- if (isImported==False):
+ if (isImported):
+ if is_unix:
+ query = get_cmd + " -query \"update x_db_version_h set inst_by='%s' where active='Y' and updated_by='localhost';\" -c \;" %(ranger_version)
+ jisql_log(query, db_password)
+ ret = subprocess.call(shlex.split(query))
+ elif os_name == "WINDOWS":
+ query = get_cmd + " -query \"update x_db_version_h set inst_by='%s' where active='Y' and updated_by='localhost';\" -c ;" %(ranger_version)
+ jisql_log(query, db_password)
+ ret = subprocess.call(query)
+ if ret == 0:
+ log("[I] Patches status entries updated from base ranger version to current installed ranger version:"+ranger_version, "info")
+ else:
log("[I] Unable to create DB schema, Please drop the database and try again" ,"info")
break
if isSchemaCreated == True: