You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by ga...@apache.org on 2016/04/29 11:34:58 UTC
[3/4] incubator-ranger git commit: RANGER-952 : Tagadmin user name
should be configurable in tagsync module
RANGER-952 : Tagadmin user name should be configurable in tagsync module
Signed-off-by: Gautam Borad <ga...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/847a7381
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/847a7381
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/847a7381
Branch: refs/heads/master
Commit: 847a73815b061b393c720a593864b07165bd656e
Parents: 296de33
Author: Pradeep Agrawal <pr...@freestoneinfotech.com>
Authored: Tue Apr 26 10:37:37 2016 +0530
Committer: Gautam Borad <ga...@apache.org>
Committed: Fri Apr 29 15:04:06 2016 +0530
----------------------------------------------------------------------
tagsync/conf/templates/ranger-tagsync-template.xml | 4 ++++
tagsync/scripts/setup.py | 3 +++
tagsync/scripts/updatetagadminpassword.py | 7 ++++++-
.../org/apache/ranger/tagsync/process/TagSyncConfig.java | 11 ++++++++++-
tagsync/src/main/resources/ranger-tagsync-default.xml | 4 ++--
tagsync/src/main/resources/ranger-tagsync-site.xml | 2 +-
6 files changed, 26 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/847a7381/tagsync/conf/templates/ranger-tagsync-template.xml
----------------------------------------------------------------------
diff --git a/tagsync/conf/templates/ranger-tagsync-template.xml b/tagsync/conf/templates/ranger-tagsync-template.xml
index 3d656df..554a4e0 100644
--- a/tagsync/conf/templates/ranger-tagsync-template.xml
+++ b/tagsync/conf/templates/ranger-tagsync-template.xml
@@ -83,4 +83,8 @@
<name>hadoop_conf</name>
<value></value>
</property>
+ <property>
+ <name>ranger.tagsync.dest.ranger.username</name>
+ <value></value>
+ </property>
</configuration>
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/847a7381/tagsync/scripts/setup.py
----------------------------------------------------------------------
diff --git a/tagsync/scripts/setup.py b/tagsync/scripts/setup.py
index cd91c07..ec35a10 100755
--- a/tagsync/scripts/setup.py
+++ b/tagsync/scripts/setup.py
@@ -390,6 +390,9 @@ def main():
tagsyncKSPath = mergeProps['ranger.tagsync.keystore.filename']
+ if ('ranger.tagsync.dest.ranger.username' not in mergeProps):
+ mergeProps['ranger.tagsync.dest.ranger.username'] = 'rangertagsync'
+
if (tagsyncKSPath == ''):
mergeProps['ranger.tagsync.dest.ranger.password'] = 'rangertagsync'
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/847a7381/tagsync/scripts/updatetagadminpassword.py
----------------------------------------------------------------------
diff --git a/tagsync/scripts/updatetagadminpassword.py b/tagsync/scripts/updatetagadminpassword.py
index 445d89b..d2efef5 100644
--- a/tagsync/scripts/updatetagadminpassword.py
+++ b/tagsync/scripts/updatetagadminpassword.py
@@ -113,10 +113,14 @@ def main():
log("[I] TAGSYNC_KEYSTORE_FILENAME:" + str(TAGSYNC_KEYSTORE_FILENAME),"info")
TAGSYNC_TAGADMIN_ALIAS="tagadmin.user.password"
TAGSYNC_TAGADMIN_PASSWORD = ''
- TAGSYNC_TAGADMIN_USERNAME = 'rangertagsync'
+ TAGSYNC_TAGADMIN_USERNAME = ''
unix_user = "ranger"
unix_group = "ranger"
+ while TAGSYNC_TAGADMIN_USERNAME == "":
+ print "Enter tagadmin user name:"
+ TAGSYNC_TAGADMIN_USERNAME=raw_input()
+
while TAGSYNC_TAGADMIN_PASSWORD == "":
TAGSYNC_TAGADMIN_PASSWORD=getpass.getpass("Enter tagadmin user password:")
@@ -129,6 +133,7 @@ def main():
ret=subprocess.call(shlex.split(cmd))
if ret == 0:
if os.path.isfile(CFG_FILE):
+ write_properties_to_xml(CFG_FILE,"ranger.tagsync.dest.ranger.username",TAGSYNC_TAGADMIN_USERNAME)
write_properties_to_xml(CFG_FILE,"ranger.tagsync.keystore.filename",TAGSYNC_KEYSTORE_FILENAME)
else:
log("[E] Required file not found: ["+CFG_FILE+"]","error")
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/847a7381/tagsync/src/main/java/org/apache/ranger/tagsync/process/TagSyncConfig.java
----------------------------------------------------------------------
diff --git a/tagsync/src/main/java/org/apache/ranger/tagsync/process/TagSyncConfig.java b/tagsync/src/main/java/org/apache/ranger/tagsync/process/TagSyncConfig.java
index d14a9ce..6e2902e 100644
--- a/tagsync/src/main/java/org/apache/ranger/tagsync/process/TagSyncConfig.java
+++ b/tagsync/src/main/java/org/apache/ranger/tagsync/process/TagSyncConfig.java
@@ -53,6 +53,8 @@ public class TagSyncConfig extends Configuration {
private static final String TAGSYNC_DEST_RANGER_PASSWORD_ALIAS = "tagadmin.user.password";
+ private static final String TAGSYNC_TAGADMIN_USERNAME_PROP = "ranger.tagsync.dest.ranger.username";
+
private static final String TAGSYNC_TAGADMIN_PASSWORD_PROP = "ranger.tagsync.dest.ranger.password";
private static final String TAGSYNC_TAGADMIN_CONNECTION_CHECK_INTERVAL_PROP = "ranger.tagsync.dest.ranger.connection.check.interval";
@@ -270,7 +272,14 @@ public class TagSyncConfig extends Configuration {
}
static public String getTagAdminUserName(Properties prop) {
- return DEFAULT_TAGADMIN_USERNAME;
+ String userName=null;
+ if(prop!=null && prop.containsKey(TAGSYNC_TAGADMIN_USERNAME_PROP)){
+ userName=prop.getProperty(TAGSYNC_TAGADMIN_USERNAME_PROP);
+ }
+ if(StringUtils.isBlank(userName)){
+ userName=DEFAULT_TAGADMIN_USERNAME;
+ }
+ return userName;
}
static public String getAtlasSslConfigFileName(Properties prop) {
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/847a7381/tagsync/src/main/resources/ranger-tagsync-default.xml
----------------------------------------------------------------------
diff --git a/tagsync/src/main/resources/ranger-tagsync-default.xml b/tagsync/src/main/resources/ranger-tagsync-default.xml
index 131e319..08afc42 100644
--- a/tagsync/src/main/resources/ranger-tagsync-default.xml
+++ b/tagsync/src/main/resources/ranger-tagsync-default.xml
@@ -34,7 +34,7 @@
<description></description>
</property>
<property>
- <name>ranger.tagsync.dest.ranger.password</name>
- <value></value>
+ <name>ranger.tagsync.dest.ranger.username</name>
+ <value>rangertagsync</value>
</property>
</configuration>
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/847a7381/tagsync/src/main/resources/ranger-tagsync-site.xml
----------------------------------------------------------------------
diff --git a/tagsync/src/main/resources/ranger-tagsync-site.xml b/tagsync/src/main/resources/ranger-tagsync-site.xml
index aa2357a..30ba3d7 100644
--- a/tagsync/src/main/resources/ranger-tagsync-site.xml
+++ b/tagsync/src/main/resources/ranger-tagsync-site.xml
@@ -82,7 +82,7 @@
<value />
</property>
<property>
- <name>ranger.tagsync.dest.ranger.password</name>
+ <name>ranger.tagsync.dest.ranger.username</name>
<value>rangertagsync</value>
</property>