You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by zh...@apache.org on 2018/03/29 02:54:48 UTC
ranger git commit: RANGER-2044:Fix execute sql failure in db_setup.py
file of the admin.
Repository: ranger
Updated Branches:
refs/heads/master b6d45a261 -> ceaed3f3d
RANGER-2044:Fix execute sql failure in db_setup.py file of the admin.
Signed-off-by: zhangqiang2 <zh...@zte.com.cn>
Project: http://git-wip-us.apache.org/repos/asf/ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/ranger/commit/ceaed3f3
Tree: http://git-wip-us.apache.org/repos/asf/ranger/tree/ceaed3f3
Diff: http://git-wip-us.apache.org/repos/asf/ranger/diff/ceaed3f3
Branch: refs/heads/master
Commit: ceaed3f3dd590078a59ca9007fec3930542b6152
Parents: b6d45a2
Author: zhangqiang2 <zh...@zte.com.cn>
Authored: Tue Mar 27 14:33:40 2018 +0800
Committer: zhangqiang2 <zh...@zte.com.cn>
Committed: Thu Mar 29 10:54:30 2018 +0800
----------------------------------------------------------------------
security-admin/scripts/db_setup.py | 23 ++++++-----------------
1 file changed, 6 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ranger/blob/ceaed3f3/security-admin/scripts/db_setup.py
----------------------------------------------------------------------
diff --git a/security-admin/scripts/db_setup.py b/security-admin/scripts/db_setup.py
index 1689e5d..83ccc32 100644
--- a/security-admin/scripts/db_setup.py
+++ b/security-admin/scripts/db_setup.py
@@ -15,18 +15,12 @@
import os
import re
import sys
-import errno
import shlex
import platform
import logging
import subprocess
-import fileinput
from os.path import basename
-from subprocess import Popen,PIPE
-from datetime import date
import time
-import datetime
-from time import gmtime, strftime
import socket
globalDict = {}
@@ -80,7 +74,7 @@ def populate_global_dict():
read_config_file = open(os.path.join(RANGER_ADMIN_CONF,'install.properties'))
elif os_name == "WINDOWS":
read_config_file = open(os.path.join(RANGER_ADMIN_CONF,'install_config.properties'))
- library_path = os.path.join(RANGER_ADMIN_HOME,"cred","lib","*")
+ #library_path = os.path.join(RANGER_ADMIN_HOME,"cred","lib","*")
for each_line in read_config_file.read().split('\n') :
each_line = each_line.strip();
if len(each_line) == 0:
@@ -91,7 +85,7 @@ def populate_global_dict():
key , value = each_line.split("=",1)
key = key.strip()
if 'PASSWORD' in key:
- jceks_file_path = os.path.join(RANGER_ADMIN_HOME, 'jceks','ranger_db.jceks')
+ #jceks_file_path = os.path.join(RANGER_ADMIN_HOME, 'jceks','ranger_db.jceks')
#statuscode,value = call_keystore(library_path,key,'',jceks_file_path,'get')
#if statuscode == 1:
value = ''
@@ -607,7 +601,6 @@ class MysqlConf(BaseDB):
sys.exit(1)
def change_admin_default_password(self, xa_db_host, db_user, db_password, db_name,userName,oldPassword,newPassword):
- my_dict = {}
version = ""
className = "ChangePasswordUtil"
version = dbversionBasedOnUserName(userName)
@@ -1322,7 +1315,6 @@ class OracleConf(BaseDB):
sys.exit(1)
def change_admin_default_password(self, xa_db_host, db_user, db_password, db_name,userName,oldPassword,newPassword):
- my_dict = {}
version = ""
className = "ChangePasswordUtil"
version = dbversionBasedOnUserName(userName)
@@ -1992,7 +1984,6 @@ class PostgresConf(BaseDB):
sys.exit(1)
def change_admin_default_password(self, xa_db_host, db_user, db_password, db_name,userName,oldPassword,newPassword):
- my_dict = {}
version = ""
className = "ChangePasswordUtil"
version = dbversionBasedOnUserName(userName)
@@ -2624,7 +2615,6 @@ class SqlServerConf(BaseDB):
sys.exit(1)
def change_admin_default_password(self, xa_db_host, db_user, db_password, db_name,userName,oldPassword,newPassword):
- my_dict = {}
version = ""
className = "ChangePasswordUtil"
version = dbversionBasedOnUserName(userName)
@@ -3102,22 +3092,22 @@ class SqlAnywhereConf(BaseDB):
log("[I] Patch version updated", "info")
else:
if is_unix:
- query = get_cmd + " -query \"delete from x_db_version_h where version='%s' and active='N' and updated_by='%s';\" -c \;" %(version,client_host)
+ query = get_cmd1 + " -query \"delete from x_db_version_h where version='%s' and active='N' and updated_by='%s';\" -c \;" %(version,client_host)
jisql_log(query, db_password)
ret = subprocess.call(shlex.split(query))
elif os_name == "WINDOWS":
- query = get_cmd + " -query \"delete from x_db_version_h where version='%s' and active='N' and updated_by='%s';\" -c ;" %(version,client_host)
+ query = get_cmd1 + " -query \"delete from x_db_version_h where version='%s' and active='N' and updated_by='%s';\" -c ;" %(version,client_host)
jisql_log(query, db_password)
ret = subprocess.call(query)
log("[E] Updating patch version failed", "error")
sys.exit(1)
else:
if is_unix:
- query = get_cmd + " -query \"delete from x_db_version_h where version='%s' and active='N' and updated_by='%s';\" -c \;" %(version,client_host)
+ query = get_cmd1 + " -query \"delete from x_db_version_h where version='%s' and active='N' and updated_by='%s';\" -c \;" %(version,client_host)
jisql_log(query, db_password)
ret = subprocess.call(shlex.split(query))
elif os_name == "WINDOWS":
- query = get_cmd + " -query \"delete from x_db_version_h where version='%s' and active='N' and updated_by='%s';\" -c ;" %(version,client_host)
+ query = get_cmd1 + " -query \"delete from x_db_version_h where version='%s' and active='N' and updated_by='%s';\" -c ;" %(version,client_host)
jisql_log(query, db_password)
ret = subprocess.call(query)
log("[E] "+name + " import failed!","error")
@@ -3269,7 +3259,6 @@ class SqlAnywhereConf(BaseDB):
ret = subprocessCallWithRetry(shlex.split(query))
def change_admin_default_password(self, xa_db_host, db_user, db_password, db_name,userName,oldPassword,newPassword):
- my_dict = {}
version = ""
className = "ChangePasswordUtil"
version = dbversionBasedOnUserName(userName)