View | Details | Raw Unified | Return to bug 40470
Collapse All | Expand All

(-)a/ucs-test-ucsschool/90_ucsschool/141_check_DNS_settings (-11 / +5 lines)
 Lines 7-13    Link Here 
7
##  - domaincontroller_slave
7
##  - domaincontroller_slave
8
## tags: [apptest, ucsschool]
8
## tags: [apptest, ucsschool]
9
9
10
from ldap.dn import escape_dn_chars
10
from ldap.filter import filter_format
11
from univention.testing.ucr import UCSTestConfigRegistry
11
from univention.testing.ucr import UCSTestConfigRegistry
12
import univention.testing.utils as utils
12
import univention.testing.utils as utils
13
13
 Lines 15-31   import univention.testing.utils as utils Link Here 
15
def main():
15
def main():
16
	with UCSTestConfigRegistry() as ucr:
16
	with UCSTestConfigRegistry() as ucr:
17
		lo = utils.get_ldap_connection()
17
		lo = utils.get_ldap_connection()
18
		zone_name = ucr.get('domainname')
18
		zone_name = '%s.%s.' % (ucr.get('hostname'), ucr.get('domainname'))
19
		print 'Search for DNS zones with nsRecord=%r' % (zone_name,)
20
		zones = lo.search(filter_format('nSRecord=%s', zone_name))
19
21
20
		school_server = ucr.get('hostname') + "." + zone_name
22
		assert not zones, "The school server is listed as DNS server, which it must not be: %r" % (zones,)
21
22
		zone = lo.get('zoneName=%s,cn=dns,%s' % (escape_dn_chars(zone_name), ucr.get('ldap/base')))
23
		dns_servers = zone.get('nSRecord', [])
24
		dns_servers = [dns_server.strip('.') for dns_server in dns_servers]
25
26
		print "DNS Servers  : %r" % (dns_servers,)
27
		print "School Server: %r" % (school_server,)
28
		assert school_server not in dns_servers, "The school server %r is listed as DNS server, which it must not be." % (school_server,)
29
23
30
24
31
if __name__ == '__main__':
25
if __name__ == '__main__':

Return to bug 40470