summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2008-11-14 18:04:57 -0500
committerRob Crittenden <rcritten@redhat.com>2008-11-14 18:05:29 -0500
commitc513743e7c9a611d0b3b0abaf13b79d6237ed6da (patch)
treec75dbfd4c70963b4fd6458f263f99d9fa1125f75
parentf8f4058014fda80f776bc177a5fba22009fb5836 (diff)
downloadfreeipa-c513743e7c9a611d0b3b0abaf13b79d6237ed6da.tar.gz
freeipa-c513743e7c9a611d0b3b0abaf13b79d6237ed6da.tar.xz
freeipa-c513743e7c9a611d0b3b0abaf13b79d6237ed6da.zip
Add autmount-specific location and default entries
-rw-r--r--ipa_server/plugins/b_ldap.py7
-rw-r--r--ipa_server/updates/automount.update19
-rw-r--r--ipalib/constants.py1
-rw-r--r--ipalib/plugins/f_automount.py16
4 files changed, 33 insertions, 10 deletions
diff --git a/ipa_server/plugins/b_ldap.py b/ipa_server/plugins/b_ldap.py
index a93f97f0c..0f9239355 100644
--- a/ipa_server/plugins/b_ldap.py
+++ b/ipa_server/plugins/b_ldap.py
@@ -117,7 +117,7 @@ class ldap(CrudBackend):
return object_type
- def find_entry_dn(self, key_attribute, primary_key, object_type=None):
+ def find_entry_dn(self, key_attribute, primary_key, object_type=None, base=None):
"""
Find an existing entry's dn from an attribute
"""
@@ -133,7 +133,10 @@ class ldap(CrudBackend):
self.dn.escape_dn_chars(primary_key)
)
- search_base = "%s, %s" % (self.api.env.container_accounts, self.api.env.basedn)
+ if not base:
+ base = self.api.env.container_accounts
+
+ search_base = "%s, %s" % (base, self.api.env.basedn)
entry = servercore.get_sub_entry(search_base, search_filter, ['dn', 'objectclass'])
diff --git a/ipa_server/updates/automount.update b/ipa_server/updates/automount.update
index 25d45a092..13d9a6df0 100644
--- a/ipa_server/updates/automount.update
+++ b/ipa_server/updates/automount.update
@@ -33,3 +33,22 @@ add:objectClasses:
DESC 'Automount information' SUP top STRUCTURAL
MUST ( automountKey $ automountInformation ) MAY description
X-ORIGIN 'RFC 2307bis' )
+
+# Add the default automount entries
+
+dn: cn=automount,$SUFFIX
+add:objectClass: nsContainer
+add:cn: automount
+
+dn: automountmapname=auto.master,cn=automount,$SUFFIX
+add:objectClass: automountMap
+add:automountMapName: auto.master
+
+dn: automountkey=/-,automountmapname=auto.master,cn=automount,$SUFFIX
+add:objectClass: automount
+add:automountKey: '/-'
+add:automountInformation: auto.direct
+
+dn: automountmapname=auto.direct,cn=automount,$SUFFIX
+add:objectClass: automountMap
+add:automountMapName: auto.direct
diff --git a/ipalib/constants.py b/ipalib/constants.py
index 6210e6c8f..7e562b530 100644
--- a/ipalib/constants.py
+++ b/ipalib/constants.py
@@ -72,6 +72,7 @@ DEFAULT_CONFIG = (
('container_service', 'cn=services,cn=accounts'),
('container_host', 'cn=computers,cn=accounts'),
('container_hostgroup', 'cn=hostgroups,cn=accounts'),
+ ('container_automount', 'cn=automount'),
# Ports, hosts, and URIs:
('lite_xmlrpc_port', 8888),
diff --git a/ipalib/plugins/f_automount.py b/ipalib/plugins/f_automount.py
index fba9e12c4..7a251572e 100644
--- a/ipalib/plugins/f_automount.py
+++ b/ipalib/plugins/f_automount.py
@@ -53,7 +53,7 @@ def make_automount_dn(mapname):
import ldap
return 'automountmapname=%s,%s,%s' % (
ldap.dn.escape_dn_chars(mapname),
- api.env.container_accounts,
+ api.env.container_automount,
api.env.basedn,
)
@@ -133,7 +133,7 @@ class automount_addkey(crud.Add):
ldap = self.api.Backend.ldap
# use find_entry_dn instead of make_automap_dn so we can confirm that
# the map exists
- map_dn = ldap.find_entry_dn("automountmapname", mapname, "automountmap")
+ map_dn = ldap.find_entry_dn("automountmapname", mapname, "automountmap", api.env.container_automount)
kw['dn'] = "automountkey=%s,%s" % (kw['automountkey'], map_dn)
kw['objectClass'] = ['automount']
@@ -193,7 +193,7 @@ class automount_delkey(crud.Del):
:param kw: "key" the key to be removed
"""
ldap = self.api.Backend.ldap
- dn = ldap.find_entry_dn("automountmapname", mapname, "automountmap")
+ dn = ldap.find_entry_dn("automountmapname", mapname, "automountmap", api.env.container_automount)
keys = api.Command['automount_getkeys'](mapname)
keydn = None
keyname = kw.get('automountkey').lower()
@@ -235,7 +235,7 @@ class automount_modmap(crud.Mod):
assert 'automountmapname' not in kw
assert 'dn' not in kw
ldap = self.api.Backend.ldap
- dn = ldap.find_entry_dn("automountmapname", mapname, "automountmap")
+ dn = ldap.find_entry_dn("automountmapname", mapname, "automountmap", api.env.container_automount)
return ldap.update(dn, **kw)
def output_for_cli(self, ret):
@@ -274,7 +274,7 @@ class automount_modkey(crud.Mod):
keyname = kw.get('automountkey').lower()
del kw['automountkey']
ldap = self.api.Backend.ldap
- dn = ldap.find_entry_dn("automountmapname", mapname, "automountmap")
+ dn = ldap.find_entry_dn("automountmapname", mapname, "automountmap", api.env.container_automount)
keys = api.Command['automount_getkeys'](mapname)
keydn = None
if keys:
@@ -388,7 +388,7 @@ class automount_showmap(crud.Get):
:param kw: "all" set to True = return all attributes
"""
ldap = self.api.Backend.ldap
- dn = ldap.find_entry_dn("automountmapname", mapname, "automountmap")
+ dn = ldap.find_entry_dn("automountmapname", mapname, "automountmap", api.env.container_automount)
# FIXME: should kw contain the list of attributes to display?
if kw.get('all', False):
return ldap.retrieve(dn)
@@ -420,7 +420,7 @@ class automount_showkey(crud.Get):
:param kw: "all" set to True = return all attributes
"""
ldap = self.api.Backend.ldap
- dn = ldap.find_entry_dn("automountmapname", mapname, "automountmap")
+ dn = ldap.find_entry_dn("automountmapname", mapname, "automountmap", api.env.container_automount)
keys = api.Command['automount_getkeys'](mapname)
keyname = kw.get('automountkey').lower()
keydn = None
@@ -468,7 +468,7 @@ class automount_getkeys(frontend.Command):
:param mapname: Retrieve all keys for this mapname
"""
ldap = self.api.Backend.ldap
- dn = ldap.find_entry_dn("automountmapname", mapname, "automountmap")
+ dn = ldap.find_entry_dn("automountmapname", mapname, "automountmap", api.env.container_automount)
try:
keys = ldap.get_one_entry(dn, 'objectclass=*', ['automountkey'])
except errors.NotFound: