summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2008-12-08 15:37:36 -0500
committerRob Crittenden <rcritten@redhat.com>2008-12-10 14:15:20 -0500
commit039ee0fd56bbca60a79c99cdd489a1590f6f2b78 (patch)
treedd57ea2ec0f69903f485439f86f28ed45fced14d /ipalib
parentfc8ac693726ec33b5c0924f9b8ff5d663705a5a3 (diff)
downloadfreeipa-039ee0fd56bbca60a79c99cdd489a1590f6f2b78.tar.gz
freeipa-039ee0fd56bbca60a79c99cdd489a1590f6f2b78.tar.xz
freeipa-039ee0fd56bbca60a79c99cdd489a1590f6f2b78.zip
Add a function to show all the maps under a given mapname, def. is auto.master
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/plugins/f_automount.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/ipalib/plugins/f_automount.py b/ipalib/plugins/f_automount.py
index d2a70784..8de6c5ab 100644
--- a/ipalib/plugins/f_automount.py
+++ b/ipalib/plugins/f_automount.py
@@ -476,3 +476,35 @@ class automount_getkeys(frontend.Command):
textui.print_plain('%s' % k.get('automountkey'))
api.register(automount_getkeys)
+
+
+class automount_getmaps(frontend.Command):
+ 'Retrieve all automount maps'
+ takes_args = (
+ Param('automountmapname?',
+ cli_name='mapname',
+ primary_key=True,
+ doc='A group of related automount objects',
+ ),
+ )
+ def execute(self, mapname, **kw):
+ """
+ Execute the automount-getmaps operation.
+
+ Return a list of all automount maps.
+ """
+
+ ldap = self.api.Backend.ldap
+ base = api.env.container_automount + "," + api.env.basedn
+
+ if not mapname:
+ mapname = "auto.master"
+ search_base = "automountmapname=%s,%s" % (mapname, base)
+ maps = ldap.get_one_entry(search_base, "objectClass=*", ["*"])
+
+ return maps
+ def output_for_cli(self, textui, result, *args, **options):
+ for k in result:
+ textui.print_plain('%s: %s' % (k.get('automountinformation'), k.get('automountkey')))
+
+api.register(automount_getmaps)