You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by rl...@apache.org on 2018/01/24 13:20:18 UTC

[ambari] 06/09: AMBARI-22797. Created constants to avoid typos

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

rlevas pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git

commit 14a42ad8745f414cc7220304a50d2c1485408dc8
Author: Sandor Molnar <sm...@hortonworks.com>
AuthorDate: Sun Jan 21 22:52:12 2018 +0100

    AMBARI-22797. Created constants to avoid typos
---
 ambari-server/src/main/python/ambari_server/setupSecurity.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/ambari-server/src/main/python/ambari_server/setupSecurity.py b/ambari-server/src/main/python/ambari_server/setupSecurity.py
index 7b33f72..f858198 100644
--- a/ambari-server/src/main/python/ambari_server/setupSecurity.py
+++ b/ambari-server/src/main/python/ambari_server/setupSecurity.py
@@ -81,6 +81,9 @@ PAM_CONFIG_FILE = 'pam.configuration'
 IS_LDAP_CONFIGURED = "ambari.ldap.authentication.enabled"
 LDAP_MGR_USERNAME_PROPERTY = "ambari.ldap.connectivity.bind_dn"
 LDAP_MGR_PASSWORD_FILENAME = "ldap-password.dat"
+LDAP_BIND_DN="ambari.ldap.connectivity.bind_dn"
+LDAP_ANONYMOUS_BIND="ambari.ldap.connectivity.anonymous_bind"
+LDAP_USE_SSL="ambari.ldap.connectivity.use_ssl"
 
 def read_master_key(isReset=False, options = None):
   passwordPattern = ".*"
@@ -677,7 +680,7 @@ def setup_ldap(options):
 
   ldap_property_list_reqd = init_ldap_properties_list_reqd(properties, options)
 
-  ldap_property_list_opt = ["ambari.ldap.connectivity.bind_dn",
+  ldap_property_list_opt = [LDAP_BIND_DN,
                             LDAP_MGR_PASSWORD_PROPERTY,
                             SSL_TRUSTSTORE_TYPE_PROPERTY,
                             SSL_TRUSTSTORE_PATH_PROPERTY,
@@ -699,7 +702,7 @@ def setup_ldap(options):
     if input is not None and input != "":
       ldap_property_value_map[ldap_prop.prop_name] = input
 
-  bindAnonymously = ldap_property_value_map["ambari.ldap.connectivity.anonymous_bind"]
+  bindAnonymously = ldap_property_value_map[LDAP_ANONYMOUS_BIND]
   anonymous = (bindAnonymously and bindAnonymously.lower() == 'true')
   mgr_password = None
   # Ask for manager credentials only if bindAnonymously is false
@@ -711,7 +714,7 @@ def setup_ldap(options):
     mgr_password = configure_ldap_password(options)
     ldap_property_value_map[LDAP_MGR_PASSWORD_PROPERTY] = mgr_password
 
-  useSSL = ldap_property_value_map["ambari.ldap.connectivity.use_ssl"]
+  useSSL = ldap_property_value_map[LDAP_USE_SSL]
   ldaps = (useSSL and useSSL.lower() == 'true')
   ts_password = None
 

-- 
To stop receiving notification emails like this one, please contact
rlevas@apache.org.