Rob Crittenden <rcrit...@redhat.com> wrote:
> Jan Zelený wrote:
> > 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
> > When reviewing, please pay attention to line 39 of the patch (detection
> > of the 'webui' in param.excludes). I think this is the right approach,
> > but I'm not 100% sure.
> > Thanks
> > Jan
I'm sending updated patch. Few comments:
> The argument should be a Str, not Bytes.
Should I change it in class help then? That's where I copied this from.
> This will blow up as expected in the FIXME if an unknown command is
> passed in.
> ipa show-mappings user-show returns just 'rights'
If it was the acting correctly, it shouldn't be displayed at all, because it
is not LDAP based (and user-show doesn't take any other LDAP-based
I'm just not sure how to do this with minimal changes. One option is to create
new flag denoting whether parameter is LDAP based or not and for each parameter
set it appropriately, but that is just too much effort for something that is
not that important. That's why I use the 'webui' flag to filter things at least
a little bit.
> Should it take a second arg or an option to lookup a specific
> attribute/option pair?
Frankly I don't see any real benefit. I thought about it when Dmitri suggested
it, but commands don't take that many options - IMO it's not a problem to find
one in a list of ten.
From 2db9043eb65006890b7e500502647a5a4d8e3fb5 Mon Sep 17 00:00:00 2001
From: Jan Zeleny <jzel...@redhat.com>
Date: Wed, 26 Jan 2011 13:09:26 +0100
Subject: [PATCH] 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.
ipalib/cli.py | 24 +++++++++++++++++++++++-
1 files changed, 23 insertions(+), 1 deletions(-)
diff --git a/ipalib/cli.py b/ipalib/cli.py
index 5543301c0c9039dc67b159c06526a0bdb3581c88..411abc6ba6792da1791b0d9450f709ce6cedfd4d 100644
@@ -47,7 +47,7 @@ import plugable
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
@@ -779,6 +779,27 @@ class help(frontend.Local):
print ' %s %s' % (to_cli(c.name).ljust(mcl), c.summary)
+ takes_args = (Str('command_name'),)
+ has_output = tuple()
+ def run(self, command_name):
+ command_name = from_cli(command_name)
+ if command_name not in self.Command:
+ print 'ERROR: unknown command \''+command_name+'\''
+ params = self.Command[command_name].options
+ out = [('Parameter','LDAP attribute'),
+ mcl = len(out)
+ for param in params():
+ if param.exclude and 'webui' in param.exclude:
+ out.append((param.cli_name, param.param_spec))
+ mcl = max(mcl,len(param.cli_name))
+ for item in out:
+ print to_cli(item).ljust(mcl)+' : '+item
"""Start the IPA interactive Python console."""
@@ -1047,6 +1068,7 @@ cli_plugins = (
Freeipa-devel mailing list