summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2008-12-10 13:53:33 -0500
committerRob Crittenden <rcritten@redhat.com>2008-12-10 14:15:20 -0500
commitc34d2b8923ba0c8dc9a8aa1779a507a64c7c77db (patch)
tree12d22ca19d8e1cb403a3b74a31656194c0d287a9 /ipalib
parent3583735c60515d604b02ddb0c62e3da9c47807cf (diff)
downloadfreeipa-c34d2b8923ba0c8dc9a8aa1779a507a64c7c77db.tar.gz
freeipa-c34d2b8923ba0c8dc9a8aa1779a507a64c7c77db.tar.xz
freeipa-c34d2b8923ba0c8dc9a8aa1779a507a64c7c77db.zip
Add helper for adding Indirect maps.
This creates the map and the key pointing to the map. By default the key is associated with the auto.master map but it can be overriden.
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/plugins/f_automount.py57
1 files changed, 53 insertions, 4 deletions
diff --git a/ipalib/plugins/f_automount.py b/ipalib/plugins/f_automount.py
index 8de6c5ab9..4c392438d 100644
--- a/ipalib/plugins/f_automount.py
+++ b/ipalib/plugins/f_automount.py
@@ -435,13 +435,13 @@ class automount_showkey(crud.Get):
def output_for_cli(self, textui, result, *args, **options):
# The automount map name associated with this key is available only
# in the dn. Add it as an attribute to display instead.
- if entry and not entry.get('automountmapname'):
- elements = explode_dn(entry.get('dn').lower())
+ if result and not result.get('automountmapname'):
+ elements = explode_dn(result.get('dn').lower())
for e in elements:
(attr, value) = e.split('=',1)
if attr == 'automountmapname':
- entry['automountmapname'] = value
- display_entry(textui, entry)
+ result['automountmapname'] = value
+ display_entry(textui, result)
api.register(automount_showkey)
@@ -508,3 +508,52 @@ class automount_getmaps(frontend.Command):
textui.print_plain('%s: %s' % (k.get('automountinformation'), k.get('automountkey')))
api.register(automount_getmaps)
+
+class automount_addindirectmap(crud.Add):
+ 'Add a new automap indirect mount point.'
+ takes_options = (
+ Param('parentmap?',
+ cli_name='parentmap',
+ default='auto.master',
+ doc='The parent map to connect this to. Default: auto.master'),
+ Param('automountkey',
+ cli_name='key',
+ doc='An entry in an automount map'),
+ Param('description?',
+ doc='A description of the automount map'),
+ )
+
+ def execute(self, mapname, **kw):
+ """
+ Execute the automount-addindirectmap operation.
+
+ Returns the key entry as it will be created in LDAP.
+
+ This function creates 2 LDAP entries. It creates an
+ automountmapname entry and an automountkey entry.
+
+ :param mapname: The map name being added.
+ :param kw['parentmap'] is the top-level map to add this to.
+ defaulting to auto.master
+ :param kw['automountkey'] is the mount point
+ :param kw['description'] is a textual description of this map
+ """
+ mapkw = {}
+ if kw.get('description'):
+ mapkw['description'] = kw.get('description')
+ newmap = api.Command['automount_addmap'](mapname, **mapkw)
+
+ keykw = {'automountkey': kw['automountkey'], 'automountinformation': mapname}
+ if kw.get('description'):
+ keykw['description'] = kw.get('description')
+ newkey = api.Command['automount_addkey'](kw['parentmap'], **keykw)
+
+ return newkey
+ def output_for_cli(self, textui, result, map, **options):
+ """
+ Output result of this command to command line interface.
+ """
+ textui.print_plain("Indirect automount map %s added" % map)
+
+api.register(automount_addindirectmap)
+