mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Add a function to show all the maps under a given mapname, def. is auto.master
This commit is contained in:
parent
fc8ac69372
commit
039ee0fd56
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user