Add a function to show all the maps under a given mapname, def. is auto.master

This commit is contained in:
Rob Crittenden 2008-12-08 15:37:36 -05:00
parent fc8ac69372
commit 039ee0fd56

View File

@ -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)