Updated Branches:
  refs/heads/branch-1.2.5 94ee6f921 -> dff08e47e

AMBARI-2859 - Error encountered running ambari-server encrypt-passwords / 
setup-ganglia-https / setup-nagios-https


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

Branch: refs/heads/branch-1.2.5
Commit: dff08e47edc4de6a9454acd3b16db6dc71b62773
Parents: 94ee6f9
Author: tbeerbower <[email protected]>
Authored: Fri Aug 9 15:08:16 2013 -0400
Committer: tbeerbower <[email protected]>
Committed: Fri Aug 9 16:37:43 2013 -0400

----------------------------------------------------------------------
 ambari-server/src/main/python/ambari-server.py | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/dff08e47/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 0eb4f4a..7534d49 100755
--- a/ambari-server/src/main/python/ambari-server.py
+++ b/ambari-server/src/main/python/ambari-server.py
@@ -2589,7 +2589,9 @@ def encrypt_password(alias, password):
   properties = get_ambari_properties()
   if properties == -1:
     raise FatalException(1, None)
+  return get_encrypted_password(alias, password, properties)
 
+def get_encrypted_password(alias, password, properties):
   isSecure = get_is_secure(properties)
   (isPersisted, masterKeyFile) = get_is_persisted(properties)
   if isSecure:
@@ -2612,10 +2614,6 @@ def decrypt_password_for_alias(alias):
   if properties == -1:
     raise FatalException(1, None)
 
-  return get_encrypted_password(alias, password, properties)
-
-def get_encrypted_password(alias, password, properties):
-
   isSecure = get_is_secure(properties)
   (isPersisted, masterKeyFile) = get_is_persisted(properties)
   if isSecure:
@@ -3139,17 +3137,18 @@ def get_truststore_path(properties):
 
 def get_truststore_password(properties):
   truststore_password = 
properties.get_property(SSL_TRUSTSTORE_PASSWORD_PROPERTY)
+  isSecure = get_is_secure(properties)
   if truststore_password:
-    truststore_password = 
decrypt_password_for_alias(SSL_TRUSTSTORE_PASSWORD_ALIAS)
+    if isSecure:
+      truststore_password = 
decrypt_password_for_alias(SSL_TRUSTSTORE_PASSWORD_ALIAS)
   else:
     truststore_password = read_password("", ".*", "Password for TrustStore:", 
"Invalid characters in password")
     if truststore_password:
-      properties.process_pair(SECURITY_IS_ENCRYPTION_ENABLED, "true")
       encrypted_password = 
get_encrypted_password(SSL_TRUSTSTORE_PASSWORD_ALIAS, truststore_password, 
properties)
       properties.process_pair(SSL_TRUSTSTORE_PASSWORD_PROPERTY, 
encrypted_password)
 
   return truststore_password
-  
+
 def run_component_https_cmd(cmd):
   retcode, out, err = run_os_command(cmd)
 

Reply via email to