|
118 |
print "removing sAMAccountName=dns-%s" % (names.hostname) |
118 |
print "removing sAMAccountName=dns-%s" % (names.hostname) |
119 |
dn = msg[0].dn |
119 |
dn = msg[0].dn |
120 |
samdb.delete(dn) |
120 |
samdb.delete(dn) |
|
|
121 |
time.sleep(1) |
121 |
except Exception: |
122 |
except Exception: |
122 |
print "exception while removing sAMAccountName=dns-%s" % (names.hostname) |
123 |
print "exception while removing sAMAccountName=dns-%s" % (names.hostname) |
123 |
pass |
124 |
pass |
|
132 |
names.netbiosname.lower(), names.dnsdomain.lower()) |
133 |
names.netbiosname.lower(), names.dnsdomain.lower()) |
133 |
}) |
134 |
}) |
134 |
|
135 |
|
135 |
account_created = False |
136 |
try: |
136 |
count = 0 |
137 |
setup_add_ldif(samdb, setup_path("provision_dns_add_samba.ldif"), { |
137 |
while not account_created: |
138 |
"DNSDOMAIN": names.dnsdomain, |
138 |
try: |
139 |
"DOMAINDN": names.domaindn, |
139 |
setup_add_ldif(samdb, setup_path("provision_dns_add_samba.ldif"), { |
140 |
"DNSPASS_B64": b64encode(dnspass.encode('utf-16-le')), |
140 |
"DNSDOMAIN": names.dnsdomain, |
141 |
"HOSTNAME" : names.hostname, |
141 |
"DOMAINDN": names.domaindn, |
142 |
"DNSNAME" : '%s.%s' % ( |
142 |
"DNSPASS_B64": b64encode(dnspass.encode('utf-16-le')), |
143 |
names.netbiosname.lower(), names.dnsdomain.lower()) |
143 |
"HOSTNAME" : names.hostname, |
144 |
}) |
144 |
"DNSNAME" : '%s.%s' % ( |
145 |
account_created = True |
145 |
names.netbiosname.lower(), names.dnsdomain.lower()) |
146 |
except: |
146 |
}) |
147 |
print "Samdb denied creation of dns-%s" % (names.hostname) |
147 |
account_created = True |
148 |
sys.exit(1) |
148 |
except: |
|
|
149 |
count += 1 |
150 |
if count > 300: |
151 |
print 'ERROR: failed to create dns-$hostname' |
152 |
sys.exit(1) |
153 |
print "Waiting for RID pool" |
154 |
time.sleep(1) |