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
From 6021801d788893ae467facd79379a8dfcf5842f7 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. https://fedorahosted.org/freeipa/ticket/447 --- ipalib/cli.py | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-) diff --git a/ipalib/cli.py b/ipalib/cli.py index 2d219b71bd1a17b0dc2977b3b7048d8318203c63..c2e8bdcf646d7f2c1a06de5053c1c82ee61695af 100644 --- a/ipalib/cli.py +++ b/ipalib/cli.py @@ -786,6 +786,26 @@ class help(frontend.Local): print ' %s %s' % (to_cli(c.name).ljust(mcl), c.summary) print "\n" +class show_mappings(frontend.Command): + takes_args = (Bytes('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: TODO fill in the text' + 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.""" @@ -1054,6 +1074,7 @@ cli_plugins = ( textui, console, help, + show_mappings, ) -- 1.7.3.4
_______________________________________________ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel