You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by dm...@apache.org on 2018/09/17 16:13:09 UTC

[ambari] branch branch-2.7 updated: AMBARI-24646 'ambari-server setup-ldap' fails with AttributeError when master_key is not persisted (#2330)

This is an automated email from the ASF dual-hosted git repository.

dmitriusan pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-2.7 by this push:
     new 80ecad6  AMBARI-24646 'ambari-server setup-ldap' fails with AttributeError when master_key is not persisted (#2330)
80ecad6 is described below

commit 80ecad698d0bb1c43788bc09b77d539fb937e402
Author: Lisnichenko Dmitro <dm...@apache.org>
AuthorDate: Mon Sep 17 19:13:01 2018 +0300

    AMBARI-24646 'ambari-server setup-ldap' fails with AttributeError when master_key is not persisted (#2330)
    
    * AMBARI-24646. 'ambari-server setup-ldap' fails with AttributeError when master_key is not persisted (dlysnichenko)
    
    * AMBARI-24646 'ambari-server setup-ldap' fails with AttributeError when master_key is not persisted - small fix
---
 .../src/main/python/ambari_server/serverConfiguration.py         | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/ambari-server/src/main/python/ambari_server/serverConfiguration.py b/ambari-server/src/main/python/ambari_server/serverConfiguration.py
index ca140d4..005966c 100644
--- a/ambari-server/src/main/python/ambari_server/serverConfiguration.py
+++ b/ambari-server/src/main/python/ambari_server/serverConfiguration.py
@@ -908,7 +908,7 @@ def read_passwd_for_alias(alias, masterKey="", options=None):
     with open(tempFilePath, 'w+'):
       os.chmod(tempFilePath, stat.S_IREAD | stat.S_IWRITE)
 
-    if options is not None and options.master_key is not None and options.master_key:
+    if options is not None and hasattr(options, 'master_key') and options.master_key is not None and options.master_key:
       masterKey = options.master_key
     if masterKey is None or masterKey == "":
       masterKey = "None"
@@ -1019,11 +1019,13 @@ def get_original_master_key(properties, options = None):
   masterKey = None
   while(input):
     try:
-      if options is not None and options.master_key is not None and options.master_key:
+      if options is not None and hasattr(options, 'master_key') and options.master_key is not None and options.master_key:
         masterKey = options.master_key
       if masterKey is None:
         masterKey = get_validated_string_input('Enter current Master Key: ',
                                                "", ".*", "", True, False)
+        if options is not None:
+          options.master_key = masterKey
     except KeyboardInterrupt:
       print_warning_msg('Exiting...')
       sys.exit(1)
@@ -1048,6 +1050,9 @@ def get_original_master_key(properties, options = None):
     if alias and masterKey:
       password = read_passwd_for_alias(alias, masterKey, options)
       if not password:
+        masterKey = None
+        if options is not None:
+          options.master_key = None
         print_error_msg ("ERROR: Master key does not match.")
         continue