|
39 |
import univention.admin.handlers |
39 |
import univention.admin.handlers |
40 |
import univention.admin.syntax |
40 |
import univention.admin.syntax |
41 |
import univention.admin.localization |
41 |
import univention.admin.localization |
|
|
42 |
import univention.admin.uexceptions |
42 |
from univention.admin import configRegistry |
43 |
from univention.admin import configRegistry |
43 |
|
44 |
|
44 |
translation = univention.admin.localization.translation('univention.admin.handlers.nagios') |
45 |
translation = univention.admin.localization.translation('univention.admin.handlers.nagios') |
Lines 377-388
def _ldap_modlist(self):
|
Link Here
|
---|
|
377 |
if self.hasChanged('assignedHosts'): |
378 |
if self.hasChanged('assignedHosts'): |
378 |
hostlist = [] |
379 |
hostlist = [] |
379 |
for hostdn in self.info.get('assignedHosts', []): |
380 |
for hostdn in self.info.get('assignedHosts', []): |
380 |
domain = self.lo.getAttr(hostdn, 'associatedDomain') |
381 |
try: |
381 |
cn = self.lo.getAttr(hostdn, 'cn') |
382 |
host = self.lo.get(hostdn, ['associatedDomain', 'cn'], required=True) |
382 |
if not domain: |
383 |
cn = host['cn'] |
383 |
domain = [configRegistry.get("domainname")] |
384 |
except univention.admin.uexceptions.noObject: |
384 |
fqdn = "%s.%s" % (cn[0], domain[0]) |
385 |
raise univention.admin.uexceptions.valueError('%r does not exists' % (hostdn,)) |
385 |
hostlist.append(fqdn) |
386 |
except KeyError: |
|
|
387 |
raise univention.admin.uexceptions.valueError('%r has no cn attribute' % (hostdn,)) |
388 |
|
389 |
domain = host.get('associatedDomain', [configRegistry.get("domainname")]) |
390 |
hostlist.append("%s.%s" % (cn[0], domain[0])) |
386 |
|
391 |
|
387 |
ml.insert(0, ('univentionNagiosHostname', self.oldattr.get('univentionNagiosHostname', []), hostlist)) |
392 |
ml.insert(0, ('univentionNagiosHostname', self.oldattr.get('univentionNagiosHostname', []), hostlist)) |
388 |
|
393 |
|