From c781e8a57d3d05fa07729dbccff07bc1fab9d8e8 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Mon, 10 Aug 2009 16:24:10 -0400 Subject: Add a new objectclass, ipaObject, that will add a UUID to many IPA objects ipaObject is defined as an auxiliary objectclass so it is up to the plugin author to ensure that the objectclass is included an a UUID generated. ipaUniqueId is a MUST attribute so if you include the objectclass you must ensure that the uuid is generated. This also fixes up some unrelated unit test failures. --- ipalib/plugins/host.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'ipalib/plugins/host.py') diff --git a/ipalib/plugins/host.py b/ipalib/plugins/host.py index fe46d2d5..809ec319 100644 --- a/ipalib/plugins/host.py +++ b/ipalib/plugins/host.py @@ -29,6 +29,7 @@ from ipalib import api, crud, errors, util from ipalib import Object from ipalib import Str, Flag from ipalib.plugins.service import split_principal +from ipalib import uuid _container_dn = api.env.container_host _default_attributes = [ @@ -166,7 +167,7 @@ class host_add(crud.Create): # FIXME: add this attribute to cn=ipaconfig # config = ldap.get_ipa_config()[1] # kw['objectclass'] = config.get('ipahostobjectclasses') - entry_attrs['objectclass'] = ['nshost', 'ipahost', 'pkiuser'] + entry_attrs['objectclass'] = ['ipaobject', 'nshost', 'ipahost', 'pkiuser'] if 'userpassword' not in entry_attrs: entry_attrs['krbprincipalname'] = 'host/%s@%s' % ( @@ -178,6 +179,8 @@ class host_add(crud.Create): elif 'krbprincipalaux' in entry_attrs['objectclass']: entry_attrs['objectclass'].remove('krbprincipalaux') + entry_attrs['ipauniqueid'] = str(uuid.uuid1()) + ldap.add_entry(dn, entry_attrs) return ldap.get_entry(dn, entry_attrs.keys()) -- cgit