Repository: ambari
Updated Branches:
  refs/heads/trunk d5ae6ae03 -> e94e3ff9e


AMBARI-13847. Ranger smart config - AD url missing ldap:// (or ldaps://). 
(jaimin)


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

Branch: refs/heads/trunk
Commit: e94e3ff9e407efdb7695818473619c2919a1c29a
Parents: d5ae6ae
Author: Jaimin Jetly <jai...@hortonworks.com>
Authored: Thu Nov 12 11:07:33 2015 -0800
Committer: Jaimin Jetly <jai...@hortonworks.com>
Committed: Thu Nov 12 11:10:39 2015 -0800

----------------------------------------------------------------------
 .../resources/stacks/HDP/2.0.6/services/stack_advisor.py     | 6 +++++-
 .../main/resources/stacks/HDP/2.3/services/stack_advisor.py  | 6 +++++-
 .../test/python/stacks/2.0.6/common/test_stack_advisor.py    | 8 ++++----
 .../src/test/python/stacks/2.3/common/test_stack_advisor.py  | 2 +-
 4 files changed, 15 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e94e3ff9/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py 
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
index 7181122..878b2cd 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
@@ -318,7 +318,11 @@ class HDP206StackAdvisor(DefaultStackAdvisor):
         if 'authentication.ldap.managerDn' in serverProperties:
           putUserSyncProperty('SYNC_LDAP_BIND_DN', 
serverProperties['authentication.ldap.managerDn'])
         if 'authentication.ldap.primaryUrl' in serverProperties:
-          putUserSyncProperty('SYNC_LDAP_URL', 
serverProperties['authentication.ldap.primaryUrl'])
+          ldap_protocol =  'ldap://'
+          if 'authentication.ldap.useSSL' in serverProperties and 
serverProperties['authentication.ldap.useSSL'] == 'true':
+            ldap_protocol =  'ldaps://'
+          ldapUrl = ldap_protocol + 
serverProperties['authentication.ldap.primaryUrl'] if 
serverProperties['authentication.ldap.primaryUrl'] else 
serverProperties['authentication.ldap.primaryUrl']
+          putUserSyncProperty('SYNC_LDAP_URL', ldapUrl)
         if 'authentication.ldap.userObjectClass' in serverProperties:
           putUserSyncProperty('SYNC_LDAP_USER_OBJECT_CLASS', 
serverProperties['authentication.ldap.userObjectClass'])
         if 'authentication.ldap.usernameAttribute' in serverProperties:

http://git-wip-us.apache.org/repos/asf/ambari/blob/e94e3ff9/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py 
b/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
index e421abe..ff85099 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
@@ -458,7 +458,11 @@ class HDP23StackAdvisor(HDP22StackAdvisor):
       if 'authentication.ldap.managerDn' in serverProperties:
         putRangerUgsyncSite('ranger.usersync.ldap.binddn', 
serverProperties['authentication.ldap.managerDn'])
       if 'authentication.ldap.primaryUrl' in serverProperties:
-        putRangerUgsyncSite('ranger.usersync.ldap.url', 
serverProperties['authentication.ldap.primaryUrl'])
+        ldap_protocol =  'ldap://'
+        if 'authentication.ldap.useSSL' in serverProperties and 
serverProperties['authentication.ldap.useSSL'] == 'true':
+          ldap_protocol =  'ldaps://'
+        ldapUrl = ldap_protocol + 
serverProperties['authentication.ldap.primaryUrl'] if 
serverProperties['authentication.ldap.primaryUrl'] else 
serverProperties['authentication.ldap.primaryUrl']
+        putRangerUgsyncSite('ranger.usersync.ldap.url', ldapUrl)
       if 'authentication.ldap.userObjectClass' in serverProperties:
         putRangerUgsyncSite('ranger.usersync.ldap.user.objectclass', 
serverProperties['authentication.ldap.userObjectClass'])
       if 'authentication.ldap.usernameAttribute' in serverProperties:

http://git-wip-us.apache.org/repos/asf/ambari/blob/e94e3ff9/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py 
b/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
index aaa65f4..a97ddc7 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
@@ -803,12 +803,12 @@ class TestHDP206StackAdvisor(TestCase):
       "authentication.ldap.bindAnonymously" : "false",
       "authentication.ldap.baseDn" : "dc=apache,dc=org",
       "authentication.ldap.groupNamingAttr" : "cn",
-      "authentication.ldap.primaryUrl" : "c6403.ambari.apache.org:389",
+      "authentication.ldap.primaryUrl" : "c6403.ambari.apache.org:636",
       "authentication.ldap.userObjectClass" : "posixAccount",
-      "authentication.ldap.secondaryUrl" : "c6403.ambari.apache.org:389",
+      "authentication.ldap.secondaryUrl" : "c6403.ambari.apache.org:636",
       "authentication.ldap.usernameAttribute" : "uid",
       "authentication.ldap.dnAttribute" : "dn",
-      "authentication.ldap.useSSL" : "false",
+      "authentication.ldap.useSSL" : "true",
       "authentication.ldap.managerPassword" : 
"/etc/ambari-server/conf/ldap-password.dat",
       "authentication.ldap.groupMembershipAttr" : "memberUid",
       "authentication.ldap.groupObjectClass" : "posixGroup",
@@ -824,7 +824,7 @@ class TestHDP206StackAdvisor(TestCase):
       'ranger-env': {'properties': {}},
       'usersync-properties': {
         'properties': {
-          'SYNC_LDAP_URL': 'c6403.ambari.apache.org:389',
+          'SYNC_LDAP_URL': 'ldaps://c6403.ambari.apache.org:636',
           'SYNC_LDAP_BIND_DN': 'uid=hdfs,ou=people,ou=dev,dc=apache,dc=org',
           'SYNC_LDAP_USER_OBJECT_CLASS': 'posixAccount',
           'SYNC_LDAP_USER_NAME_ATTRIBUTE': 'uid'

http://git-wip-us.apache.org/repos/asf/ambari/blob/e94e3ff9/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py 
b/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py
index d6b0c07..f1467a7 100644
--- a/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py
@@ -1283,7 +1283,7 @@ class TestHDP23StackAdvisor(TestCase):
           'ranger.usersync.ldap.binddn': 
'uid=hdfs,ou=people,ou=dev,dc=apache,dc=org',
           'ranger.usersync.ldap.user.nameattribute': 'uid',
           'ranger.usersync.ldap.user.objectclass': 'posixAccount',
-          'ranger.usersync.ldap.url': 'c6403.ambari.apache.org:389',
+          'ranger.usersync.ldap.url': 'ldap://c6403.ambari.apache.org:389',
           'ranger.usersync.ldap.searchBase': 'dc=apache,dc=org'
         }
       },

Reply via email to