Skip to content

Commit 0d92b06

Browse files
committed
Use one single var for hostname
1 parent a7d9bbb commit 0d92b06

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

slapd/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def __init__(
162162
self.suffix = suffix
163163
self.root_cn = root_cn
164164
self.root_pw = root_pw
165-
self.hostname = "127.0.0.1"
165+
self.host = host or "127.0.0.1"
166166

167167
self._proc = None
168168
self.port = port or self._avail_tcpport()
@@ -172,7 +172,7 @@ def __init__(
172172
)
173173
self._slapd_conf = os.path.join(self.testrundir, "slapd.d")
174174
self._db_directory = os.path.join(self.testrundir, "openldap-data")
175-
self.ldap_uri = "ldap://%s:%d/" % (host or self.hostname, self.port)
175+
self.ldap_uri = "ldap://%s:%d/" % (self.host, self.port)
176176
self.debug = debug
177177
have_ldapi = hasattr(socket, "AF_UNIX")
178178
if have_ldapi:
@@ -273,7 +273,7 @@ def _avail_tcpport(self):
273273
"""
274274
sock = socket.socket()
275275
try:
276-
sock.bind((self.hostname, 0))
276+
sock.bind((self.host, 0))
277277
port = sock.getsockname()[1]
278278
finally:
279279
sock.close()

0 commit comments

Comments
 (0)