You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sw...@apache.org on 2013/07/17 19:22:40 UTC
[1/2] git commit: AMBARI-2674. If the LDAP manager password is
entered as a blank value on the first try,
it will always be a blank. Unit Test. (swagle)
Updated Branches:
refs/heads/trunk 227560211 -> 5e3e1e005
AMBARI-2674. If the LDAP manager password is entered as a blank value on the first try, it will always be a blank. Unit Test. (swagle)
Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/5e3e1e00
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/5e3e1e00
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/5e3e1e00
Branch: refs/heads/trunk
Commit: 5e3e1e005a72c419d2f37b3797c94978b8c57d74
Parents: 07effbf
Author: Siddharth Wagle <sw...@hortonworks.com>
Authored: Wed Jul 17 10:15:59 2013 -0700
Committer: Siddharth Wagle <sw...@hortonworks.com>
Committed: Wed Jul 17 10:19:16 2013 -0700
----------------------------------------------------------------------
.../src/test/python/TestAmbaryServer.py | 34 +++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/5e3e1e00/ambari-server/src/test/python/TestAmbaryServer.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/TestAmbaryServer.py b/ambari-server/src/test/python/TestAmbaryServer.py
index 5128f4d..c46419d 100644
--- a/ambari-server/src/test/python/TestAmbaryServer.py
+++ b/ambari-server/src/test/python/TestAmbaryServer.py
@@ -3462,7 +3462,39 @@ MIIFHjCCAwYCCQDpHKOBI+Lt0zANBgkqhkiG9w0BAQUFADBRMQswCQYDVQQGEwJV
self.assertTrue(read_password_method.called)
sys.stdout = sys.__stdout__
-
+
+ @patch.object(ambari_server, 'get_validated_string_input')
+ def test_read_password(self, get_validated_string_input_method):
+ out = StringIO.StringIO()
+ sys.stdout = out
+
+ passwordDefault = ""
+ passwordPrompt = 'Enter Manager Password* : '
+ passwordPattern = ".*"
+ passwordDescr = "Invalid characters in password."
+
+ get_validated_string_input_method.side_effect = ['', 'aaa', 'aaa']
+ password = ambari_server.read_password(passwordDefault, passwordPattern,
+ passwordPrompt, passwordDescr)
+ self.assertTrue(3, get_validated_string_input_method.call_count)
+ self.assertEquals('aaa', password)
+
+ get_validated_string_input_method.reset_mock()
+ get_validated_string_input_method.side_effect = ['aaa', 'aaa']
+ password = ambari_server.read_password(passwordDefault, passwordPattern,
+ passwordPrompt, passwordDescr)
+ self.assertTrue(2, get_validated_string_input_method.call_count)
+ self.assertEquals('aaa', password)
+
+ get_validated_string_input_method.reset_mock()
+ get_validated_string_input_method.side_effect = ['aaa']
+ password = ambari_server.read_password('aaa', passwordPattern,
+ passwordPrompt, passwordDescr)
+ self.assertTrue(1, get_validated_string_input_method.call_count)
+ self.assertEquals('aaa', password)
+
+ sys.stdout = sys.__stdout__
+
def test_generate_random_string(self):
random_str_len = 100
str1 = ambari_server.generate_random_string(random_str_len)
[2/2] git commit: AMBARI-2674. If the LDAP manager password is
entered as a blank value on the first try, it will always be a blank. (swagle)
Posted by sw...@apache.org.
AMBARI-2674. If the LDAP manager password is entered as a blank value on the first try, it will always be a blank. (swagle)
Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/07effbf6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/07effbf6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/07effbf6
Branch: refs/heads/trunk
Commit: 07effbf665120b19ef52d9a98c580f9d3fa25341
Parents: 2275602
Author: Siddharth Wagle <sw...@hortonworks.com>
Authored: Wed Jul 17 09:56:26 2013 -0700
Committer: Siddharth Wagle <sw...@hortonworks.com>
Committed: Wed Jul 17 10:19:16 2013 -0700
----------------------------------------------------------------------
ambari-server/src/main/python/ambari-server.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/07effbf6/ambari-server/src/main/python/ambari-server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari-server.py b/ambari-server/src/main/python/ambari-server.py
index 940c3af..5a63ee0 100755
--- a/ambari-server/src/main/python/ambari-server.py
+++ b/ambari-server/src/main/python/ambari-server.py
@@ -1001,14 +1001,16 @@ def read_password(passwordDefault=PG_DEFAULT_PASSWORD,
if not password:
print 'Password cannot be blank.'
- read_password(passwordDefault, passwordPattern, passwordPrompt, passwordDescr)
+ return read_password(passwordDefault, passwordPattern, passwordPrompt,
+ passwordDescr)
if password != passwordDefault:
password1 = get_validated_string_input("Re-enter password: ",
passwordDefault, passwordPattern, passwordDescr, True)
if password != password1:
print "Passwords do not match"
- password = read_password(passwordDefault, passwordPattern, passwordPrompt, passwordDescr)
+ return read_password(passwordDefault, passwordPattern, passwordPrompt,
+ passwordDescr)
return password