Yuvipanda has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/242044

Change subject: tools: Remove ldapspportlib use from toolschecker
......................................................................

tools: Remove ldapspportlib use from toolschecker

Bug: T114063
Change-Id: If12a8a4fc50414d2186c6d72708c89c96978c265
---
M modules/toollabs/files/toolschecker.py
1 file changed, 8 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/44/242044/1

diff --git a/modules/toollabs/files/toolschecker.py 
b/modules/toollabs/files/toolschecker.py
index b53d18b..7279f83 100644
--- a/modules/toollabs/files/toolschecker.py
+++ b/modules/toollabs/files/toolschecker.py
@@ -1,7 +1,6 @@
 import ConfigParser
 import flask
 import ldap
-import ldapsupportlib
 import os
 import psycopg2
 import pymysql
@@ -66,11 +65,17 @@
 @check('/ldap')
 def ldap_query_check():
     # Run a simple known query and verify that ldap returns something
-    ldapConn = ldapsupportlib.LDAPSupportLib().connect()
+
+    with open('/etc/ldap.yaml') as f:
+        config = yaml.safe_load(f)
+    conn = ldap.initialize('ldap://%s:389' % config['servers'][0])
+    conn.protocol_version = ldap.VERSION3
+    conn.start_tls_s()
+    conn.simple_bind_s(config['server'], config['password'])
 
     query = '(cn=testlabs)'
     base = 'ou=projects,dc=wikimedia,dc=org'
-    result = ldapConn.search_s(base, ldap.SCOPE_SUBTREE, query)
+    result = conn.search_s(base, ldap.SCOPE_SUBTREE, query)
     if len(result) > 0:
         return True
     return False

-- 
To view, visit https://gerrit.wikimedia.org/r/242044
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If12a8a4fc50414d2186c6d72708c89c96978c265
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Yuvipanda <yuvipa...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to