Repository: incubator-ranger
Updated Branches:
  refs/heads/master 8336e122a -> 0f4d0abde


RANGER-1059: updatetagadminpassword.py script should use the username from 
ranger-tagsync-site

Signed-off-by: Madhan Neethiraj <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/0f4d0abd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/0f4d0abd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/0f4d0abd

Branch: refs/heads/master
Commit: 0f4d0abde162a0d021da04f32e05b20c6c2f5a57
Parents: 8336e12
Author: Abhay Kulkarni <[email protected]>
Authored: Thu Jun 23 16:24:35 2016 -0700
Committer: Madhan Neethiraj <[email protected]>
Committed: Mon Jun 27 13:39:17 2016 -0700

----------------------------------------------------------------------
 tagsync/scripts/updatetagadminpassword.py       | 24 ++++++++++++++------
 .../src/main/resources/ranger-tagsync-site.xml  |  4 ++++
 2 files changed, 21 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/0f4d0abd/tagsync/scripts/updatetagadminpassword.py
----------------------------------------------------------------------
diff --git a/tagsync/scripts/updatetagadminpassword.py 
b/tagsync/scripts/updatetagadminpassword.py
index 0b1f2ca..2c89e83 100644
--- a/tagsync/scripts/updatetagadminpassword.py
+++ b/tagsync/scripts/updatetagadminpassword.py
@@ -120,7 +120,8 @@ def main():
        FILENAME_PROPERTY_NAME=''
 
        while ENDPOINT == "" or not (ENDPOINT == "ATLAS" or ENDPOINT == 
"RANGER"):
-               print "Enter Destination NAME (Ranger/Atlas):"
+               sys.stdout.write('Enter Destination NAME (Ranger/Atlas):')
+               sys.stdout.flush()
                ENDPOINT=raw_input()
                ENDPOINT = ENDPOINT.upper()
 
@@ -142,19 +143,28 @@ def main():
 
        KEYSTORE_FILENAME = globalDict[FILENAME_PROPERTY_NAME]
 
-       log("[I] " + KEYSTORE_FILENAME_PROMPT + ":" + 
str(KEYSTORE_FILENAME),"info")
+       if KEYSTORE_FILENAME == "":
+               log("[E] " + FILENAME_PROPERTY_NAME + " is not 
specified.","error")
+               return
+
+       log("[D] " + KEYSTORE_FILENAME_PROMPT + ":" + 
str(KEYSTORE_FILENAME),"debug")
+
        unix_user = "ranger"
        unix_group = "ranger"
 
-       while USERNAME == "":
-               print "Enter " + ENDPOINT + " user name:"
-               USERNAME=raw_input()
+       USERNAME = globalDict[USERNAME_PROPERTY_NAME]
+
+       if USERNAME == "":
+               if ENDPOINT == "RANGER":
+                       USERNAME = 'rangertagsync'
+               else:
+                       USERNAME = 'admin'
 
        while PASSWORD == "":
-               PASSWORD=getpass.getpass("Enter " + ENDPOINT + " user 
password:")
+               PASSWORD=getpass.getpass("Enter " + " password for " + ENDPOINT 
+ " user " + USERNAME + ":")
 
        if KEYSTORE_FILENAME != "" or USERNAME != "" or PASSWORD != "":
-               log("[I] Storing " + ENDPOINT + " tagsync password in 
credential store:","info")
+               log("[I] Storing password for " + ENDPOINT + " user " + 
USERNAME + " in credential store:","info")
                cmd="%s -cp lib/* org.apache.ranger.credentialapi.buildks 
create %s -value %s  -provider jceks://file%s" 
%(JAVA_BIN,ALIAS,PASSWORD,KEYSTORE_FILENAME)
                ret=subprocess.call(shlex.split(cmd))
                if ret == 0:

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/0f4d0abd/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 1effe55..3542ae2 100644
--- a/tagsync/src/main/resources/ranger-tagsync-site.xml
+++ b/tagsync/src/main/resources/ranger-tagsync-site.xml
@@ -46,6 +46,10 @@
                <value>http://localhost:21000</value>
        </property>
        <property>
+               <name>ranger.tagsync.source.atlasrest.username</name>
+               <value>admin</value>
+       </property>
+       <property>
                
<name>ranger.tagsync.source.atlasrest.download.interval.millis</name>
                <value>900000</value>
        </property>

Reply via email to