summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
authorJan Zeleny <jzeleny@redhat.com>2011-01-26 13:09:26 +0100
committerRob Crittenden <rcritten@redhat.com>2011-02-10 15:11:26 -0500
commit978be506669d60b74a244cd067e8907153c7d407 (patch)
tree14932af3e29172701241c2abc51d81b007add1d6 /ipalib
parent456101bd297f2469f4e142614d295067b6da92c9 (diff)
downloadfreeipa-978be506669d60b74a244cd067e8907153c7d407.tar.gz
freeipa-978be506669d60b74a244cd067e8907153c7d407.tar.xz
freeipa-978be506669d60b74a244cd067e8907153c7d407.zip
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
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/cli.py27
1 files changed, 26 insertions, 1 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py
index 4ce7e7fa9..ca9ebfd51 100644
--- a/ipalib/cli.py
+++ b/ipalib/cli.py
@@ -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,
)