mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Provide a way to display CLI-LDAP relation
Since some LDAP attributes have their cli_name value defined, so they can be more user friendly, it can be difficult for user to find out which attributes do the parameteres given to CLI really represent. This patch provides new command, which will take another IPA command as and argument and display attributes which given command takes and what LDAP attributes are they mapped to. https://fedorahosted.org/freeipa/ticket/447
This commit is contained in:
committed by
Rob Crittenden
parent
456101bd29
commit
978be50666
@@ -47,7 +47,7 @@ import plugable
|
||||
import util
|
||||
from errors import PublicError, CommandError, HelpError, InternalError, NoSuchNamespaceError, ValidationError, NotFound, NotConfiguredError
|
||||
from constants import CLI_TAB
|
||||
from parameters import Password, Bytes, File
|
||||
from parameters import Password, Bytes, File, Str
|
||||
from text import _
|
||||
from ipapython.version import API_VERSION
|
||||
|
||||
@@ -767,6 +767,30 @@ class help(frontend.Local):
|
||||
print ' %s %s' % (to_cli(c.name).ljust(mcl), c.summary)
|
||||
print "\n"
|
||||
|
||||
class show_mappings(frontend.Command):
|
||||
takes_args = (
|
||||
Str('command_name',
|
||||
label=_('Command name'),
|
||||
),
|
||||
)
|
||||
has_output = tuple()
|
||||
|
||||
def run(self, command_name):
|
||||
command_name = from_cli(command_name)
|
||||
if command_name not in self.Command:
|
||||
raise CommandError(name=command_name)
|
||||
params = self.Command[command_name].options
|
||||
out = [('Parameter','LDAP attribute'),
|
||||
('=========','==============')]
|
||||
mcl = len(out[0][0])
|
||||
for param in params():
|
||||
if param.exclude and 'webui' in param.exclude:
|
||||
continue
|
||||
out.append((param.cli_name, param.param_spec))
|
||||
mcl = max(mcl,len(param.cli_name))
|
||||
for item in out:
|
||||
print to_cli(item[0]).ljust(mcl)+' : '+item[1]
|
||||
|
||||
|
||||
class console(frontend.Command):
|
||||
"""Start the IPA interactive Python console."""
|
||||
@@ -1045,6 +1069,7 @@ cli_plugins = (
|
||||
textui,
|
||||
console,
|
||||
help,
|
||||
show_mappings,
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user