Removed hardcode in the LDAP server name
This allows external LDAPS-only server usage
Change-Id: Ia8b81d0f2275ffac167aeba7bab8f4e6804ad363
diff --git a/_states/jenkins_security.py b/_states/jenkins_security.py
index c20cc83..6442e2b 100644
--- a/_states/jenkins_security.py
+++ b/_states/jenkins_security.py
@@ -6,7 +6,7 @@
import hudson.security.*
import org.jenkinsci.plugins.*
-def server = 'ldap://{server}'
+def server = '{server}'
def rootDN = '{rootDN}'
def userSearchBase = '{userSearchBase}'
def userSearch = '{userSearch}'
@@ -61,7 +61,7 @@
Jenkins ldap state method
:param name: ldap state name
- :param server: ldap server host (without ldap://)
+ :param server: ldap server host
:param root_dn: root domain names
:param user_search_base:
:param manager_dn:
@@ -79,6 +79,9 @@
'comment': '',
}
result = False
+ if not server.startswith("ldap:") and not server.startswith("ldaps:"):
+ server = "ldap://{server}".format(server=server)
+
if test:
status = 'CREATED'
ret['changes'][name] = status